aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv4/fib_frontend.c6
-rw-r--r--net/ipv4/route.c1
2 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 7db2ad2e82d3..b39a791f6756 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -319,7 +319,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
319 int ret, no_addr; 319 int ret, no_addr;
320 struct fib_result res; 320 struct fib_result res;
321 struct flowi4 fl4; 321 struct flowi4 fl4;
322 struct net *net; 322 struct net *net = dev_net(dev);
323 bool dev_match; 323 bool dev_match;
324 324
325 fl4.flowi4_oif = 0; 325 fl4.flowi4_oif = 0;
@@ -332,6 +332,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
332 fl4.flowi4_scope = RT_SCOPE_UNIVERSE; 332 fl4.flowi4_scope = RT_SCOPE_UNIVERSE;
333 fl4.flowi4_tun_key.tun_id = 0; 333 fl4.flowi4_tun_key.tun_id = 0;
334 fl4.flowi4_flags = 0; 334 fl4.flowi4_flags = 0;
335 fl4.flowi4_uid = sock_net_uid(net, NULL);
335 336
336 no_addr = idev->ifa_list == NULL; 337 no_addr = idev->ifa_list == NULL;
337 338
@@ -339,13 +340,12 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
339 340
340 trace_fib_validate_source(dev, &fl4); 341 trace_fib_validate_source(dev, &fl4);
341 342
342 net = dev_net(dev);
343 if (fib_lookup(net, &fl4, &res, 0)) 343 if (fib_lookup(net, &fl4, &res, 0))
344 goto last_resort; 344 goto last_resort;
345 if (res.type != RTN_UNICAST && 345 if (res.type != RTN_UNICAST &&
346 (res.type != RTN_LOCAL || !IN_DEV_ACCEPT_LOCAL(idev))) 346 (res.type != RTN_LOCAL || !IN_DEV_ACCEPT_LOCAL(idev)))
347 goto e_inval; 347 goto e_inval;
348 if (!rpf && !fib_num_tclassid_users(dev_net(dev)) && 348 if (!rpf && !fib_num_tclassid_users(net) &&
349 (dev->ifindex != oif || !IN_DEV_TX_REDIRECTS(idev))) 349 (dev->ifindex != oif || !IN_DEV_TX_REDIRECTS(idev)))
350 goto last_resort; 350 goto last_resort;
351 fib_combine_itag(itag, &res); 351 fib_combine_itag(itag, &res);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index cb494a5050f7..584ed667bfa4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1876,6 +1876,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1876 fl4.flowi4_flags = 0; 1876 fl4.flowi4_flags = 0;
1877 fl4.daddr = daddr; 1877 fl4.daddr = daddr;
1878 fl4.saddr = saddr; 1878 fl4.saddr = saddr;
1879 fl4.flowi4_uid = sock_net_uid(net, NULL);
1879 err = fib_lookup(net, &fl4, &res, 0); 1880 err = fib_lookup(net, &fl4, &res, 0);
1880 if (err != 0) { 1881 if (err != 0) {
1881 if (!IN_DEV_FORWARD(in_dev)) 1882 if (!IN_DEV_FORWARD(in_dev))