summaryrefslogtreecommitdiff
path: root/lib/table.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2018-01-10 19:13:27 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2018-03-30 14:00:47 +0200
commit9a14899b0ac8f3d9d0ce077127568f215c301f6a (patch)
tree177eadb198e40a532c4ae6d9a2f72ab2825df5cd /lib/table.c
parent46f1e1ee964e6408fbae477b824e8ed18cb357d6 (diff)
lib: prefix support for flowspec
prefix structure is used to handle flowspec prefixes. A new AFI is introduced: AF_FLOWSPEC. A sub structure named flowspec_prefix is used in prefix to host the flowspec entry. Reason to introduce that new kind is that prefixlen from prefix structure is too short to all the flowspec needs, since NLRI can go over 0xff bytes. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib/table.c')
-rw-r--r--lib/table.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/table.c b/lib/table.c
index bf63609bc3..3adb793891 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -152,10 +152,16 @@ static void route_common(const struct prefix *n, const struct prefix *p,
int i;
uint8_t diff;
uint8_t mask;
+ const uint8_t *np;
+ const uint8_t *pp;
+ uint8_t *newp;
- const uint8_t *np = (const uint8_t *)&n->u.prefix;
- const uint8_t *pp = (const uint8_t *)&p->u.prefix;
- uint8_t *newp = (uint8_t *)&new->u.prefix;
+ if (n->family == AF_FLOWSPEC)
+ return prefix_copy(new, p);
+ np = (const uint8_t *)&n->u.prefix;
+ pp = (const uint8_t *)&p->u.prefix;
+
+ newp = (uint8_t *)&new->u.prefix;
for (i = 0; i < p->prefixlen / 8; i++) {
if (np[i] == pp[i])