mirror of
https://github.com/vishvananda/netlink
synced 2024-12-27 00:52:11 +00:00
parent
1b5637395d
commit
dbf1bd04f9
@ -223,6 +223,7 @@ func (h *Handle) RuleListFiltered(family int, filter *Rule, filterMask uint64) (
|
||||
rule := NewRule()
|
||||
|
||||
rule.Invert = msg.Flags&FibRuleInvert > 0
|
||||
rule.Family = int(msg.Family)
|
||||
rule.Tos = uint(msg.Tos)
|
||||
|
||||
for j := range attrs {
|
||||
|
11
rule_test.go
11
rule_test.go
@ -23,6 +23,7 @@ func TestRuleAddDel(t *testing.T) {
|
||||
}
|
||||
|
||||
rule := NewRule()
|
||||
rule.Family = FAMILY_V4
|
||||
rule.Table = unix.RT_TABLE_MAIN
|
||||
rule.Src = srcNet
|
||||
rule.Dst = dstNet
|
||||
@ -121,6 +122,7 @@ func runRuleListFiltered(t *testing.T, family int, srcNet, dstNet *net.IPNet) {
|
||||
r := NewRule()
|
||||
r.Src = srcNet
|
||||
r.Priority = 1 // Must add priority and table otherwise it's auto-assigned
|
||||
r.Family = family
|
||||
r.Table = 1
|
||||
RuleAdd(r)
|
||||
return r
|
||||
@ -138,6 +140,7 @@ func runRuleListFiltered(t *testing.T, family int, srcNet, dstNet *net.IPNet) {
|
||||
r := NewRule()
|
||||
r.Dst = dstNet
|
||||
r.Priority = 1 // Must add priority and table otherwise it's auto-assigned
|
||||
r.Family = family
|
||||
r.Table = 1
|
||||
RuleAdd(r)
|
||||
return r
|
||||
@ -155,6 +158,7 @@ func runRuleListFiltered(t *testing.T, family int, srcNet, dstNet *net.IPNet) {
|
||||
r := NewRule()
|
||||
r.Dst = dstNet
|
||||
r.Priority = 1 // Must add priority and table otherwise it's auto-assigned
|
||||
r.Family = family
|
||||
r.Table = 1
|
||||
RuleAdd(r)
|
||||
|
||||
@ -190,6 +194,7 @@ func runRuleListFiltered(t *testing.T, family int, srcNet, dstNet *net.IPNet) {
|
||||
r := NewRule()
|
||||
r.Dst = dstNet
|
||||
r.Priority = 1 // Must add priority and table otherwise it's auto-assigned
|
||||
r.Family = family
|
||||
r.Table = 1
|
||||
RuleAdd(r)
|
||||
|
||||
@ -225,6 +230,7 @@ func runRuleListFiltered(t *testing.T, family int, srcNet, dstNet *net.IPNet) {
|
||||
r := NewRule()
|
||||
r.Src = srcNet
|
||||
r.Priority = 5
|
||||
r.Family = family
|
||||
r.Table = 1
|
||||
RuleAdd(r)
|
||||
|
||||
@ -266,6 +272,7 @@ func runRuleListFiltered(t *testing.T, family int, srcNet, dstNet *net.IPNet) {
|
||||
r := NewRule()
|
||||
r.Src = srcNet
|
||||
r.Priority = 1 // Must add priority otherwise it's auto-assigned
|
||||
r.Family = family
|
||||
r.Table = 199
|
||||
RuleAdd(r)
|
||||
return r
|
||||
@ -283,6 +290,7 @@ func runRuleListFiltered(t *testing.T, family int, srcNet, dstNet *net.IPNet) {
|
||||
r := NewRule()
|
||||
r.Src = srcNet
|
||||
r.Priority = 1 // Must add priority and table otherwise it's auto-assigned
|
||||
r.Family = family
|
||||
r.Table = 1
|
||||
r.Mask = 0x5
|
||||
RuleAdd(r)
|
||||
@ -301,6 +309,7 @@ func runRuleListFiltered(t *testing.T, family int, srcNet, dstNet *net.IPNet) {
|
||||
r := NewRule()
|
||||
r.Src = srcNet
|
||||
r.Priority = 1 // Must add priority, table, mask otherwise it's auto-assigned
|
||||
r.Family = family
|
||||
r.Table = 1
|
||||
r.Mask = 0xff
|
||||
r.Mark = 0xbb
|
||||
@ -320,6 +329,7 @@ func runRuleListFiltered(t *testing.T, family int, srcNet, dstNet *net.IPNet) {
|
||||
r := NewRule()
|
||||
r.Src = srcNet
|
||||
r.Priority = 1 // Must add priority, table, mask otherwise it's auto-assigned
|
||||
r.Family = family
|
||||
r.Table = 12
|
||||
r.Tos = 12 // Tos must equal table
|
||||
RuleAdd(r)
|
||||
@ -418,6 +428,7 @@ func ruleEquals(a, b Rule) bool {
|
||||
(a.Dst != nil && b.Dst != nil && a.Dst.String() == b.Dst.String())) &&
|
||||
a.OifName == b.OifName &&
|
||||
a.Priority == b.Priority &&
|
||||
a.Family == b.Family &&
|
||||
a.IifName == b.IifName &&
|
||||
a.Invert == b.Invert &&
|
||||
a.Tos == b.Tos &&
|
||||
|
Loading…
Reference in New Issue
Block a user