aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2019-05-15 14:15:32 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2019-05-21 10:10:38 -0400
commite633508a95289489d28faacb68b32c3e7e68ef6f (patch)
tree20b9a690f78aad5c43b12e7569cf3e0e26a44169 /net/ipv6
parent946c0d8e6ed43dae6527e878d0077c1e11015db0 (diff)
netfilter: nft_fib: Fix existence check support
NFTA_FIB_F_PRESENT flag was not always honored since eval functions did not call nft_fib_store_result in all cases. Given that in all callsites there is a struct net_device pointer available which holds the interface data to be stored in destination register, simplify nft_fib_store_result() to just accept that pointer instead of the nft_pktinfo pointer and interface index. This also allows to drop the index to interface lookup previously needed to get the name associated with given index. Fixes: 055c4b34b94f6 ("netfilter: nft_fib: Support existence check") Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/netfilter/nft_fib_ipv6.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/net/ipv6/netfilter/nft_fib_ipv6.c b/net/ipv6/netfilter/nft_fib_ipv6.c
index 73cdc0bc63f7..ec068b0cffca 100644
--- a/net/ipv6/netfilter/nft_fib_ipv6.c
+++ b/net/ipv6/netfilter/nft_fib_ipv6.c
@@ -169,8 +169,7 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,
169 169
170 if (nft_hook(pkt) == NF_INET_PRE_ROUTING && 170 if (nft_hook(pkt) == NF_INET_PRE_ROUTING &&
171 nft_fib_is_loopback(pkt->skb, nft_in(pkt))) { 171 nft_fib_is_loopback(pkt->skb, nft_in(pkt))) {
172 nft_fib_store_result(dest, priv, pkt, 172 nft_fib_store_result(dest, priv, nft_in(pkt));
173 nft_in(pkt)->ifindex);
174 return; 173 return;
175 } 174 }
176 175
@@ -187,18 +186,7 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,
187 if (oif && oif != rt->rt6i_idev->dev) 186 if (oif && oif != rt->rt6i_idev->dev)
188 goto put_rt_err; 187 goto put_rt_err;
189 188
190 switch (priv->result) { 189 nft_fib_store_result(dest, priv, rt->rt6i_idev->dev);
191 case NFT_FIB_RESULT_OIF:
192 *dest = rt->rt6i_idev->dev->ifindex;
193 break;
194 case NFT_FIB_RESULT_OIFNAME:
195 strncpy((char *)dest, rt->rt6i_idev->dev->name, IFNAMSIZ);
196 break;
197 default:
198 WARN_ON_ONCE(1);
199 break;
200 }
201
202 put_rt_err: 190 put_rt_err:
203 ip6_rt_put(rt); 191 ip6_rt_put(rt);
204} 192}