mirror of https://github.com/vishvananda/netlink
skip qdiscs from other interfaces
This commit is contained in:
parent
acc8a28738
commit
7b3d58b87e
|
@ -65,13 +65,15 @@ func QdiscAdd(qdisc Qdisc) error {
|
|||
// The list can be filtered by link.
|
||||
func QdiscList(link Link) ([]Qdisc, error) {
|
||||
req := nl.NewNetlinkRequest(syscall.RTM_GETQDISC, syscall.NLM_F_DUMP)
|
||||
msg := &nl.TcMsg{
|
||||
Family: nl.FAMILY_ALL,
|
||||
}
|
||||
index := int32(0)
|
||||
if link != nil {
|
||||
base := link.Attrs()
|
||||
ensureIndex(base)
|
||||
msg.Ifindex = int32(base.Index)
|
||||
index = int32(base.Index)
|
||||
}
|
||||
msg := &nl.TcMsg{
|
||||
Family: nl.FAMILY_ALL,
|
||||
Ifindex: index,
|
||||
}
|
||||
req.AddData(msg)
|
||||
|
||||
|
@ -80,7 +82,6 @@ func QdiscList(link Link) ([]Qdisc, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
//native := nl.NativeEndian()
|
||||
var res []Qdisc
|
||||
for _, m := range msgs {
|
||||
msg := nl.DeserializeTcMsg(m)
|
||||
|
@ -90,6 +91,11 @@ func QdiscList(link Link) ([]Qdisc, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// skip qdiscs from other interfaces
|
||||
if link != nil && msg.Ifindex != index {
|
||||
continue
|
||||
}
|
||||
|
||||
base := QdiscAttrs{
|
||||
LinkIndex: int(msg.Ifindex),
|
||||
Handle: msg.Handle,
|
||||
|
|
Loading…
Reference in New Issue