diff options
author | JieJhih Jhang <aawer12345tw@yahoo.com.tw> | 2019-03-29 17:12:10 +0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-04-11 07:30:35 +0900 |
commit | 42feaea2a0bfc3deb1becdc8c06e4bad44a4b52c (patch) | |
tree | 963e4c813a0686ef44acf2a593ea6b33cf1be355 /pkg | |
parent | fa5878f6f306e1f8abfc58c4e421a55ead51854d (diff) |
cmd/gobgp: Parse evpn IPMSI parameter
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/packet/bgp/bgp.go | 7 |
1 files changed, 5 insertions, 2 deletions
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 { |