diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2018-12-04 09:33:21 +0100 |
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2018-12-28 18:10:26 +0100 |
| commit | 0378bcaad6736940867fc0a0b46e196f3e95d7ce (patch) | |
| tree | 714685a9f194caac1ee5db5bbe6859beaf26b306 /bgpd/bgp_flowspec_util.c | |
| parent | ca6541963cd00cc24d53debee2c570810c609aec (diff) | |
bgpd: flowspec redirect IP info is retrieved into nh tracking
redirect IP nh of flowspec entry is retrieved so that the nexthop
IP information is injected into the nexthop tracking, and is associated
to the bgp_path structure. This permits validating or unvalidating the
bgp_path for injection in zebra or not.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_flowspec_util.c')
| -rw-r--r-- | bgpd/bgp_flowspec_util.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/bgpd/bgp_flowspec_util.c b/bgpd/bgp_flowspec_util.c index c6386dcdb5..cd5bec6267 100644 --- a/bgpd/bgp_flowspec_util.c +++ b/bgpd/bgp_flowspec_util.c @@ -23,6 +23,7 @@ #include "prefix.h" #include "lib_errors.h" +#include "bgp_route.h" #include "bgp_table.h" #include "bgp_flowspec_util.h" #include "bgp_flowspec_private.h" @@ -581,3 +582,27 @@ int bgp_flowspec_match_rules_fill(uint8_t *nlri_content, int len, } return error; } + +/* return 1 if FS entry invalid or no NH IP */ +int bgp_flowspec_get_first_nh(struct bgp *bgp, struct bgp_path_info *pi, + struct prefix *p) +{ + struct bgp_pbr_entry_main api; + int i; + struct bgp_node *rn = pi->net; + struct bgp_pbr_entry_action *api_action; + + memset(&api, 0, sizeof(struct bgp_pbr_entry_main)); + if (bgp_pbr_build_and_validate_entry(&rn->p, pi, &api) < 0) + return 1; + for (i = 0; i < api.action_num; i++) { + api_action = &api.actions[i]; + if (api_action->action != ACTION_REDIRECT_IP) + continue; + p->family = AF_INET; + p->prefixlen = IPV4_MAX_BITLEN; + p->u.prefix4 = api_action->u.zr.redirect_ip_v4; + return 0; + } + return 1; +} |
