From 62076da8d430889d29276314465bdad9fa1b7e2c Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Thu, 15 Nov 2018 20:14:21 +0900 Subject: packet: fix NewPathAttributeNextHop() to handle ipv6 addresss PathAttributeNextHop struct can handle ipv6 address but NewPathAttributeNextHop() can't. Signed-off-by: FUJITA Tomonori --- pkg/packet/bgp/bgp_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'pkg/packet/bgp/bgp_test.go') 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") +} -- cgit v1.2.3