diff --git a/xt/match_conntrack.go b/xt/match_conntrack.go index fef4e8e..69c51bd 100644 --- a/xt/match_conntrack.go +++ b/xt/match_conntrack.go @@ -41,6 +41,8 @@ type ConntrackMtinfoBase struct { OrigDstPort uint16 ReplSrcPort uint16 ReplDstPort uint16 + MatchFlags uint16 + InvertFlags uint16 } // See https://elixir.bootlin.com/linux/v5.17.7/source/include/uapi/linux/netfilter/xt_conntrack.h#L38 @@ -98,6 +100,8 @@ func (x *ConntrackMtinfoBase) marshalAB(fam TableFamily, rev uint32, ab *aligned ab.PutUint16(x.OrigDstPort) ab.PutUint16(x.ReplSrcPort) ab.PutUint16(x.ReplDstPort) + ab.PutUint16(x.MatchFlags) + ab.PutUint16(x.InvertFlags) return nil } @@ -148,6 +152,12 @@ func (x *ConntrackMtinfoBase) unmarshalAB(fam TableFamily, rev uint32, ab *align if x.ReplDstPort, err = ab.Uint16(); err != nil { return err } + if x.MatchFlags, err = ab.Uint16(); err != nil { + return err + } + if x.InvertFlags, err = ab.Uint16(); err != nil { + return err + } return nil } diff --git a/xt/match_conntrack_test.go b/xt/match_conntrack_test.go index 6b69b2d..fa1f764 100644 --- a/xt/match_conntrack_test.go +++ b/xt/match_conntrack_test.go @@ -38,6 +38,8 @@ func TestMatchConntrack(t *testing.T) { OrigDstPort: 321, ReplSrcPort: 789, ReplDstPort: 987, + MatchFlags: 0x01, + InvertFlags: 0x01, }, StateMask: 0x55, StatusMask: 0xaa, @@ -65,6 +67,8 @@ func TestMatchConntrack(t *testing.T) { OrigDstPort: 321, ReplSrcPort: 789, ReplDstPort: 987, + MatchFlags: 0x01, + InvertFlags: 0x01, }, StateMask: 0x55, StatusMask: 0xaa, @@ -92,6 +96,8 @@ func TestMatchConntrack(t *testing.T) { OrigDstPort: 321, ReplSrcPort: 789, ReplDstPort: 987, + MatchFlags: 0x01, + InvertFlags: 0x01, }, StateMask: 0x55aa, StatusMask: 0xaa55, @@ -119,6 +125,8 @@ func TestMatchConntrack(t *testing.T) { OrigDstPort: 321, ReplSrcPort: 789, ReplDstPort: 987, + MatchFlags: 0x01, + InvertFlags: 0x01, }, StateMask: 0x55aa, StatusMask: 0xaa55, @@ -147,6 +155,8 @@ func TestMatchConntrack(t *testing.T) { OrigDstPort: 321, ReplSrcPort: 789, ReplDstPort: 987, + MatchFlags: 0x01, + InvertFlags: 0x01, }, StateMask: 0x55aa, StatusMask: 0xaa55, @@ -180,6 +190,8 @@ func TestMatchConntrack(t *testing.T) { OrigDstPort: 321, ReplSrcPort: 789, ReplDstPort: 987, + MatchFlags: 0x01, + InvertFlags: 0x01, }, StateMask: 0x55aa, StatusMask: 0xaa55,