summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_attr.c
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2017-05-16 20:05:45 +0200
committerDaniel Walton <dwalton@cumulusnetworks.com>2017-05-16 20:05:45 +0200
commita080e8fbcbbfe05287ad4f7935c81a3816965e00 (patch)
tree69b509a48ea051a76b8a133c019d3c358b9edd05 /bgpd/bgp_attr.c
parentbgpd: fix nh_afi in bgp_packet_mpattr_start() (diff)
downloadfrr-a080e8fbcbbfe05287ad4f7935c81a3816965e00.tar.xz
frr-a080e8fbcbbfe05287ad4f7935c81a3816965e00.zip
bgpd: fix nh_afi in bgp_packet_mpattr_start()
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_attr.c')
-rw-r--r--bgpd/bgp_attr.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 0eb84bda0..f21194149 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -2817,17 +2817,6 @@ bgp_packet_mpattr_start (struct stream *s, struct peer *peer,
safi_t pkt_safi;
afi_t nh_afi;
- if (peer_cap_enhe(peer, afi, safi)) {
- nh_afi = AFI_IP6;
- } else {
- if (afi == AFI_L2VPN)
- nh_afi = AFI_L2VPN;
- else if (safi == SAFI_LABELED_UNICAST)
- nh_afi = afi;
- else
- nh_afi = BGP_NEXTHOP_AFI_FROM_NHLEN(attr->extra->mp_nexthop_len);
- }
-
/* Set extended bit always to encode the attribute length as 2 bytes */
stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_EXTLEN);
stream_putc (s, BGP_ATTR_MP_REACH_NLRI);
@@ -2841,6 +2830,18 @@ bgp_packet_mpattr_start (struct stream *s, struct peer *peer,
stream_putw (s, pkt_afi); /* AFI */
stream_putc (s, pkt_safi); /* SAFI */
+ /* Nexthop AFI */
+ if (peer_cap_enhe(peer, afi, safi)) {
+ nh_afi = AFI_IP6;
+ } else {
+ if (afi == AFI_L2VPN)
+ nh_afi = AFI_L2VPN;
+ else if (safi == SAFI_LABELED_UNICAST)
+ nh_afi = afi;
+ else
+ nh_afi = BGP_NEXTHOP_AFI_FROM_NHLEN(attr->extra->mp_nexthop_len);
+ }
+
/* Nexthop */
switch (nh_afi)
{
@@ -3108,7 +3109,6 @@ bgp_packet_mpattr_end (struct stream *s, size_t sizep)
stream_putw_at (s, sizep, (stream_get_endp (s) - sizep) - 2);
}
-
/* Make attribute packet. */
bgp_size_t
bgp_packet_attribute (struct bgp *bgp, struct peer *peer,