diff options
author | Florian Westphal | 2019-05-31 18:27:06 +0200 |
---|---|---|
committer | David S. Miller | 2019-06-03 03:06:26 +0200 |
commit | b8d19572367bb019f77bbc921ef6bf965f1c8b22 (patch) | |
tree | d8e4e3c0cefa30ff346c6bc38a0a34d30954affa /net/ipv4 | |
parent | devinet: use in_dev_for_each_ifa_rcu in more places (diff) | |
download | kernel-qcow2-linux-b8d19572367bb019f77bbc921ef6bf965f1c8b22.tar.gz kernel-qcow2-linux-b8d19572367bb019f77bbc921ef6bf965f1c8b22.tar.xz kernel-qcow2-linux-b8d19572367bb019f77bbc921ef6bf965f1c8b22.zip |
netfilter: use in_dev_for_each_ifa_rcu
Netfilter hooks are always running under rcu read lock, use
the new iterator macro so sparse won't complain once we add
proper __rcu annotations.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/nf_tproxy_ipv4.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/ipv4/netfilter/nf_tproxy_ipv4.c b/net/ipv4/netfilter/nf_tproxy_ipv4.c index 164714104965..40c93b3bd731 100644 --- a/net/ipv4/netfilter/nf_tproxy_ipv4.c +++ b/net/ipv4/netfilter/nf_tproxy_ipv4.c @@ -53,6 +53,7 @@ EXPORT_SYMBOL_GPL(nf_tproxy_handle_time_wait4); __be32 nf_tproxy_laddr4(struct sk_buff *skb, __be32 user_laddr, __be32 daddr) { + const struct in_ifaddr *ifa; struct in_device *indev; __be32 laddr; @@ -61,10 +62,14 @@ __be32 nf_tproxy_laddr4(struct sk_buff *skb, __be32 user_laddr, __be32 daddr) laddr = 0; indev = __in_dev_get_rcu(skb->dev); - for_primary_ifa(indev) { + + in_dev_for_each_ifa_rcu(ifa, indev) { + if (ifa->ifa_flags & IFA_F_SECONDARY) + continue; + laddr = ifa->ifa_local; break; - } endfor_ifa(indev); + } return laddr ? laddr : daddr; } |