Fix non populated Table Family field (#45)

Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
This commit is contained in:
Serguei Bezverkhi 2019-08-12 02:51:06 -04:00 committed by Michael Stapelberg
parent 2f48b7d8d8
commit 1435f3a62c
1 changed files with 2 additions and 1 deletions

View File

@ -195,6 +195,8 @@ func chainFromMsg(msg netlink.Message) (*Chain, error) {
c.Name = ad.String() c.Name = ad.String()
case unix.NFTA_TABLE_NAME: case unix.NFTA_TABLE_NAME:
c.Table = &Table{Name: ad.String()} c.Table = &Table{Name: ad.String()}
// msg[0] carries TableFamily byte indicating whether it is IPv4, IPv6 or something else
c.Table.Family = TableFamily(msg.Data[0])
case unix.NFTA_CHAIN_TYPE: case unix.NFTA_CHAIN_TYPE:
c.Type = ChainType(ad.String()) c.Type = ChainType(ad.String())
case unix.NFTA_CHAIN_POLICY: case unix.NFTA_CHAIN_POLICY:
@ -205,7 +207,6 @@ func chainFromMsg(msg netlink.Message) (*Chain, error) {
return err return err
}) })
} }
} }
return &c, nil return &c, nil