summaryrefslogtreecommitdiff
path: root/bgpd/bgp_open.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_open.c')
-rw-r--r--bgpd/bgp_open.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 37595817..b5b50bb5 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -93,11 +93,8 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer)
case SAFI_MULTICAST:
vty_out (vty, "SAFI Multicast");
break;
- 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 +124,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 +132,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:
@@ -392,7 +380,7 @@ bgp_capability_restart (struct peer *peer, struct capability_header *caphdr)
peer->v_gr_restart);
}
- while (stream_get_getp (s) + 4 < end)
+ while (stream_get_getp (s) + 4 <= end)
{
afi_t afi = stream_getw (s);
safi_t safi = stream_getc (s);
@@ -433,13 +421,20 @@ bgp_capability_restart (struct peer *peer, struct capability_header *caphdr)
static as_t
bgp_capability_as4 (struct peer *peer, struct capability_header *hdr)
{
+ SET_FLAG (peer->cap, PEER_CAP_AS4_RCV);
+
+ if (hdr->length != CAPABILITY_CODE_AS4_LEN)
+ {
+ zlog_err ("%s AS4 capability has incorrect data length %d",
+ peer->host, hdr->length);
+ return 0;
+ }
+
as_t as4 = stream_getl (BGP_INPUT(peer));
if (BGP_DEBUG (as4, AS4))
zlog_debug ("%s [AS4] about to set cap PEER_CAP_AS4_RCV, got as4 %u",
peer->host, as4);
- SET_FLAG (peer->cap, PEER_CAP_AS4_RCV);
-
return as4;
}
@@ -701,9 +696,6 @@ peek_for_as4_capability (struct peer *peer, u_char length)
if (hdr.code == CAPABILITY_CODE_AS4)
{
- if (hdr.length != CAPABILITY_CODE_AS4_LEN)
- goto end;
-
if (BGP_DEBUG (as4, AS4))
zlog_info ("[AS4] found AS4 capability, about to parse");
as4 = bgp_capability_as4 (peer, &hdr);
@@ -859,7 +851,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 +959,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. */