use TableFamilyUnspecified (NFPROTO_UNSPEC) instead of AF_UNSPEC (#165)

This commit is contained in:
TheDiveO 2022-05-15 23:16:05 +02:00 committed by GitHub
parent 58da7d8bf3
commit 06687b6e34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -184,7 +184,7 @@ func (cc *Conn) ListChains() ([]*Chain, error) {
Type: netlink.HeaderType((unix.NFNL_SUBSYS_NFTABLES << 8) | unix.NFT_MSG_GETCHAIN),
Flags: netlink.Request | netlink.Dump,
},
Data: extraHeader(uint8(unix.AF_UNSPEC), 0),
Data: extraHeader(uint8(TableFamilyUnspecified), 0),
}
response, err := conn.Execute(msg)

View File

@ -28,12 +28,13 @@ type TableFamily byte
// Possible TableFamily values.
const (
TableFamilyINet TableFamily = unix.NFPROTO_INET
TableFamilyIPv4 TableFamily = unix.NFPROTO_IPV4
TableFamilyIPv6 TableFamily = unix.NFPROTO_IPV6
TableFamilyARP TableFamily = unix.NFPROTO_ARP
TableFamilyNetdev TableFamily = unix.NFPROTO_NETDEV
TableFamilyBridge TableFamily = unix.NFPROTO_BRIDGE
TableFamilyUnspecified TableFamily = unix.NFPROTO_UNSPEC
TableFamilyINet TableFamily = unix.NFPROTO_INET
TableFamilyIPv4 TableFamily = unix.NFPROTO_IPV4
TableFamilyIPv6 TableFamily = unix.NFPROTO_IPV6
TableFamilyARP TableFamily = unix.NFPROTO_ARP
TableFamilyNetdev TableFamily = unix.NFPROTO_NETDEV
TableFamilyBridge TableFamily = unix.NFPROTO_BRIDGE
)
// A Table contains Chains. See also
@ -111,7 +112,7 @@ func (cc *Conn) ListTables() ([]*Table, error) {
Type: netlink.HeaderType((unix.NFNL_SUBSYS_NFTABLES << 8) | unix.NFT_MSG_GETTABLE),
Flags: netlink.Request | netlink.Dump,
},
Data: extraHeader(uint8(unix.AF_UNSPEC), 0),
Data: extraHeader(uint8(TableFamilyUnspecified), 0),
}
response, err := conn.Execute(msg)