]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Fix labeled-unicast generation and parsing issues
authorDon Slice <dslice@cumulusnetworks.com>
Wed, 15 Mar 2017 12:43:01 +0000 (08:43 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 6 Apr 2017 14:32:08 +0000 (10:32 -0400)
Labeled-unicast updates were being sent with an ipv6 nexthop due to
not setting the mp_nexthop_len or nh_afi.  On the receive side, the
prefix length was being incorrectly determined and has been fixed.
Also the stream for bgp_label_buf was not created.  All resolved.

Ticket: CM-15260
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by:

bgpd/bgp_attr.c
bgpd/bgp_label.c
bgpd/bgp_zebra.c

index acc08184b9541982ce4d0c2d9afa917b55803616..7a28da5780a553339e0edb65c711e5d7dc8b3218 100644 (file)
@@ -2792,6 +2792,10 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi,
 
   if (nh_afi == AFI_MAX)
     nh_afi = BGP_NEXTHOP_AFI_FROM_NHLEN(attr->extra->mp_nexthop_len);
+
+  if (safi == SAFI_LABELED_UNICAST)
+    nh_afi = AFI_IP;
+
   /* Nexthop */
   switch (nh_afi)
     {
index 0c331c5d5916ce9f40a761220a1badfc97d99ddb..615eca58849b3dcae95d5b2bc198cb569eacc835 100644 (file)
@@ -253,7 +253,7 @@ bgp_nlri_parse_label (struct peer *peer, struct attr *attr,
       /* Fill in the labels */
       llen = bgp_nlri_get_labels(peer, pnt, psize, label);
       // zlog_debug("rcvd label [%x/%x/%x], llen=%d\n", label[0], label[1], label[2], llen);
-      p.prefixlen -= BSIZE(llen);
+      p.prefixlen = prefixlen - BSIZE(llen);
 
       /* There needs to be at least one label */
       if (prefixlen < 24)
index 1ded613f65d296b7da05191e86d3242931e201a8..d76eb951db3ff40b2f0989d3415460938547384d 100644 (file)
@@ -2272,6 +2272,7 @@ bgp_zebra_init (struct thread_master *master)
 
   bgp_nexthop_buf = stream_new(BGP_NEXTHOP_BUF_SIZE);
   bgp_ifindices_buf = stream_new(BGP_IFINDICES_BUF_SIZE);
+  bgp_label_buf = stream_new(BGP_LABEL_BUF_SIZE);
 }
 
 void