summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2016-12-07 15:36:15 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2016-12-07 15:54:19 +0100
commit77234bbbde6bc328871af695e4450e6773adbafa (patch)
tree0ed60508b521eba6af6c4b852df09fdf8c659154 /nest
parentb94e5e58dbd33f4d2b9d721c51a9c8c4d8f77bea (diff)
Basic flow specification support (RFC 5575)
Add flow4/flow6 network and rt-table type and operations, config grammar and static protocol support. Squashed flowspec branch from Pavel Tvrdik.
Diffstat (limited to 'nest')
-rw-r--r--nest/config.Y2
-rw-r--r--nest/rt-fib.c8
-rw-r--r--nest/rt-table.c3
3 files changed, 11 insertions, 2 deletions
diff --git a/nest/config.Y b/nest/config.Y
index 776e5d16..23d6a452 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -150,6 +150,8 @@ net_type:
| VPN6 { $$ = NET_VPN6; }
| ROA4 { $$ = NET_ROA4; }
| ROA6 { $$ = NET_ROA6; }
+ | FLOW4{ $$ = NET_FLOW4; }
+ | FLOW6{ $$ = NET_FLOW6; }
;
diff --git a/nest/rt-fib.c b/nest/rt-fib.c
index 8021ea24..11c31d0d 100644
--- a/nest/rt-fib.c
+++ b/nest/rt-fib.c
@@ -193,6 +193,8 @@ fib_hash(struct fib *f, const net_addr *a)
case NET_VPN6: return FIB_HASH(f, a, vpn6);
case NET_ROA4: return FIB_HASH(f, a, roa4);
case NET_ROA6: return FIB_HASH(f, a, roa6);
+ case NET_FLOW4: return FIB_HASH(f, a, flow4);
+ case NET_FLOW6: return FIB_HASH(f, a, flow6);
default: bug("invalid type");
}
}
@@ -227,6 +229,8 @@ fib_find(struct fib *f, const net_addr *a)
case NET_VPN6: return FIB_FIND(f, a, vpn6);
case NET_ROA4: return FIB_FIND(f, a, roa4);
case NET_ROA6: return FIB_FIND(f, a, roa6);
+ case NET_FLOW4: return FIB_FIND(f, a, flow4);
+ case NET_FLOW6: return FIB_FIND(f, a, flow6);
default: bug("invalid type");
}
}
@@ -244,6 +248,8 @@ fib_insert(struct fib *f, const net_addr *a, struct fib_node *e)
case NET_VPN6: FIB_INSERT(f, a, e, vpn6); return;
case NET_ROA4: FIB_INSERT(f, a, e, roa4); return;
case NET_ROA6: FIB_INSERT(f, a, e, roa6); return;
+ case NET_FLOW4: FIB_INSERT(f, a, e, flow4); return;
+ case NET_FLOW6: FIB_INSERT(f, a, e, flow6); return;
default: bug("invalid type");
}
}
@@ -334,11 +340,13 @@ fib_route(struct fib *f, const net_addr *n)
case NET_IP4:
case NET_VPN4:
case NET_ROA4:
+ case NET_FLOW4:
return fib_route_ip4(f, (net_addr_ip4 *) n0);
case NET_IP6:
case NET_VPN6:
case NET_ROA6:
+ case NET_FLOW6:
return fib_route_ip6(f, (net_addr_ip6 *) n0);
default:
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 6bf6c2fe..8c429874 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -2506,8 +2506,7 @@ rt_show_net(struct cli *c, net *n, struct rt_show_data *d)
int first = 1;
int pass = 0;
- bsprintf(ia, "%N", n->n.addr);
-
+ bsnprintf(ia, sizeof(ia), "%N", n->n.addr);
for (e = n->routes; e; e = e->next)
{