Skip to content

Conversation

@AlekseyMamedoff
Copy link

Added attributes MinMTU, MaxMTU to LinkAttrs struct
Added cases for IFLA_MIN_MTU, IFLA_MAX_MTU
Signed-off-by: Aleksey Mamedov [email protected]

@lazysegtree
Copy link
Contributor

@AlekseyMamedoff , Fix for TestXfrmStateWithPcpunumWithoutSADir, the test which is failing in your PR, was recently merged in main. Please rebase with main.

@AlekseyMamedoff AlekseyMamedoff force-pushed the feature/add-mtu-limits branch from 8341ba3 to d4422e8 Compare July 23, 2025 10:13
@AlekseyMamedoff
Copy link
Author

@lazysegtree Done. Test passed. Thx.

base.Name = string(attr.Value[:len(attr.Value)-1])
case unix.IFLA_MTU:
base.MTU = int(native.Uint32(attr.Value[0:4]))
case unix.IFLA_MIN_MTU:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlekseyMamedoff
Shouldn't you also add a corresponding method LinkSetMinMTU

If you are adding functionality to parse this attribute via netlink, we should also be able to add it to Links

Copy link
Contributor

@lazysegtree lazysegtree Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a unit test would be great. Something like

func TestLinkMinMaxMTU(t *testing.T) {
	tearDown := setUpNetlinkTest(t)
	defer tearDown()

	iface := &Dummy{LinkAttrs{
		Name: "foo",
	}}
	if err := LinkAdd(iface); err != nil {
		t.Fatal(err)
	}

	link, err := LinkByName("foo")
	err = LinkSetMinMTU(link, 1000)
	if link.Attrs().MinMTU != 1000 {
		t.Fatal("MinMTU not correct")
	}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants