summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_ecommunity.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2018-11-27 16:32:45 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2018-11-30 15:29:43 +0100
commit2551b26e1c597476b4b96a13791e0ad976406653 (patch)
tree22ef095363fd045804e3b47504e99d45d46a4ab2 /bgpd/bgp_ecommunity.c
parentzebra: handle neighbor delete from kernel for ipv4 link-local (diff)
downloadfrr-2551b26e1c597476b4b96a13791e0ad976406653.tar.xz
frr-2551b26e1c597476b4b96a13791e0ad976406653.zip
bgpd: add new draft for redirect ip for flowspec
that new option will overwrite simpson draft. There is a new ecommunity option whose type is 0x1 and subtype is 0xc. That option is defined here on iana.org/assignments/bgp-extended-communities page: - bgp-extended-communities.xhtml#trans-ipv4 It contains the IP address to redirect traffic to. The understanding of the draft is the following one: - if that community is only present, then the ip contained inside will be chosen as nexthop. - if that community is provided along with simpson extended community, then only the new redirect ip draft will be used. however, both will be displayed. - in other cases, if there is only the simpson extended community, then the nexthop IP of the NLRI will be chosen. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_ecommunity.c')
-rw-r--r--bgpd/bgp_ecommunity.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index 802916418..ed0900a72 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -688,9 +688,23 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
/* Low-order octet of type. */
sub_type = *pnt++;
if (sub_type != ECOMMUNITY_ROUTE_TARGET
- && sub_type != ECOMMUNITY_SITE_ORIGIN)
- unk_ecom = 1;
- else
+ && sub_type != ECOMMUNITY_SITE_ORIGIN) {
+ if (sub_type ==
+ ECOMMUNITY_FLOWSPEC_REDIRECT_IPV4 &&
+ type == ECOMMUNITY_ENCODE_IP) {
+ struct in_addr *ipv4 =
+ (struct in_addr *)pnt;
+ char ipv4str[INET_ADDRSTRLEN];
+
+ inet_ntop(AF_INET, ipv4,
+ ipv4str,
+ INET_ADDRSTRLEN);
+ len = sprintf(str_buf + str_pnt,
+ "NH:%s:%d",
+ ipv4str, pnt[5]);
+ } else
+ unk_ecom = 1;
+ } else
len = ecommunity_rt_soo_str(str_buf + str_pnt,
pnt, type, sub_type,
format);