Skip to content

Commit d376c8d

Browse files
committed
Replace correct usage for the netlink default
This use case of the literal is correct, and calls out the reason for explicitly setting TxQLen. This change switches to the helper still.
1 parent 02b0b17 commit d376c8d

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

plugins/main/bridge/bridge.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,16 +335,11 @@ func bridgeByName(name string) (*netlink.Bridge, error) {
335335
}
336336

337337
func ensureBridge(brName string, mtu int, promiscMode, vlanFiltering bool) (*netlink.Bridge, error) {
338+
linkAttrs := netlink.NewLinkAttrs()
339+
linkAttrs.Name = brName
340+
linkAttrs.MTU = mtu
338341
br := &netlink.Bridge{
339-
LinkAttrs: netlink.LinkAttrs{
340-
Name: brName,
341-
MTU: mtu,
342-
// Let kernel use default txqueuelen; leaving it unset
343-
// means 0, and a zero-length TX queue messes up FIFO
344-
// traffic shapers which use TX queue length as the
345-
// default packet limit
346-
TxQLen: -1,
347-
},
342+
LinkAttrs: linkAttrs,
348343
}
349344
if vlanFiltering {
350345
br.VlanFiltering = &vlanFiltering

0 commit comments

Comments
 (0)