diff options
Diffstat (limited to 'vendor/github.com/vishvananda/netlink/rule.go')
-rw-r--r-- | vendor/github.com/vishvananda/netlink/rule.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/vendor/github.com/vishvananda/netlink/rule.go b/vendor/github.com/vishvananda/netlink/rule.go index 95f2facfb..9b7b0af49 100644 --- a/vendor/github.com/vishvananda/netlink/rule.go +++ b/vendor/github.com/vishvananda/netlink/rule.go @@ -28,7 +28,18 @@ type Rule struct { } func (r Rule) String() string { - return fmt.Sprintf("ip rule %d: from %s table %d", r.Priority, r.Src, r.Table) + from := "all" + if r.Src != nil && r.Src.String() != "<nil>" { + from = r.Src.String() + } + + to := "all" + if r.Dst != nil && r.Dst.String() != "<nil>" { + to = r.Dst.String() + } + + return fmt.Sprintf("ip rule %d: from %s to %s table %d", + r.Priority, from, to, r.Table) } // NewRule return empty rules. |