From 8a3724c7fdd6f02311e669f2aa0fc28190faaf66 Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Sun, 28 Jun 2015 01:19:39 +0900 Subject: packet: put 0 in len field of EVPNMacIPAdvertisementRoute when 0.0.0.0 Signed-off-by: ISHIDA Wataru --- packet/bgp.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packet/bgp.go b/packet/bgp.go index 0d0abd3f..4301d7c1 100644 --- a/packet/bgp.go +++ b/packet/bgp.go @@ -1423,13 +1423,15 @@ func (er *EVPNMacIPAdvertisementRoute) Serialize() ([]byte, error) { copy(tbuf[1:], er.MacAddress) buf = append(buf, tbuf...) - if er.IPAddressLength == 32 || er.IPAddressLength == 128 { + if er.IPAddressLength == 0 { + buf = append(buf, 0) + } else if er.IPAddressLength == 32 || er.IPAddressLength == 128 { buf = append(buf, er.IPAddressLength) if er.IPAddressLength == 32 { er.IPAddress = er.IPAddress.To4() } buf = append(buf, []byte(er.IPAddress)...) - } else if er.IPAddressLength != 0 { + } else { return nil, fmt.Errorf("Invalid IP address length", er.IPAddressLength) } -- cgit v1.2.3