summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-05-06 15:48:35 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2016-12-22 13:01:06 +0100
commit4e276a8920ed0496836f002f144943ab42f120f6 (patch)
treeb2d24394f036cbd825330e0087a7f9f4ca167174 /filter
parentb7605d5c953902b461e5c9e87aa3dfa60ddce5bc (diff)
Merged multipath and single-path data structures.
Dropped struct mpnh and mpnh_*() Now struct nexthop exists, nexthop_*(), and also included struct nexthop into struct rta. Also converted RTD_DEVICE and RTD_ROUTER to RTD_UNICAST. If it is needed to distinguish between these two cases, RTD_DEVICE is equivalent to IPA_ZERO(a->nh.gw), RTD_ROUTER is then IPA_NONZERO(a->nh.gw). From now on, we also explicitely want C99 compatible compiler. We assume that this 20-year norm should be known almost everywhere.
Diffstat (limited to 'filter')
-rw-r--r--filter/filter.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/filter/filter.c b/filter/filter.c
index 4ec04554..926316ac 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -900,15 +900,15 @@ interpret(struct f_inst *what)
switch (what->a2.i)
{
case SA_FROM: res.val.ip = rta->from; break;
- case SA_GW: res.val.ip = rta->gw; break;
+ case SA_GW: res.val.ip = rta->nh.gw; break;
case SA_NET: res.val.net = (*f_rte)->net->n.addr; break;
case SA_PROTO: res.val.s = rta->src->proto->name; break;
case SA_SOURCE: res.val.i = rta->source; break;
case SA_SCOPE: res.val.i = rta->scope; break;
case SA_CAST: res.val.i = rta->cast; break;
case SA_DEST: res.val.i = rta->dest; break;
- case SA_IFNAME: res.val.s = rta->iface ? rta->iface->name : ""; break;
- case SA_IFINDEX: res.val.i = rta->iface ? rta->iface->index : 0; break;
+ case SA_IFNAME: res.val.s = rta->nh.iface ? rta->nh.iface->name : ""; break;
+ case SA_IFINDEX: res.val.i = rta->nh.iface ? rta->nh.iface->index : 0; break;
default:
bug("Invalid static attribute access (%x)", res.type);
@@ -938,10 +938,10 @@ interpret(struct f_inst *what)
if (!n || (n->scope == SCOPE_HOST))
runtime( "Invalid gw address" );
- rta->dest = RTD_ROUTER;
- rta->gw = ip;
- rta->iface = n->iface;
- rta->nexthops = NULL;
+ rta->dest = RTD_UNICAST;
+ rta->nh.gw = ip;
+ rta->nh.iface = n->iface;
+ rta->nh.next = NULL;
rta->hostentry = NULL;
}
break;
@@ -956,9 +956,9 @@ interpret(struct f_inst *what)
runtime( "Destination can be changed only to blackhole, unreachable or prohibit" );
rta->dest = i;
- rta->gw = IPA_NONE;
- rta->iface = NULL;
- rta->nexthops = NULL;
+ rta->nh.gw = IPA_NONE;
+ rta->nh.iface = NULL;
+ rta->nh.next = NULL;
rta->hostentry = NULL;
break;