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

netfilter: nft_fib: Convert nft_fib4_eval to new dev helper

Convert nft_fib4_eval 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
9f18b6b6 91a17825

+6 -21
+6 -21
net/ipv4/netfilter/nft_fib_ipv4.c
··· 76 76 .flowi4_iif = LOOPBACK_IFINDEX, 77 77 }; 78 78 const struct net_device *oif; 79 - struct net_device *found; 80 - #ifdef CONFIG_IP_ROUTE_MULTIPATH 81 - int i; 82 - #endif 79 + const struct net_device *found; 83 80 84 81 /* 85 82 * Do not set flowi4_oif, it restricts results (for example, asking ··· 143 146 144 147 if (!oif) { 145 148 found = FIB_RES_DEV(res); 146 - goto ok; 147 - } 149 + } else { 150 + if (!fib_info_nh_uses_dev(res.fi, oif)) 151 + return; 148 152 149 - #ifdef CONFIG_IP_ROUTE_MULTIPATH 150 - for (i = 0; i < res.fi->fib_nhs; i++) { 151 - struct fib_nh *nh = &res.fi->fib_nh[i]; 152 - 153 - if (nh->nh_dev == oif) { 154 - found = nh->nh_dev; 155 - goto ok; 156 - } 153 + found = oif; 157 154 } 158 - return; 159 - #else 160 - found = FIB_RES_DEV(res); 161 - if (found != oif) 162 - return; 163 - #endif 164 - ok: 155 + 165 156 switch (priv->result) { 166 157 case NFT_FIB_RESULT_OIF: 167 158 *dest = found->ifindex;