diff --git a/link.go b/link.go index ebdfd2c..5c34395 100644 --- a/link.go +++ b/link.go @@ -16,6 +16,7 @@ type Link interface { type LinkAttrs struct { Index int MTU int + TxQLen uint32 // Transmit Queue Length Name string HardwareAddr net.HardwareAddr Flags net.Flags diff --git a/link_linux.go b/link_linux.go index 7d48a70..bac8349 100644 --- a/link_linux.go +++ b/link_linux.go @@ -266,6 +266,8 @@ func LinkAdd(link Link) error { linkInfo := nl.NewRtAttr(syscall.IFLA_LINKINFO, nil) nl.NewRtAttrChild(linkInfo, nl.IFLA_INFO_KIND, nl.NonZeroTerminated(link.Type())) + nl.NewRtAttrChild(linkInfo, syscall.IFLA_TXQLEN, nl.Uint32Attr(base.TxQLen)) + if vlan, ok := link.(*Vlan); ok { b := make([]byte, 2) native.PutUint16(b, uint16(vlan.VlanId)) @@ -276,6 +278,7 @@ func LinkAdd(link Link) error { peer := nl.NewRtAttrChild(data, nl.VETH_INFO_PEER, nil) nl.NewIfInfomsgChild(peer, syscall.AF_UNSPEC) nl.NewRtAttrChild(peer, syscall.IFLA_IFNAME, nl.ZeroTerminated(veth.PeerName)) + nl.NewRtAttrChild(peer, syscall.IFLA_TXQLEN, nl.Uint32Attr(base.TxQLen)) } else if vxlan, ok := link.(*Vxlan); ok { addVxlanAttrs(vxlan, linkInfo) } @@ -457,6 +460,8 @@ func linkDeserialize(m []byte) (Link, error) { base.ParentIndex = int(native.Uint32(attr.Value[0:4])) case syscall.IFLA_MASTER: base.MasterIndex = int(native.Uint32(attr.Value[0:4])) + case syscall.IFLA_TXQLEN: + base.TxQLen = native.Uint32(attr.Value[0:4]) } } // Links that don't have IFLA_INFO_KIND are hardware devices