diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-09-29 13:50:19 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-10-30 09:29:13 +0900 |
commit | 024eec392258330c14236784878a22de745e06a2 (patch) | |
tree | 0cbc6b8d8f3a1154a8e482561797f16b687b00b0 /table | |
parent | e9b799f15c0d5acd9292276a9e84ee2f74505068 (diff) |
table/path: net.IP.IsUnspecified() instead of isZero()
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'table')
-rw-r--r-- | table/path.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/table/path.go b/table/path.go index fbe426c5..01a85f00 100644 --- a/table/path.go +++ b/table/path.go @@ -257,13 +257,10 @@ func UpdatePathAttrs(global *config.Global, peer *config.Neighbor, info *PeerInf } localAddress := info.LocalAddress - isZero := func(ip net.IP) bool { - return ip.Equal(net.ParseIP("0.0.0.0")) || ip.Equal(net.ParseIP("::")) - } nexthop := path.GetNexthop() if peer.State.PeerType == config.PEER_TYPE_EXTERNAL { // NEXTHOP handling - if !path.IsLocal() || isZero(nexthop) { + if !path.IsLocal() || nexthop.IsUnspecified() { path.SetNexthop(localAddress) } @@ -283,7 +280,7 @@ func UpdatePathAttrs(global *config.Global, peer *config.Neighbor, info *PeerInf // if the path generated locally set local address as nexthop. // if not, don't modify it. // TODO: NEXT-HOP-SELF support - if path.IsLocal() && isZero(nexthop) { + if path.IsLocal() && nexthop.IsUnspecified() { path.SetNexthop(localAddress) } |