Skip to content

Commit 7a3403a

Browse files
tklauseraboch
authored andcommitted
Don't log on unknown fou or ipset attributes
The library doesn't log anywhere else for (yet) unknown attributes. These may appear any time a new kernel is used which adds new attributes.
1 parent 9f36d66 commit 7a3403a

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

fou_linux.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package netlink
66
import (
77
"encoding/binary"
88
"errors"
9-
"log"
109
"net"
1110

1211
"github.com/vishvananda/netlink/nl"
@@ -202,8 +201,6 @@ func deserializeFouMsg(msg []byte) (Fou, error) {
202201
fou.PeerPort = int(networkOrder.Uint16(attr.Value))
203202
case FOU_ATTR_IFINDEX:
204203
fou.IfIndex = int(native.Uint16(attr.Value))
205-
default:
206-
log.Printf("unknown fou attribute from kernel: %+v %v", attr, attr.Type&nl.NLA_TYPE_MASK)
207204
}
208205
}
209206

ipset_linux.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package netlink
22

33
import (
44
"encoding/binary"
5-
"log"
65
"net"
76
"syscall"
87

@@ -516,8 +515,6 @@ func (result *IPSetResult) unserialize(msg []byte) {
516515
result.ProtocolMinVersion = attr.Value[0]
517516
case nl.IPSET_ATTR_MARKMASK:
518517
result.MarkMask = attr.Uint32()
519-
default:
520-
log.Printf("unknown ipset attribute from kernel: %+v %v", attr, attr.Type&nl.NLA_TYPE_MASK)
521518
}
522519
}
523520
}
@@ -547,17 +544,13 @@ func (result *IPSetResult) parseAttrData(data []byte) {
547544
result.Entries = append(result.Entries, IPSetEntry{IP: nested.Value})
548545
case nl.IPSET_ATTR_IP:
549546
result.IPFrom = nested.Value
550-
default:
551-
log.Printf("unknown nested ipset data attribute from kernel: %+v %v", nested, nested.Type&nl.NLA_TYPE_MASK)
552547
}
553548
}
554549
case nl.IPSET_ATTR_IP_TO | nl.NLA_F_NESTED:
555550
for nested := range nl.ParseAttributes(attr.Value) {
556551
switch nested.Type {
557552
case nl.IPSET_ATTR_IP:
558553
result.IPTo = nested.Value
559-
default:
560-
log.Printf("unknown nested ipset data attribute from kernel: %+v %v", nested, nested.Type&nl.NLA_TYPE_MASK)
561554
}
562555
}
563556
case nl.IPSET_ATTR_PORT_FROM | nl.NLA_F_NET_BYTEORDER:
@@ -570,8 +563,6 @@ func (result *IPSetResult) parseAttrData(data []byte) {
570563
result.Comment = nl.BytesToString(attr.Value)
571564
case nl.IPSET_ATTR_MARKMASK:
572565
result.MarkMask = attr.Uint32()
573-
default:
574-
log.Printf("unknown ipset data attribute from kernel: %+v %v", attr, attr.Type&nl.NLA_TYPE_MASK)
575566
}
576567
}
577568
}
@@ -581,8 +572,6 @@ func (result *IPSetResult) parseAttrADT(data []byte) {
581572
switch attr.Type {
582573
case nl.IPSET_ATTR_DATA | nl.NLA_F_NESTED:
583574
result.Entries = append(result.Entries, parseIPSetEntry(attr.Value))
584-
default:
585-
log.Printf("unknown ADT attribute from kernel: %+v %v", attr, attr.Type&nl.NLA_TYPE_MASK)
586575
}
587576
}
588577
}
@@ -610,17 +599,13 @@ func parseIPSetEntry(data []byte) (entry IPSetEntry) {
610599
switch attr.Type {
611600
case nl.IPSET_ATTR_IPADDR_IPV4, nl.IPSET_ATTR_IPADDR_IPV6:
612601
entry.IP = net.IP(attr.Value)
613-
default:
614-
log.Printf("unknown nested ADT attribute from kernel: %+v", attr)
615602
}
616603
}
617604
case nl.IPSET_ATTR_IP2 | nl.NLA_F_NESTED:
618605
for attr := range nl.ParseAttributes(attr.Value) {
619606
switch attr.Type {
620607
case nl.IPSET_ATTR_IPADDR_IPV4, nl.IPSET_ATTR_IPADDR_IPV6:
621608
entry.IP2 = net.IP(attr.Value)
622-
default:
623-
log.Printf("unknown nested ADT attribute from kernel: %+v", attr)
624609
}
625610
}
626611
case nl.IPSET_ATTR_CIDR:
@@ -638,8 +623,6 @@ func parseIPSetEntry(data []byte) (entry IPSetEntry) {
638623
case nl.IPSET_ATTR_MARK | nl.NLA_F_NET_BYTEORDER:
639624
val := attr.Uint32()
640625
entry.Mark = &val
641-
default:
642-
log.Printf("unknown ADT attribute from kernel: %+v", attr)
643626
}
644627
}
645628
return

0 commit comments

Comments
 (0)