]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: when nexthop IP is available for flowspec, keep it
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 21 Jan 2020 12:15:42 +0000 (13:15 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 4 Feb 2020 16:40:06 +0000 (17:40 +0100)
keep original nexthop IP address when propagating bgp updates to other
peers.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_attr.c

index 16de59b72caca0ee2320ff71164d22ba90bb58bb..a0c34f58c3f8bccc67be1a191173eff1cae1d471 100644 (file)
@@ -2970,6 +2970,8 @@ size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, afi_t afi,
                safi == SAFI_LABELED_UNICAST ||
                safi == SAFI_MULTICAST))
                nh_afi = peer_cap_enhe(peer, afi, safi) ? AFI_IP6 : AFI_IP;
+       else if (safi == SAFI_FLOWSPEC)
+               nh_afi = afi;
        else
                nh_afi = BGP_NEXTHOP_AFI_FROM_NHLEN(attr->mp_nexthop_len);
 
@@ -2996,7 +2998,12 @@ size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, afi_t afi,
                        stream_put(s, &attr->mp_nexthop_global_in, 4);
                        break;
                case SAFI_FLOWSPEC:
-                       stream_putc(s, 0); /* no nexthop for flowspec */
+                       if (attr->mp_nexthop_len == 0)
+                               stream_putc(s, 0); /* no nexthop for flowspec */
+                       else {
+                               stream_putc(s, attr->mp_nexthop_len);
+                               stream_put_ipv4(s, attr->nexthop.s_addr);
+                       }
                default:
                        break;
                }