summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packet/bgp.go6
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)
}