Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: rpfilter: Convert rpfilter_lookup_reverse to new dev helper

Convert rpfilter_lookup_reverse to the new device checking helper
and remove the duplicate code.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

David Ahern and committed by
David S. Miller
91a17825 78f2756c

+1 -16
+1 -16
net/ipv4/netfilter/ipt_rpfilter.c
··· 36 36 const struct net_device *dev, u8 flags) 37 37 { 38 38 struct fib_result res; 39 - bool dev_match; 40 39 int ret __maybe_unused; 41 40 42 41 if (fib_lookup(net, fl4, &res, FIB_LOOKUP_IGNORE_LINKSTATE)) ··· 45 46 if (res.type != RTN_LOCAL || !(flags & XT_RPFILTER_ACCEPT_LOCAL)) 46 47 return false; 47 48 } 48 - dev_match = false; 49 - #ifdef CONFIG_IP_ROUTE_MULTIPATH 50 - for (ret = 0; ret < res.fi->fib_nhs; ret++) { 51 - struct fib_nh *nh = &res.fi->fib_nh[ret]; 52 - 53 - if (nh->nh_dev == dev) { 54 - dev_match = true; 55 - break; 56 - } 57 - } 58 - #else 59 - if (FIB_RES_DEV(res) == dev) 60 - dev_match = true; 61 - #endif 62 - return dev_match || flags & XT_RPFILTER_LOOSE; 49 + return fib_info_nh_uses_dev(res.fi, dev) || flags & XT_RPFILTER_LOOSE; 63 50 } 64 51 65 52 static bool