summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_attr.c8
-rw-r--r--bgpd/bgp_open.c21
-rw-r--r--bgpd/bgp_packet.c14
-rw-r--r--bgpd/bgp_route.c15
-rw-r--r--bgpd/bgpd.h5
5 files changed, 22 insertions, 41 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 015ae59c..d1ba0dac 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1520,7 +1520,7 @@ bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr,
return BGP_ATTR_PARSE_ERROR;
}
- if (safi != BGP_SAFI_VPNV4)
+ if (safi != SAFI_MPLS_LABELED_VPN)
{
ret = bgp_nlri_sanity_check (peer, afi, stream_pnt (s), nlri_len);
if (ret < 0)
@@ -1564,7 +1564,7 @@ bgp_mp_unreach_parse (struct peer *peer, bgp_size_t length,
withdraw_len = length - BGP_MP_UNREACH_MIN_SIZE;
- if (safi != BGP_SAFI_VPNV4)
+ if (safi != SAFI_MPLS_LABELED_VPN)
{
ret = bgp_nlri_sanity_check (peer, afi, stream_pnt (s), withdraw_len);
if (ret < 0)
@@ -2269,7 +2269,7 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
sizep = stream_get_endp (s);
stream_putc (s, 0); /* Length of this attribute. */
stream_putw (s, AFI_IP); /* AFI */
- stream_putc (s, BGP_SAFI_VPNV4); /* SAFI */
+ stream_putc (s, SAFI_MPLS_LABELED_VPN); /* SAFI */
stream_putc (s, 12);
stream_putl (s, 0);
@@ -2432,7 +2432,7 @@ bgp_packet_withdraw (struct peer *peer, struct stream *s, struct prefix *p,
if (safi == SAFI_MPLS_VPN)
{
/* SAFI */
- stream_putc (s, BGP_SAFI_VPNV4);
+ stream_putc (s, SAFI_MPLS_LABELED_VPN);
/* prefix. */
stream_putc (s, p->prefixlen + 88);
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 37595817..21c7e367 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -96,8 +96,8 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer)
case SAFI_UNICAST_MULTICAST:
vty_out (vty, "SAFI Unicast Multicast");
break;
- case BGP_SAFI_VPNV4:
- vty_out (vty, "SAFI MPLS-VPN");
+ case SAFI_MPLS_LABELED_VPN:
+ vty_out (vty, "SAFI MPLS-labeled VPN");
break;
default:
vty_out (vty, "SAFI Unknown %d ", mpc.safi);
@@ -127,14 +127,6 @@ bgp_capability_mp_data (struct stream *s, struct capability_mp_data *mpc)
int
bgp_afi_safi_valid_indices (afi_t afi, safi_t *safi)
{
- /* VPNvX are AFI specific */
- if ((afi == AFI_IP6 && *safi == BGP_SAFI_VPNV4)
- || (afi == AFI_IP && *safi == BGP_SAFI_VPNV6))
- {
- zlog_warn ("Invalid afi/safi combination (%u/%u)", afi, *safi);
- return 0;
- }
-
switch (afi)
{
case AFI_IP:
@@ -143,9 +135,8 @@ bgp_afi_safi_valid_indices (afi_t afi, safi_t *safi)
#endif
switch (*safi)
{
- /* BGP VPNvX SAFI isn't contigious with others, remap */
- case BGP_SAFI_VPNV4:
- case BGP_SAFI_VPNV6:
+ /* BGP MPLS-labeled VPN SAFI isn't contigious with others, remap */
+ case SAFI_MPLS_LABELED_VPN:
*safi = SAFI_MPLS_VPN;
case SAFI_UNICAST:
case SAFI_MULTICAST:
@@ -859,7 +850,7 @@ bgp_open_capability_orf (struct stream *s, struct peer *peer,
int number_of_orfs = 0;
if (safi == SAFI_MPLS_VPN)
- safi = BGP_SAFI_VPNV4;
+ safi = SAFI_MPLS_LABELED_VPN;
stream_putc (s, BGP_OPEN_OPT_CAP);
capp = stream_get_endp (s); /* Set Capability Len Pointer */
@@ -967,7 +958,7 @@ bgp_open_capability (struct stream *s, struct peer *peer)
stream_putc (s, CAPABILITY_CODE_MP_LEN);
stream_putw (s, AFI_IP);
stream_putc (s, 0);
- stream_putc (s, BGP_SAFI_VPNV4);
+ stream_putc (s, SAFI_MPLS_LABELED_VPN);
}
#ifdef HAVE_IPV6
/* IPv6 unicast. */
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index ab0fa8f5..4854f1dd 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -946,7 +946,7 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi,
/* Adjust safi code. */
if (safi == SAFI_MPLS_VPN)
- safi = BGP_SAFI_VPNV4;
+ safi = SAFI_MPLS_LABELED_VPN;
s = stream_new (BGP_MAX_PACKET_SIZE);
@@ -1036,7 +1036,7 @@ bgp_capability_send (struct peer *peer, afi_t afi, safi_t safi,
/* Adjust safi code. */
if (safi == SAFI_MPLS_VPN)
- safi = BGP_SAFI_VPNV4;
+ safi = SAFI_MPLS_LABELED_VPN;
s = stream_new (BGP_MAX_PACKET_SIZE);
@@ -1799,17 +1799,17 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
{
if (mp_update.length
&& mp_update.afi == AFI_IP
- && mp_update.safi == BGP_SAFI_VPNV4)
+ && mp_update.safi == SAFI_MPLS_LABELED_VPN)
bgp_nlri_parse_vpnv4 (peer, NLRI_ATTR_ARG, &mp_update);
if (mp_withdraw.length
&& mp_withdraw.afi == AFI_IP
- && mp_withdraw.safi == BGP_SAFI_VPNV4)
+ && mp_withdraw.safi == SAFI_MPLS_LABELED_VPN)
bgp_nlri_parse_vpnv4 (peer, NULL, &mp_withdraw);
if (! withdraw_len
&& mp_withdraw.afi == AFI_IP
- && mp_withdraw.safi == BGP_SAFI_VPNV4
+ && mp_withdraw.safi == SAFI_MPLS_LABELED_VPN
&& mp_withdraw.length == 0)
{
/* End-of-RIB received */
@@ -1969,7 +1969,7 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
/* Check AFI and SAFI. */
if ((afi != AFI_IP && afi != AFI_IP6)
|| (safi != SAFI_UNICAST && safi != SAFI_MULTICAST
- && safi != BGP_SAFI_VPNV4))
+ && safi != SAFI_MPLS_LABELED_VPN))
{
if (BGP_DEBUG (normal, NORMAL))
{
@@ -1980,7 +1980,7 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size)
}
/* Adjust safi code. */
- if (safi == BGP_SAFI_VPNV4)
+ if (safi == SAFI_MPLS_LABELED_VPN)
safi = SAFI_MPLS_VPN;
if (size != BGP_MSG_ROUTE_REFRESH_MIN_SIZE - BGP_HEADER_SIZE)
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index eaedbc4c..d2aedb61 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1659,7 +1659,7 @@ bgp_maximum_prefix_overflow (struct peer *peer, afi_t afi,
u_int8_t ndata[7];
if (safi == SAFI_MPLS_VPN)
- safi = BGP_SAFI_VPNV4;
+ safi = SAFI_MPLS_LABELED_VPN;
ndata[0] = (afi >> 8);
ndata[1] = afi;
@@ -9379,10 +9379,8 @@ bgp_table_stats_vty (struct vty *vty, const char *name,
safi = SAFI_MULTICAST;
else if (strncmp (safi_str, "u", 1) == 0)
safi = SAFI_UNICAST;
- else if (strncmp (safi_str, "vpnv4", 5) == 0)
- safi = BGP_SAFI_VPNV4;
- else if (strncmp (safi_str, "vpnv6", 5) == 0)
- safi = BGP_SAFI_VPNV6;
+ else if (strncmp (safi_str, "vpnv4", 5) == 0 || strncmp (safi_str, "vpnv6", 5) == 0)
+ safi = SAFI_MPLS_LABELED_VPN;
else
{
vty_out (vty, "%% Invalid subsequent address family %s%s",
@@ -9397,13 +9395,6 @@ bgp_table_stats_vty (struct vty *vty, const char *name,
return CMD_WARNING;
}
- if ((afi == AFI_IP && safi == BGP_SAFI_VPNV6)
- || (afi == AFI_IP6 && safi == BGP_SAFI_VPNV4))
- {
- vty_out (vty, "%% Invalid subsequent address family %s for %s%s",
- afi_str, safi_str, VTY_NEWLINE);
- return CMD_WARNING;
- }
return bgp_table_stats (vty, bgp, afi, safi);
}
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index f396f726..892e7dec 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -727,9 +727,8 @@ struct bgp_nlri
#define BGP_DEFAULT_RESTART_TIME 120
#define BGP_DEFAULT_STALEPATH_TIME 360
-/* SAFI which used in open capability negotiation. */
-#define BGP_SAFI_VPNV4 128
-#define BGP_SAFI_VPNV6 128
+/* RFC4364 */
+#define SAFI_MPLS_LABELED_VPN 128
/* Max TTL value. */
#define TTL_MAX 255