Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Mark int
Mask int
Tos uint
Type int

Check failure on line 16 in rule.go

View workflow job for this annotation

GitHub Actions / build-macos

other declaration of Type

Check failure on line 16 in rule.go

View workflow job for this annotation

GitHub Actions / build

other declaration of Type
TunID uint
Goto int
Src *net.IPNet
Expand All @@ -28,7 +29,7 @@
IPProto int
UIDRange *RuleUIDRange
Protocol uint8
}

Check failure on line 32 in rule.go

View workflow job for this annotation

GitHub Actions / build-macos

Type redeclared

Check failure on line 32 in rule.go

View workflow job for this annotation

GitHub Actions / build

Type redeclared

func (r Rule) String() string {
from := "all"
Expand Down
6 changes: 6 additions & 0 deletions rule_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
msg.Scope = unix.RT_SCOPE_UNIVERSE
msg.Table = unix.RT_TABLE_UNSPEC
msg.Type = unix.RTN_UNSPEC
if req.NlMsghdr.Flags&unix.NLM_F_CREATE > 0 {

Check failure on line 47 in rule_linux.go

View workflow job for this annotation

GitHub Actions / build

cannot use rule.Type (variable of type int) as uint8 value in assignment
msg.Type = unix.RTN_UNICAST
}
if rule.Invert {
Expand All @@ -59,6 +59,9 @@
if rule.Tos != 0 {
msg.Tos = uint8(rule.Tos)
}
if rule.Type > 0 {
msg.Type = uint8(rule.Type)
}

var dstFamily uint8
var rtAttrs []*nl.RtAttr
Expand Down Expand Up @@ -225,6 +228,7 @@
rule.Invert = msg.Flags&FibRuleInvert > 0
rule.Family = int(msg.Family)
rule.Tos = uint(msg.Tos)
rule.Type = int(msg.Type)

for j := range attrs {
switch attrs[j].Attr.Type {
Expand Down Expand Up @@ -292,6 +296,8 @@
continue
case filterMask&RT_FILTER_TOS != 0 && rule.Tos != filter.Tos:
continue
case filterMask&RT_FILTER_TYPE != 0 && rule.Type != filter.Type:
continue
case filterMask&RT_FILTER_PRIORITY != 0 && rule.Priority != filter.Priority:
continue
case filterMask&RT_FILTER_MARK != 0 && rule.Mark != filter.Mark:
Expand Down
Loading