diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-04-24 08:44:06 +0000 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-04-24 08:44:06 +0000 |
commit | 88cf77b5ea70cf67ff73f4106f8a40cff4db98c4 (patch) | |
tree | 2a6c360083dc0091bdf01a6551ac488dbd5ed692 | |
parent | 1332ae53b2484cb713f1e8b1ae6c041174057770 (diff) |
gobgp: fix bug of sorting ipv6 neighbors
use proper addrlen depending on peer's address family
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r-- | gobgp/main.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gobgp/main.go b/gobgp/main.go index b77122b5..f5e747fb 100644 --- a/gobgp/main.go +++ b/gobgp/main.go @@ -125,8 +125,12 @@ func (p peers) Less(i, j int) bool { } return false } - strings := sort.StringSlice{cidr2prefix(fmt.Sprintf("%s/32", p1.String())), - cidr2prefix(fmt.Sprintf("%s/32", p2.String()))} + addrlen := 128 + if p1Isv4 { + addrlen = 32 + } + strings := sort.StringSlice{cidr2prefix(fmt.Sprintf("%s/%d", p1.String(), addrlen)), + cidr2prefix(fmt.Sprintf("%s/%d", p2.String(), addrlen))} return strings.Less(0, 1) } |