forked from ti-mo/conntrack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter.go
More file actions
28 lines (24 loc) · 703 Bytes
/
filter.go
File metadata and controls
28 lines (24 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package conntrack
import (
"github.com/ti-mo/netfilter"
)
// Filter is a structure used in dump operations to filter the response
// based on a given connmark and mask. The mask is applied to the Mark field of
// all flows in the conntrack table, the result is compared to the filter's Mark.
// Each flow that matches will be returned by the kernel.
type Filter struct {
Mark, Mask uint32
}
// marshal marshals a Filter into a list of netfilter.Attributes.
func (f Filter) marshal() []netfilter.Attribute {
return []netfilter.Attribute{
{
Type: uint16(ctaMark),
Data: netfilter.Uint32Bytes(f.Mark),
},
{
Type: uint16(ctaMarkMask),
Data: netfilter.Uint32Bytes(f.Mask),
},
}
}