summaryrefslogtreecommitdiffstats
path: root/src/rt.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2017-09-29 13:55:54 +0200
committerFlorian Westphal <fw@strlen.de>2017-09-29 13:55:54 +0200
commit54a0c5dc0f4db879ad2f44fc77bcd2568719be42 (patch)
tree5d5e17e0fca1c3cdd9fd582f17273705f8d6555f /src/rt.c
parent28180991740e6942adfb12650ff2472d73e89387 (diff)
parent26589362c1a3a7c3f0fdb5e70e831bcb4077b0d1 (diff)
Merge branch 'ct_rt_syntax_06'
inet family (and others, e.g. bridge) lack context to figure out the layer 3 address type. examples: ct original saddr $addr rt nexthop $addr We can't use $addr, because it might be a set reference, e.g. ct original saddr @whitelist currently implemented workaround is to use 'meta nfproto' to provide the l3 context, e.g. meta nfproto ip rt nexthop 10.2.3.4 i.e. users need to fill dependency manually. Pablo suggested to instead specify ip saddr, ip6 saddr: ct original ip saddr $address and then let nft handle the dependency injection, these changes do this. Old syntax is preserved. Signed-off-by: Florian Westphal <fw@strlen.de> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/rt.c')
-rw-r--r--src/rt.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/rt.c b/src/rt.c
index 9ad9e398..041dbc2f 100644
--- a/src/rt.c
+++ b/src/rt.c
@@ -82,7 +82,20 @@ static const struct rt_template rt_templates[] = {
static void rt_expr_print(const struct expr *expr, struct output_ctx *octx)
{
- nft_print(octx, "rt %s", rt_templates[expr->rt.key].token);
+ const char *ip = "";
+
+ switch (expr->rt.key) {
+ case NFT_RT_NEXTHOP4:
+ ip = "ip ";
+ break;
+ case NFT_RT_NEXTHOP6:
+ ip = "ip6 ";
+ break;
+ default:
+ break;
+ }
+
+ nft_print(octx, "rt %s%s", ip, rt_templates[expr->rt.key].token);
}
static bool rt_expr_cmp(const struct expr *e1, const struct expr *e2)