summaryrefslogtreecommitdiff
path: root/vendor/github.com/vishvananda/netlink/filter.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/vishvananda/netlink/filter.go')
-rw-r--r--vendor/github.com/vishvananda/netlink/filter.go62
1 files changed, 48 insertions, 14 deletions
diff --git a/vendor/github.com/vishvananda/netlink/filter.go b/vendor/github.com/vishvananda/netlink/filter.go
index 2dc34b995..413abdb47 100644
--- a/vendor/github.com/vishvananda/netlink/filter.go
+++ b/vendor/github.com/vishvananda/netlink/filter.go
@@ -260,6 +260,40 @@ func NewSkbEditAction() *SkbEditAction {
}
}
+type PoliceAction struct {
+ ActionAttrs
+ Rate uint32 // in byte per second
+ Burst uint32 // in byte
+ RCellLog int
+ Mtu uint32
+ Mpu uint16 // in byte
+ PeakRate uint32 // in byte per second
+ PCellLog int
+ AvRate uint32 // in byte per second
+ Overhead uint16
+ LinkLayer int
+ ExceedAction TcPolAct
+ NotExceedAction TcPolAct
+}
+
+func (action *PoliceAction) Type() string {
+ return "police"
+}
+
+func (action *PoliceAction) Attrs() *ActionAttrs {
+ return &action.ActionAttrs
+}
+
+func NewPoliceAction() *PoliceAction {
+ return &PoliceAction{
+ RCellLog: -1,
+ PCellLog: -1,
+ LinkLayer: 1, // ETHERNET
+ ExceedAction: TC_POLICE_RECLASSIFY,
+ NotExceedAction: TC_POLICE_OK,
+ }
+}
+
// MatchAll filters match all packets
type MatchAll struct {
FilterAttrs
@@ -275,20 +309,20 @@ func (filter *MatchAll) Type() string {
return "matchall"
}
-type FilterFwAttrs struct {
- ClassId uint32
- InDev string
- Mask uint32
- Index uint32
- Buffer uint32
- Mtu uint32
- Mpu uint16
- Rate uint32
- AvRate uint32
- PeakRate uint32
- Action TcPolAct
- Overhead uint16
- LinkLayer int
+type FwFilter struct {
+ FilterAttrs
+ ClassId uint32
+ InDev string
+ Mask uint32
+ Police *PoliceAction
+}
+
+func (filter *FwFilter) Attrs() *FilterAttrs {
+ return &filter.FilterAttrs
+}
+
+func (filter *FwFilter) Type() string {
+ return "fw"
}
type BpfFilter struct {