diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-11-01 13:09:50 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-11-03 18:54:04 +0900 |
commit | 094c01506bf53eb90b413866a4ed02c231e2bb09 (patch) | |
tree | c9394d6dab50efd7ee16fd6baf0f5034fd382aaa /packet | |
parent | 917a23c094086d5ac07a0f44f9672f305ef1ee47 (diff) |
packet/bgp: Remove non route key fields from string
RFC7432 and draft-ietf-bess-evpn-prefix-advertisement says some fields
in EVPN NLRIs (e.g., MPLS Label(s)) should no be treated as the route
key, but currently, GoBGP's string representations of EVPN NLRIs include
all fields.
So the paths should be treated as the same (e.g., only different in MPLS
Label and other field is the same) can be treated as the different.
This patch removes non route key fields from NLRI string representation
and fixes this problem.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'packet')
-rw-r--r-- | packet/bgp/bgp.go | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go index babfd96f..ebab8712 100644 --- a/packet/bgp/bgp.go +++ b/packet/bgp/bgp.go @@ -2055,7 +2055,13 @@ func (er *EVPNEthernetAutoDiscoveryRoute) Serialize() ([]byte, error) { } func (er *EVPNEthernetAutoDiscoveryRoute) String() string { - return fmt.Sprintf("[type:A-D][rd:%s][esi:%s][etag:%d][label:%d]", er.RD, er.ESI.String(), er.ETag, er.Label) + // RFC7432: BGP MPLS-Based Ethernet VPN + // 7.1. Ethernet Auto-discovery Route + // For the purpose of BGP route key processing, only the Ethernet + // Segment Identifier and the Ethernet Tag ID are considered to be part + // of the prefix in the NLRI. The MPLS Label field is to be treated as + // a route attribute as opposed to being part of the route. + return fmt.Sprintf("[type:A-D][rd:%s][esi:%s][etag:%d]", er.RD, er.ESI.String(), er.ETag) } func (er *EVPNEthernetAutoDiscoveryRoute) MarshalJSON() ([]byte, error) { @@ -2165,7 +2171,15 @@ func (er *EVPNMacIPAdvertisementRoute) Serialize() ([]byte, error) { } func (er *EVPNMacIPAdvertisementRoute) String() string { - return fmt.Sprintf("[type:macadv][rd:%s][esi:%s][etag:%d][mac:%s][ip:%s][labels:%v]", er.RD, er.ESI.String(), er.ETag, er.MacAddress, er.IPAddress, er.Labels) + // RFC7432: BGP MPLS-Based Ethernet VPN + // 7.2. MAC/IP Advertisement Route + // For the purpose of BGP route key processing, only the Ethernet Tag + // ID, MAC Address Length, MAC Address, IP Address Length, and IP + // Address fields are considered to be part of the prefix in the NLRI. + // The Ethernet Segment Identifier, MPLS Label1, and MPLS Label2 fields + // are to be treated as route attributes as opposed to being part of the + // "route". + return fmt.Sprintf("[type:macadv][rd:%s][etag:%d][mac:%s][ip:%s]", er.RD, er.ETag, er.MacAddress, er.IPAddress) } func (er *EVPNMacIPAdvertisementRoute) MarshalJSON() ([]byte, error) { @@ -2241,6 +2255,12 @@ func (er *EVPNMulticastEthernetTagRoute) Serialize() ([]byte, error) { } func (er *EVPNMulticastEthernetTagRoute) String() string { + // RFC7432: BGP MPLS-Based Ethernet VPN + // 7.3. Inclusive Multicast Ethernet Tag Route + // ...(snip)... For the purpose of BGP route key + // processing, only the Ethernet Tag ID, IP Address Length, and + // Originating Router's IP Address fields are considered to be part of + // the prefix in the NLRI. return fmt.Sprintf("[type:multicast][rd:%s][etag:%d][ip:%s]", er.RD, er.ETag, er.IPAddress) } @@ -2311,6 +2331,11 @@ func (er *EVPNEthernetSegmentRoute) Serialize() ([]byte, error) { } func (er *EVPNEthernetSegmentRoute) String() string { + // RFC7432: BGP MPLS-Based Ethernet VPN + // 7.4. Ethernet Segment Route + // For the purpose of BGP route key processing, only the Ethernet + // Segment ID, IP Address Length, and Originating Router's IP Address + // fields are considered to be part of the prefix in the NLRI. return fmt.Sprintf("[type:esi][rd:%s][esi:%d][ip:%s]", er.RD, er.ESI, er.IPAddress) } @@ -2420,7 +2445,12 @@ func (er *EVPNIPPrefixRoute) Serialize() ([]byte, error) { } func (er *EVPNIPPrefixRoute) String() string { - return fmt.Sprintf("[type:Prefix][rd:%s][esi:%s][etag:%d][prefix:%s/%d][gw:%s][label:%d]", er.RD, er.ESI.String(), er.ETag, er.IPPrefix, er.IPPrefixLength, er.GWIPAddress, er.Label) + // draft-ietf-bess-evpn-prefix-advertisement: IP Prefix Advertisement in EVPN + // 3.1 IP Prefix Route Encoding + // The RD, Eth-Tag ID, IP Prefix Length and IP Prefix will be part of + // the route key used by BGP to compare routes. The rest of the fields + // will not be part of the route key. + return fmt.Sprintf("[type:Prefix][rd:%s][etag:%d][prefix:%s/%d]", er.RD, er.ETag, er.IPPrefix, er.IPPrefixLength) } func (er *EVPNIPPrefixRoute) MarshalJSON() ([]byte, error) { |