diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-28 01:19:39 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-07-01 21:24:40 +0900 |
commit | 8a3724c7fdd6f02311e669f2aa0fc28190faaf66 (patch) | |
tree | 03ba90fd5474ea95cea110448a1bfef3c0c38a09 /packet | |
parent | e05f71ed34b04a48184e0544126f47fc8ea50a02 (diff) |
packet: put 0 in len field of EVPNMacIPAdvertisementRoute when 0.0.0.0
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'packet')
-rw-r--r-- | packet/bgp.go | 6 |
1 files 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) } |