From: Philippe Guibert Date: Tue, 21 Jan 2020 12:15:42 +0000 (+0100) Subject: bgpd: when nexthop IP is available for flowspec, keep it X-Git-Tag: base_7.4~377^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=211ee7aa6301402bdca47a649bc49620aef96ff2;p=matthieu%2Ffrr.git bgpd: when nexthop IP is available for flowspec, keep it keep original nexthop IP address when propagating bgp updates to other peers. Signed-off-by: Philippe Guibert --- diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 16de59b72c..a0c34f58c3 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -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; }