diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-10-16 10:05:36 +0200 | 
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2020-08-21 13:37:08 +0200 | 
| commit | f01e580fc022be15b1f70a3407c898d92b0509ee (patch) | |
| tree | 9fc603bf9fbd6beede0f3a21049b72ef29d82d18 /bgpd/bgp_flowspec_vty.c | |
| parent | 4088180002478f772332aefbac54f9148f20018f (diff) | |
bgpd: support for redirect ipv6 simpson method
this commit supports [0] where ipv6 address is encoded in nexthop
attribute of nlri, and not in bgp redirect ip extended community. the
community contains only duplicate information or not.
Adding to this, because an action or a rule needs to apply to either
ipv4 or ipv6 flow, modify some internal structures so as to be aware of
which flow needs to be filtered. This work is needed when an ipv6
flowspec rule without ip addresses is mentioned, we need to know which
afi is served. Also, this work will be useful when doing redirect VRF.
[0] draft-simpson-idr-flowspec-redirect-02.txt
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_flowspec_vty.c')
| -rw-r--r-- | bgpd/bgp_flowspec_vty.c | 26 | 
1 files changed, 22 insertions, 4 deletions
diff --git a/bgpd/bgp_flowspec_vty.c b/bgpd/bgp_flowspec_vty.c index 4b1d26b2fe..3e3366bf8b 100644 --- a/bgpd/bgp_flowspec_vty.c +++ b/bgpd/bgp_flowspec_vty.c @@ -325,10 +325,28 @@ void route_vty_out_flowspec(struct vty *vty, const struct prefix *p,  				json_object_array_add(json_paths,  						      json_ecom_path);  		} -		if (attr->nexthop.s_addr != 0 && -		    display == NLRI_STRING_FORMAT_LARGE) -			vty_out(vty, "\tNLRI NH %-16s\n", -				inet_ntoa(attr->nexthop)); +		if (display == NLRI_STRING_FORMAT_LARGE) { +			char local_buff[INET6_ADDRSTRLEN]; + +			local_buff[0] = '\0'; +			if (p->u.prefix_flowspec.family == AF_INET && +			    attr->nexthop.s_addr != 0) +				inet_ntop(AF_INET, +					  &attr->nexthop.s_addr, +					  local_buff, +					  INET6_ADDRSTRLEN); +			else if (p->u.prefix_flowspec.family == AF_INET6 && +				 attr->mp_nexthop_len != 0 && +				 attr->mp_nexthop_len != BGP_ATTR_NHLEN_IPV4 && +				 attr->mp_nexthop_len != BGP_ATTR_NHLEN_VPNV4) +				inet_ntop(AF_INET6, +					  &attr->mp_nexthop_global, +					  local_buff, +					  INET6_ADDRSTRLEN); +			if (local_buff[0] != '\0') +				vty_out(vty, "\tNLRI NH %s\n", +					local_buff); +		}  		XFREE(MTYPE_ECOMMUNITY_STR, s);  	}  	peer_uptime(path->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL);  | 
