diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-08-25 10:52:13 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-09-06 08:14:14 +0900 |
commit | 208e3d5e87be225b464122da82023e99430067a5 (patch) | |
tree | 442d8c5ec145bac343c6cc49e21e87d961f29446 /zebra/zapi_test.go | |
parent | 489aa616f05fcd086bd0c44ff2cc90119572fac6 (diff) |
zebra/zapi: Missing "Destination" in InterfaceAddressUpdateBody
This patch fixes to parse the missing "Destination" field in
InterfaceAddressUpdateBody message.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'zebra/zapi_test.go')
-rw-r--r-- | zebra/zapi_test.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/zebra/zapi_test.go b/zebra/zapi_test.go index 46dc6c38..fe1ffc80 100644 --- a/zebra/zapi_test.go +++ b/zebra/zapi_test.go @@ -95,18 +95,21 @@ func Test_InterfaceAddressUpdateBody(t *testing.T) { assert := assert.New(t) //DecodeFromBytes - buf := make([]byte, 11) + buf := make([]byte, 15) pos := 0 - binary.BigEndian.PutUint32(buf[pos:], 0) + binary.BigEndian.PutUint32(buf[pos:], 0) // index pos += 4 - buf[pos] = 0x01 + buf[pos] = 0x01 // flags pos += 1 - buf[pos] = 0x2 + buf[pos] = 0x2 // family pos += 1 - ip := net.ParseIP("192.168.100.1").To4() + ip := net.ParseIP("192.168.100.1").To4() // prefix copy(buf[pos:pos+4], []byte(ip)) pos += 4 - buf[pos] = byte(24) + buf[pos] = byte(24) // prefix len + pos += 1 + dst := net.ParseIP("192.168.100.255").To4() // destination + copy(buf[pos:pos+4], []byte(dst)) b := &InterfaceAddressUpdateBody{} err := b.DecodeFromBytes(buf, 2) @@ -114,6 +117,7 @@ func Test_InterfaceAddressUpdateBody(t *testing.T) { assert.Equal(uint8(1), b.Flags) assert.Equal("192.168.100.1", b.Prefix.String()) assert.Equal(uint8(24), b.Length) + assert.Equal("192.168.100.255", b.Destination.String()) // af invalid buf[5] = 0x4 |