lib: add AFI_L2VPN and SAFI_EVPN

To support EVPN, a new AFI and SAFI value are defined here.
For internal processing, two other values are used. Those values will
be used to reach RIB entries by using internal afi and safi values
as indexes. This commit is using naming convention for using EVPN.
External value exchanged in BGP packets  is called of with
IANA_ presence in macro, while internal value will not have _IANA_
presence.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2016-12-05 14:11:07 +01:00
parent 781ddb4a7f
commit 924bf71cd1
2 changed files with 17 additions and 2 deletions

View File

@ -236,6 +236,8 @@ afi2str(afi_t afi)
return "IPv6";
case AFI_ETHER:
return "ethernet";
case AFI_L2VPN:
return "l2vpn";
case AFI_MAX:
return "bad-value";
default:
@ -256,6 +258,8 @@ safi2str(safi_t safi)
return "encap";
case SAFI_MPLS_VPN:
return "vpn";
case SAFI_EVPN:
return "evpn";
}
return NULL;
}

View File

@ -402,7 +402,8 @@ typedef enum {
AFI_IP = 1,
AFI_IP6 = 2,
AFI_ETHER = 3, /* RFC 1700 has "6" for 802.* */
AFI_MAX = 4
AFI_L2VPN = 4,
AFI_MAX = 5
} afi_t;
/* Subsequent Address Family Identifier. */
@ -412,7 +413,8 @@ typedef enum {
#define SAFI_RESERVED_4 4
#define SAFI_ENCAP 5
#define SAFI_RESERVED_5 5
#define SAFI_MAX 6
#define SAFI_EVPN 6
#define SAFI_MAX 7
#define IANA_SAFI_RESERVED 0
#define IANA_SAFI_UNICAST 1
@ -442,6 +444,7 @@ typedef enum {
#define IANA_SAFI_UNICAST 1
#define IANA_SAFI_MULTICAST 2
#define IANA_SAFI_ENCAP 7
#define IANA_SAFI_EVPN 70
#define IANA_SAFI_MPLS_VPN 128
/* Default Administrative Distance of each protocol. */
@ -482,6 +485,8 @@ static inline afi_t afi_iana2int (iana_afi_t afi)
return AFI_IP;
if (afi == IANA_AFI_IPV6)
return AFI_IP6;
if (afi == IANA_AFI_L2VPN)
return AFI_L2VPN;
return AFI_MAX;
}
@ -491,6 +496,8 @@ static inline iana_afi_t afi_int2iana (afi_t afi)
return IANA_AFI_IPV4;
if (afi == AFI_IP6)
return IANA_AFI_IPV6;
if (afi == AFI_L2VPN)
return IANA_AFI_L2VPN;
return IANA_AFI_RESERVED;
}
@ -504,6 +511,8 @@ static inline safi_t safi_iana2int (safi_t safi)
return SAFI_MPLS_VPN;
if (safi == IANA_SAFI_ENCAP)
return SAFI_ENCAP;
if (safi == IANA_SAFI_EVPN)
return SAFI_EVPN;
return SAFI_MAX;
}
@ -517,6 +526,8 @@ static inline safi_t safi_int2iana (safi_t safi)
return IANA_SAFI_MPLS_VPN;
if (safi == SAFI_ENCAP)
return IANA_SAFI_ENCAP;
if (safi == SAFI_EVPN)
return IANA_SAFI_EVPN;
return IANA_SAFI_RESERVED;
}