diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-15 20:14:21 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-16 06:03:56 +0900 |
commit | 62076da8d430889d29276314465bdad9fa1b7e2c (patch) | |
tree | 2cd9e674088c9ab1e1f37ff8b16179f950cb9f8f /pkg/packet/bgp/bgp_test.go | |
parent | 2dddaeffb8bfe9087a77636961b1e701f4236a7c (diff) |
packet: fix NewPathAttributeNextHop() to handle ipv6 addresss
PathAttributeNextHop struct can handle ipv6 address but
NewPathAttributeNextHop() can't.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'pkg/packet/bgp/bgp_test.go')
-rw-r--r-- | pkg/packet/bgp/bgp_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/packet/bgp/bgp_test.go b/pkg/packet/bgp/bgp_test.go index a4801f27..6a2d5f12 100644 --- a/pkg/packet/bgp/bgp_test.go +++ b/pkg/packet/bgp/bgp_test.go @@ -1192,3 +1192,14 @@ func TestNormalizeFlowSpecOpValues(t *testing.T) { }) } } + +func Test_PathAttributeNextHop(t *testing.T) { + f := func(addr string) { + b, _ := NewPathAttributeNextHop(addr).Serialize() + p := PathAttributeNextHop{} + p.DecodeFromBytes(b) + assert.Equal(t, addr, p.Value.String()) + } + f("192.0.2.1") + f("2001:db8::68") +} |