diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-28 21:54:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-28 21:54:02 -0400 |
commit | 9e56e3800ea42e78b7c816bdd2d87d047be80541 (patch) | |
tree | 0bc002700fc4069667ca0ef9251dd496718ad813 /net/ipv4/fib_frontend.c | |
parent | a207a4b2e8067cbc7f33924e7f2c0fa4ef43b459 (diff) |
ipv4: Adjust in_dev handling in fib_validate_source()
Checking for in_dev being NULL is pointless.
In fact, all of our callers have in_dev precomputed already,
so just pass it in and remove the NULL checking.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r-- | net/ipv4/fib_frontend.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 1d13217e01ff..c84cff52021e 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -226,15 +226,14 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb) | |||
226 | * called with rcu_read_lock() | 226 | * called with rcu_read_lock() |
227 | */ | 227 | */ |
228 | int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, u8 tos, | 228 | int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, u8 tos, |
229 | int oif, struct net_device *dev, u32 *itag) | 229 | int oif, struct net_device *dev, struct in_device *idev, |
230 | u32 *itag) | ||
230 | { | 231 | { |
231 | struct in_device *in_dev; | 232 | int ret, no_addr, rpf, accept_local; |
232 | struct flowi4 fl4; | ||
233 | struct fib_result res; | 233 | struct fib_result res; |
234 | int no_addr, rpf, accept_local; | 234 | struct flowi4 fl4; |
235 | bool dev_match; | ||
236 | int ret; | ||
237 | struct net *net; | 235 | struct net *net; |
236 | bool dev_match; | ||
238 | 237 | ||
239 | fl4.flowi4_oif = 0; | 238 | fl4.flowi4_oif = 0; |
240 | fl4.flowi4_iif = oif; | 239 | fl4.flowi4_iif = oif; |
@@ -244,19 +243,13 @@ int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, u8 tos, | |||
244 | fl4.flowi4_scope = RT_SCOPE_UNIVERSE; | 243 | fl4.flowi4_scope = RT_SCOPE_UNIVERSE; |
245 | 244 | ||
246 | no_addr = rpf = accept_local = 0; | 245 | no_addr = rpf = accept_local = 0; |
247 | in_dev = __in_dev_get_rcu(dev); | 246 | no_addr = idev->ifa_list == NULL; |
248 | if (in_dev) { | ||
249 | no_addr = in_dev->ifa_list == NULL; | ||
250 | |||
251 | /* Ignore rp_filter for packets protected by IPsec. */ | ||
252 | rpf = secpath_exists(skb) ? 0 : IN_DEV_RPFILTER(in_dev); | ||
253 | 247 | ||
254 | accept_local = IN_DEV_ACCEPT_LOCAL(in_dev); | 248 | /* Ignore rp_filter for packets protected by IPsec. */ |
255 | fl4.flowi4_mark = IN_DEV_SRC_VMARK(in_dev) ? skb->mark : 0; | 249 | rpf = secpath_exists(skb) ? 0 : IN_DEV_RPFILTER(idev); |
256 | } | ||
257 | 250 | ||
258 | if (in_dev == NULL) | 251 | accept_local = IN_DEV_ACCEPT_LOCAL(idev); |
259 | goto e_inval; | 252 | fl4.flowi4_mark = IN_DEV_SRC_VMARK(idev) ? skb->mark : 0; |
260 | 253 | ||
261 | net = dev_net(dev); | 254 | net = dev_net(dev); |
262 | if (fib_lookup(net, &fl4, &res)) | 255 | if (fib_lookup(net, &fl4, &res)) |