aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_frontend.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 255aa9946fe7..23104a3f2924 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -243,7 +243,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
243 u8 tos, int oif, struct net_device *dev, 243 u8 tos, int oif, struct net_device *dev,
244 int rpf, struct in_device *idev, u32 *itag) 244 int rpf, struct in_device *idev, u32 *itag)
245{ 245{
246 int ret, no_addr, accept_local; 246 int ret, no_addr;
247 struct fib_result res; 247 struct fib_result res;
248 struct flowi4 fl4; 248 struct flowi4 fl4;
249 struct net *net; 249 struct net *net;
@@ -258,16 +258,17 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
258 258
259 no_addr = idev->ifa_list == NULL; 259 no_addr = idev->ifa_list == NULL;
260 260
261 accept_local = IN_DEV_ACCEPT_LOCAL(idev);
262 fl4.flowi4_mark = IN_DEV_SRC_VMARK(idev) ? skb->mark : 0; 261 fl4.flowi4_mark = IN_DEV_SRC_VMARK(idev) ? skb->mark : 0;
263 262
264 net = dev_net(dev); 263 net = dev_net(dev);
265 if (fib_lookup(net, &fl4, &res)) 264 if (fib_lookup(net, &fl4, &res))
266 goto last_resort; 265 goto last_resort;
267 if (res.type != RTN_UNICAST) { 266 if (res.type != RTN_UNICAST &&
268 if (res.type != RTN_LOCAL || !accept_local) 267 (res.type != RTN_LOCAL || !IN_DEV_ACCEPT_LOCAL(idev)))
269 goto e_inval; 268 goto e_inval;
270 } 269 if (!rpf && !fib_num_tclassid_users(dev_net(dev)) &&
270 (dev->ifindex != oif || !IN_DEV_TX_REDIRECTS(idev)))
271 goto last_resort;
271 fib_combine_itag(itag, &res); 272 fib_combine_itag(itag, &res);
272 dev_match = false; 273 dev_match = false;
273 274
@@ -321,6 +322,7 @@ int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
321 int r = secpath_exists(skb) ? 0 : IN_DEV_RPFILTER(idev); 322 int r = secpath_exists(skb) ? 0 : IN_DEV_RPFILTER(idev);
322 323
323 if (!r && !fib_num_tclassid_users(dev_net(dev)) && 324 if (!r && !fib_num_tclassid_users(dev_net(dev)) &&
325 IN_DEV_ACCEPT_LOCAL(idev) &&
324 (dev->ifindex != oif || !IN_DEV_TX_REDIRECTS(idev))) { 326 (dev->ifindex != oif || !IN_DEV_TX_REDIRECTS(idev))) {
325 *itag = 0; 327 *itag = 0;
326 return 0; 328 return 0;