Fix the AFI for IPv6.
The Address Family Identifier was not the one I thought it was. Define it and fix its use for IPv6. Signed-off-by: Benjamin Cama <benoar@dolka.fr>
This commit is contained in:
parent
e86393ea90
commit
3ea85f7c57
2 changed files with 8 additions and 4 deletions
8
bgp.c
8
bgp.c
|
|
@ -260,7 +260,7 @@ int bgp_start(struct bgp_peer *peer, char *name, int as, int keepalive,
|
|||
a.code = BGP_PATH_ATTR_CODE_MP_REACH_NLRI;
|
||||
a.data.s.len = 0; /* will be set on UPDATE */
|
||||
|
||||
mp_reach_nlri_partial.afi = htons(AF_INET6);
|
||||
mp_reach_nlri_partial.afi = htons(BGP_MP_AFI_IPv6);
|
||||
mp_reach_nlri_partial.safi = BGP_MP_SAFI_UNICAST;
|
||||
mp_reach_nlri_partial.reserved = 0;
|
||||
mp_reach_nlri_partial.next_hop_len = 16;
|
||||
|
|
@ -286,7 +286,7 @@ int bgp_start(struct bgp_peer *peer, char *name, int as, int keepalive,
|
|||
a.code = BGP_PATH_ATTR_CODE_MP_UNREACH_NLRI;
|
||||
a.data.e.len = 0; /* will be set on UPDATE */
|
||||
|
||||
mp_unreach_nlri_partial.afi = htons(AF_INET6);
|
||||
mp_unreach_nlri_partial.afi = htons(BGP_MP_AFI_IPv6);
|
||||
mp_unreach_nlri_partial.safi = BGP_MP_SAFI_UNICAST;
|
||||
|
||||
memcpy(&a.data.e.value, &mp_unreach_nlri_partial,
|
||||
|
|
@ -1247,7 +1247,7 @@ static int bgp_handle_input(struct bgp_peer *peer)
|
|||
|
||||
mp_cap = (struct bgp_mp_cap_param *)&capability->value;
|
||||
/* the only <AFI, SAFI> tuple we support */
|
||||
if (ntohs(mp_cap->afi) != AF_INET6 && mp_cap->safi != BGP_MP_SAFI_UNICAST)
|
||||
if (ntohs(mp_cap->afi) != BGP_MP_AFI_IPv6 && mp_cap->safi != BGP_MP_SAFI_UNICAST)
|
||||
{
|
||||
LOG(4, 0, 0, "Unsupported multiprotocol AFI %d and SAFI %d from BGP peer %s\n",
|
||||
mp_cap->afi, mp_cap->safi, peer->name);
|
||||
|
|
@ -1346,7 +1346,7 @@ static int bgp_handle_input(struct bgp_peer *peer)
|
|||
static int bgp_send_open(struct bgp_peer *peer)
|
||||
{
|
||||
struct bgp_data_open data;
|
||||
struct bgp_mp_cap_param mp_ipv6 = { htons(AF_INET6), 0, BGP_MP_SAFI_UNICAST };
|
||||
struct bgp_mp_cap_param mp_ipv6 = { htons(BGP_MP_AFI_IPv6), 0, BGP_MP_SAFI_UNICAST };
|
||||
struct bgp_capability cap_mp_ipv6;
|
||||
struct bgp_opt_param param_cap_mp_ipv6;
|
||||
uint16_t len = sizeof(peer->outbuf->packet.header);
|
||||
|
|
|
|||
4
bgp.h
4
bgp.h
|
|
@ -67,6 +67,10 @@ struct bgp_mp_cap_param {
|
|||
uint8_t safi;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* bgp_mp_cap_param.afi */
|
||||
#define BGP_MP_AFI_RESERVED 0
|
||||
#define BGP_MP_AFI_IPv4 1
|
||||
#define BGP_MP_AFI_IPv6 2
|
||||
/* bgp_mp_cap_param.safi */
|
||||
#define BGP_MP_SAFI_UNICAST 1
|
||||
#define BGP_MP_SAFI_MULTICAST 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue