Skip to content

Commit 4d055a1

Browse files
committed
net: ip: make ip_route_input_rcu() return drop reasons
JIRA: https://issues.redhat.com/browse/RHEL-88891 Upstream Status: linux.git Conflicts:\ - Minor code differences as the tos to dscp conversion wasn't done in c10s yet. commit 61b95c7 Author: Menglong Dong <menglong8.dong@gmail.com> Date: Thu Nov 7 20:55:57 2024 +0800 net: ip: make ip_route_input_rcu() return drop reasons In this commit, we make ip_route_input_rcu() return drop reasons, which come from ip_route_input_mc() and ip_route_input_slow(). The only caller of ip_route_input_rcu() is ip_route_input_noref(). We adjust it by making it return -EINVAL on error and ignore the reasons that ip_route_input_rcu() returns. In the following patch, we will make ip_route_input_noref() returns the drop reasons. Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Antoine Tenart <atenart@redhat.com>
1 parent 0c592c0 commit 4d055a1

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

net/ipv4/route.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,8 +2450,10 @@ ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
24502450
}
24512451

24522452
/* called with rcu_read_lock held */
2453-
static int ip_route_input_rcu(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2454-
u8 tos, struct net_device *dev, struct fib_result *res)
2453+
static enum skb_drop_reason
2454+
ip_route_input_rcu(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2455+
u8 tos, struct net_device *dev,
2456+
struct fib_result *res)
24552457
{
24562458
/* Multicast recognition logic is moved from route cache to here.
24572459
* The problem was that too many Ethernet cards have broken/missing
@@ -2494,24 +2496,24 @@ static int ip_route_input_rcu(struct sk_buff *skb, __be32 daddr, __be32 saddr,
24942496
reason = ip_route_input_mc(skb, daddr, saddr, tos,
24952497
dev, our);
24962498
}
2497-
return reason ? -EINVAL : 0;
2499+
return reason;
24982500
}
24992501

2500-
return ip_route_input_slow(skb, daddr, saddr, tos, dev, res) ? -EINVAL : 0;
2502+
return ip_route_input_slow(skb, daddr, saddr, tos, dev, res);
25012503
}
25022504

25032505
int ip_route_input_noref(struct sk_buff *skb, __be32 daddr, __be32 saddr,
25042506
u8 tos, struct net_device *dev)
25052507
{
2508+
enum skb_drop_reason reason;
25062509
struct fib_result res;
2507-
int err;
25082510

25092511
tos &= INET_DSCP_MASK;
25102512
rcu_read_lock();
2511-
err = ip_route_input_rcu(skb, daddr, saddr, tos, dev, &res);
2513+
reason = ip_route_input_rcu(skb, daddr, saddr, tos, dev, &res);
25122514
rcu_read_unlock();
25132515

2514-
return err;
2516+
return reason ? -EINVAL : 0;
25152517
}
25162518
EXPORT_SYMBOL(ip_route_input_noref);
25172519

@@ -3322,8 +3324,8 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
33223324
skb->dev = dev;
33233325
skb->mark = mark;
33243326
err = ip_route_input_rcu(skb, dst, src,
3325-
rtm->rtm_tos & INET_DSCP_MASK, dev,
3326-
&res);
3327+
rtm->rtm_tos & INET_DSCP_MASK,
3328+
dev, &res) ? -EINVAL : 0;
33273329

33283330
rt = skb_rtable(skb);
33293331
if (err == 0 && rt->dst.error)

0 commit comments

Comments
 (0)