Fix txqueuelen being accidentally set to zero

TxQLen was unintentionally set to 0 due to a struct literal.

Signed-off-by: Gudmundur Bjarni Olafsson <gudmundur.bjarni@gmail.com>
This commit is contained in:
Gudmundur Bjarni Olafsson
2024-09-23 13:04:24 +02:00
committed by Casey Callendrello
parent c11ed48733
commit 3a49cff1f6
24 changed files with 155 additions and 155 deletions

View File

@ -335,16 +335,11 @@ func bridgeByName(name string) (*netlink.Bridge, error) {
}
func ensureBridge(brName string, mtu int, promiscMode, vlanFiltering bool) (*netlink.Bridge, error) {
linkAttrs := netlink.NewLinkAttrs()
linkAttrs.Name = brName
linkAttrs.MTU = mtu
br := &netlink.Bridge{
LinkAttrs: netlink.LinkAttrs{
Name: brName,
MTU: mtu,
// Let kernel use default txqueuelen; leaving it unset
// means 0, and a zero-length TX queue messes up FIFO
// traffic shapers which use TX queue length as the
// default packet limit
TxQLen: -1,
},
LinkAttrs: linkAttrs,
}
if vlanFiltering {
br.VlanFiltering = &vlanFiltering

View File

@ -1890,10 +1890,10 @@ var _ = Describe("bridge Operations", func() {
err := originalNS.Do(func(ns.NetNS) error {
defer GinkgoRecover()
linkAttrs := netlink.NewLinkAttrs()
linkAttrs.Name = BRNAME
err := netlink.LinkAdd(&netlink.Bridge{
LinkAttrs: netlink.LinkAttrs{
Name: BRNAME,
},
LinkAttrs: linkAttrs,
})
Expect(err).NotTo(HaveOccurred())
link, err := netlink.LinkByName(BRNAME)