From 42feaea2a0bfc3deb1becdc8c06e4bad44a4b52c Mon Sep 17 00:00:00 2001 From: JieJhih Jhang Date: Fri, 29 Mar 2019 17:12:10 +0800 Subject: cmd/gobgp: Parse evpn IPMSI parameter --- pkg/packet/bgp/bgp.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pkg/packet') diff --git a/pkg/packet/bgp/bgp.go b/pkg/packet/bgp/bgp.go index 0aae3559..4d899f24 100644 --- a/pkg/packet/bgp/bgp.go +++ b/pkg/packet/bgp/bgp.go @@ -2933,7 +2933,7 @@ func (er *EVPNIPMSIRoute) DecodeFromBytes(data []byte) error { er.ETag = binary.BigEndian.Uint32(data[0:4]) data = data[4:] - ec, err := ParseExtended(data[0:64]) + ec, err := ParseExtended(data[0:8]) if err != nil { return NewMessageError(BGP_ERROR_UPDATE_MESSAGE_ERROR, BGP_ERROR_SUB_MALFORMED_ATTRIBUTE_LIST, nil, fmt.Sprintf("Parse extended community interface failed")) } @@ -2967,7 +2967,7 @@ func (er *EVPNIPMSIRoute) String() string { if er.EC != nil { ec = er.EC.String() } - return fmt.Sprintf("[rd:%s][etag:%d][EC]:%s]", er.RD, er.ETag, ec) + return fmt.Sprintf("[type:I-PMSI][rd:%s][etag:%d][EC:%s]", er.RD, er.ETag, ec) } func (er *EVPNIPMSIRoute) MarshalJSON() ([]byte, error) { @@ -10011,6 +10011,9 @@ func ParseExtendedCommunity(subtype ExtendedCommunityAttrSubType, com string) (E return nil, err } localAdmin, _ := strconv.ParseUint(elems[10], 10, 32) + if subtype == EC_SUBTYPE_SOURCE_AS { + localAdmin = 0 + } ip := net.ParseIP(elems[1]) isTransitive := true switch { -- cgit v1.2.3