version 1.1.1.2, 2012/05/29 11:53:41
|
version 1.1.1.3, 2012/10/09 09:22:28
|
Line 93 bgp_capability_vty_out (struct vty *vty, struct peer *
|
Line 93 bgp_capability_vty_out (struct vty *vty, struct peer *
|
case SAFI_MULTICAST: |
case SAFI_MULTICAST: |
vty_out (vty, "SAFI Multicast"); |
vty_out (vty, "SAFI Multicast"); |
break; |
break; |
case SAFI_UNICAST_MULTICAST: | case SAFI_MPLS_LABELED_VPN: |
vty_out (vty, "SAFI Unicast Multicast"); | vty_out (vty, "SAFI MPLS-labeled VPN"); |
break; |
break; |
case BGP_SAFI_VPNV4: |
|
vty_out (vty, "SAFI MPLS-VPN"); |
|
break; |
|
default: |
default: |
vty_out (vty, "SAFI Unknown %d ", mpc.safi); |
vty_out (vty, "SAFI Unknown %d ", mpc.safi); |
break; |
break; |
Line 127 bgp_capability_mp_data (struct stream *s, struct capab
|
Line 124 bgp_capability_mp_data (struct stream *s, struct capab
|
int |
int |
bgp_afi_safi_valid_indices (afi_t afi, safi_t *safi) |
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) |
switch (afi) |
{ |
{ |
case AFI_IP: |
case AFI_IP: |
Line 143 bgp_afi_safi_valid_indices (afi_t afi, safi_t *safi)
|
Line 132 bgp_afi_safi_valid_indices (afi_t afi, safi_t *safi)
|
#endif |
#endif |
switch (*safi) |
switch (*safi) |
{ |
{ |
/* BGP VPNvX SAFI isn't contigious with others, remap */ | /* BGP MPLS-labeled VPN SAFI isn't contigious with others, remap */ |
case BGP_SAFI_VPNV4: | case SAFI_MPLS_LABELED_VPN: |
case BGP_SAFI_VPNV6: | |
*safi = SAFI_MPLS_VPN; |
*safi = SAFI_MPLS_VPN; |
case SAFI_UNICAST: |
case SAFI_UNICAST: |
case SAFI_MULTICAST: |
case SAFI_MULTICAST: |
Line 392 bgp_capability_restart (struct peer *peer, struct capa
|
Line 380 bgp_capability_restart (struct peer *peer, struct capa
|
peer->v_gr_restart); |
peer->v_gr_restart); |
} |
} |
|
|
while (stream_get_getp (s) + 4 < end) | while (stream_get_getp (s) + 4 <= end) |
{ |
{ |
afi_t afi = stream_getw (s); |
afi_t afi = stream_getw (s); |
safi_t safi = stream_getc (s); |
safi_t safi = stream_getc (s); |
Line 476 static const size_t cap_minsizes[] =
|
Line 464 static const size_t cap_minsizes[] =
|
[CAPABILITY_CODE_ORF_OLD] = sizeof (struct capability_orf_entry), |
[CAPABILITY_CODE_ORF_OLD] = sizeof (struct capability_orf_entry), |
}; |
}; |
|
|
/* Parse given capability. | /** |
| * Parse given capability. |
* XXX: This is reading into a stream, but not using stream API |
* XXX: This is reading into a stream, but not using stream API |
|
* |
|
* @param[out] mp_capability Set to 1 on return iff one or more Multiprotocol |
|
* capabilities were encountered. |
*/ |
*/ |
static int |
static int |
bgp_capability_parse (struct peer *peer, size_t length, u_char **error) | bgp_capability_parse (struct peer *peer, size_t length, int *mp_capability, |
| u_char **error) |
{ |
{ |
int ret; |
int ret; |
struct stream *s = BGP_INPUT (peer); |
struct stream *s = BGP_INPUT (peer); |
Line 552 bgp_capability_parse (struct peer *peer, size_t length
|
Line 545 bgp_capability_parse (struct peer *peer, size_t length
|
{ |
{ |
case CAPABILITY_CODE_MP: |
case CAPABILITY_CODE_MP: |
{ |
{ |
|
*mp_capability = 1; |
|
|
/* Ignore capability when override-capability is set. */ |
/* Ignore capability when override-capability is set. */ |
if (! CHECK_FLAG (peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY)) |
if (! CHECK_FLAG (peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY)) |
{ |
{ |
Line 724 end:
|
Line 719 end:
|
return as4; |
return as4; |
} |
} |
|
|
/* Parse open option */ | /** |
| * Parse open option. |
| * |
| * @param[out] mp_capability @see bgp_capability_parse() for semantics. |
| */ |
int |
int |
bgp_open_option_parse (struct peer *peer, u_char length, int *capability) | bgp_open_option_parse (struct peer *peer, u_char length, int *mp_capability) |
{ |
{ |
int ret; |
int ret; |
u_char *error; |
u_char *error; |
Line 779 bgp_open_option_parse (struct peer *peer, u_char lengt
|
Line 778 bgp_open_option_parse (struct peer *peer, u_char lengt
|
ret = bgp_auth_parse (peer, opt_length); |
ret = bgp_auth_parse (peer, opt_length); |
break; |
break; |
case BGP_OPEN_OPT_CAP: |
case BGP_OPEN_OPT_CAP: |
ret = bgp_capability_parse (peer, opt_length, &error); | ret = bgp_capability_parse (peer, opt_length, mp_capability, &error); |
*capability = 1; | |
break; |
break; |
default: |
default: |
bgp_notify_send (peer, |
bgp_notify_send (peer, |
Line 823 bgp_open_option_parse (struct peer *peer, u_char lengt
|
Line 821 bgp_open_option_parse (struct peer *peer, u_char lengt
|
} |
} |
} |
} |
|
|
/* Check there is no common capability send Unsupported Capability | /* Check there are no common AFI/SAFIs and send Unsupported Capability |
error. */ |
error. */ |
if (*capability && ! CHECK_FLAG (peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY)) | if (*mp_capability && |
| ! CHECK_FLAG (peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY)) |
{ |
{ |
if (! peer->afc_nego[AFI_IP][SAFI_UNICAST] |
if (! peer->afc_nego[AFI_IP][SAFI_UNICAST] |
&& ! peer->afc_nego[AFI_IP][SAFI_MULTICAST] |
&& ! peer->afc_nego[AFI_IP][SAFI_MULTICAST] |
Line 833 bgp_open_option_parse (struct peer *peer, u_char lengt
|
Line 832 bgp_open_option_parse (struct peer *peer, u_char lengt
|
&& ! peer->afc_nego[AFI_IP6][SAFI_UNICAST] |
&& ! peer->afc_nego[AFI_IP6][SAFI_UNICAST] |
&& ! peer->afc_nego[AFI_IP6][SAFI_MULTICAST]) |
&& ! peer->afc_nego[AFI_IP6][SAFI_MULTICAST]) |
{ |
{ |
plog_err (peer->log, "%s [Error] No common capability", peer->host); | plog_err (peer->log, "%s [Error] Configured AFI/SAFIs do not " |
| "overlap with received MP capabilities", |
| peer->host); |
|
|
if (error != error_data) |
if (error != error_data) |
|
|
Line 863 bgp_open_capability_orf (struct stream *s, struct peer
|
Line 864 bgp_open_capability_orf (struct stream *s, struct peer
|
int number_of_orfs = 0; |
int number_of_orfs = 0; |
|
|
if (safi == SAFI_MPLS_VPN) |
if (safi == SAFI_MPLS_VPN) |
safi = BGP_SAFI_VPNV4; | safi = SAFI_MPLS_LABELED_VPN; |
|
|
stream_putc (s, BGP_OPEN_OPT_CAP); |
stream_putc (s, BGP_OPEN_OPT_CAP); |
capp = stream_get_endp (s); /* Set Capability Len Pointer */ |
capp = stream_get_endp (s); /* Set Capability Len Pointer */ |
Line 971 bgp_open_capability (struct stream *s, struct peer *pe
|
Line 972 bgp_open_capability (struct stream *s, struct peer *pe
|
stream_putc (s, CAPABILITY_CODE_MP_LEN); |
stream_putc (s, CAPABILITY_CODE_MP_LEN); |
stream_putw (s, AFI_IP); |
stream_putw (s, AFI_IP); |
stream_putc (s, 0); |
stream_putc (s, 0); |
stream_putc (s, BGP_SAFI_VPNV4); | stream_putc (s, SAFI_MPLS_LABELED_VPN); |
} |
} |
#ifdef HAVE_IPV6 |
#ifdef HAVE_IPV6 |
/* IPv6 unicast. */ |
/* IPv6 unicast. */ |