summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_updgrp_packet.c
diff options
context:
space:
mode:
authorLou Berger <lberger@labn.net>2017-01-14 14:34:22 +0100
committerLou Berger <lberger@labn.net>2017-01-17 20:59:10 +0100
commit4c6f219aa2ecc89d51f4f7f95b264b93634a68f8 (patch)
treecb5a592c2d6f88bee7e9063ebafb45f24c834e36 /bgpd/bgp_updgrp_packet.c
parentbgpd: fix RD stomping by update group code (Issue #71) (diff)
downloadfrr-4c6f219aa2ecc89d51f4f7f95b264b93634a68f8.tar.xz
frr-4c6f219aa2ecc89d51f4f7f95b264b93634a68f8.zip
bgpd: allow VPN next hop to be different AFI than NLRI next hop (Issue #71)
Signed-off-by: Lou Berger <lberger@labn.net>
Diffstat (limited to '')
-rw-r--r--bgpd/bgp_updgrp_packet.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c
index 20bf28967..ce2e0dbca 100644
--- a/bgpd/bgp_updgrp_packet.c
+++ b/bgpd/bgp_updgrp_packet.c
@@ -423,12 +423,11 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf)
nhlen = stream_getc_from (s, vec->offset);
if (paf->afi == AFI_IP || paf->afi == AFI_IP6)
{
- if (nhlen < IPV6_MAX_BYTELEN && !peer_cap_enhe(peer))
- nhafi = AFI_IP;
- else
+ nhafi = BGP_NEXTHOP_AFI_FROM_NHLEN(nhlen);
+ if (peer_cap_enhe(peer))
nhafi = AFI_IP6;
- if (paf->safi == SAFI_MPLS_VPN && /* if VPN */
- nhlen != 48) /* and ! GLOBAL_AND_LL */
+ if (paf->safi == SAFI_MPLS_VPN && /* if VPN && not global */
+ nhlen != BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL)
nhafi = AFI_MAX; /* no change allowed */
}
@@ -486,7 +485,7 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf)
if (bgp_debug_update(peer, NULL, NULL, 0))
zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ nexthop %s%s",
- PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id,
+ PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id,
peer->host, inet_ntoa (*mod_v4nh),
(nhlen == 12 ? " and RD" : ""));
}
@@ -762,7 +761,8 @@ subgroup_update_packet (struct update_subgroup *subgrp)
if (stream_empty (snlri))
mpattrlen_pos = bgp_packet_mpattr_start (snlri, afi, safi,
- (peer_cap_enhe(peer) ? AFI_IP6 : afi),
+ (peer_cap_enhe(peer) ? AFI_IP6 :
+ AFI_MAX), /* get from NH */
&vecarr, adv->baa->attr);
bgp_packet_mpattr_prefix (snlri, afi, safi, &rn->p, prd, tag,
addpath_encode, addpath_tx_id);