Message ID | 20161028162149.GA23891@breakpoint.cc |
---|---|
State | RFC |
Delegated to: | Pablo Neira |
Headers | show |
On Friday, October 28, 2016 6:21:49 PM CEST Florian Westphal wrote: > Good point. In case oif is NULL we don't have to search the result > list for a match anyway, so we could do this (not even build tested): > It didn't apply cleanly, but I've integrated it with the change to initialize oif to NULL and the added #ifdef I had in my first version and got a clean build. I sent out a v2 now, but didn't try hard to understand your changes. Arnd -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/ipv4/netfilter/nft_fib_ipv4.c b/net/ipv4/netfilter/nft_fib_ipv4.c --- a/net/ipv4/netfilter/nft_fib_ipv4.c +++ b/net/ipv4/netfilter/nft_fib_ipv4.c @@ -130,6 +130,11 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs, break; } + if (!oif) { + found = FIB_RES_DEV(res); + goto ok; + } + #ifdef CONFIG_IP_ROUTE_MULTIPATH for (i = 0; i < res.fi->fib_nhs; i++) { struct fib_nh *nh = &res.fi->fib_nh[i]; @@ -139,16 +144,12 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs, goto ok; } } -#endif - if (priv->flags & NFTA_FIB_F_OIF) { - found = FIB_RES_DEV(res); - if (found == oif) - goto ok; - return; - } - - *dest = FIB_RES_DEV(res)->ifindex; return; +#else + found = FIB_RES_DEV(res); + if (found != oif) + return; +#endif ok: switch (priv->result) {