Skip to content

Commit e2f4ccb

Browse files
committed
net: ip: make ip_route_input_mc() return drop reason
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 c6c6707 Author: Menglong Dong <menglong8.dong@gmail.com> Date: Thu Nov 7 20:55:54 2024 +0800 net: ip: make ip_route_input_mc() return drop reason Make ip_route_input_mc() return drop reason, and adjust the call of it in ip_route_input_rcu(). 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 8b34060 commit e2f4ccb

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

net/ipv4/route.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,8 +1707,9 @@ int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr,
17071707
}
17081708

17091709
/* called in rcu_read_lock() section */
1710-
static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1711-
u8 tos, struct net_device *dev, int our)
1710+
static enum skb_drop_reason
1711+
ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1712+
u8 tos, struct net_device *dev, int our)
17121713
{
17131714
struct in_device *in_dev = __in_dev_get_rcu(dev);
17141715
unsigned int flags = RTCF_MULTICAST;
@@ -1718,7 +1719,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
17181719

17191720
err = ip_mc_validate_source(skb, daddr, saddr, tos, dev, in_dev, &itag);
17201721
if (err)
1721-
return err;
1722+
return SKB_DROP_REASON_NOT_SPECIFIED;
17221723

17231724
if (our)
17241725
flags |= RTCF_LOCAL;
@@ -1729,7 +1730,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
17291730
rth = rt_dst_alloc(dev_net(dev)->loopback_dev, flags, RTN_MULTICAST,
17301731
false);
17311732
if (!rth)
1732-
return -ENOBUFS;
1733+
return SKB_DROP_REASON_NOMEM;
17331734

17341735
#ifdef CONFIG_IP_ROUTE_CLASSID
17351736
rth->dst.tclassid = itag;
@@ -1745,7 +1746,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
17451746

17461747
skb_dst_drop(skb);
17471748
skb_dst_set(skb, &rth->dst);
1748-
return 0;
1749+
return SKB_NOT_DROPPED_YET;
17491750
}
17501751

17511752

@@ -2446,12 +2447,12 @@ static int ip_route_input_rcu(struct sk_buff *skb, __be32 daddr, __be32 saddr,
24462447
* route cache entry is created eventually.
24472448
*/
24482449
if (ipv4_is_multicast(daddr)) {
2450+
enum skb_drop_reason reason = SKB_DROP_REASON_NOT_SPECIFIED;
24492451
struct in_device *in_dev = __in_dev_get_rcu(dev);
24502452
int our = 0;
2451-
int err = -EINVAL;
24522453

24532454
if (!in_dev)
2454-
return err;
2455+
return -EINVAL;
24552456
our = ip_check_mc_rcu(in_dev, daddr, saddr,
24562457
ip_hdr(skb)->protocol);
24572458

@@ -2472,10 +2473,10 @@ static int ip_route_input_rcu(struct sk_buff *skb, __be32 daddr, __be32 saddr,
24722473
IN_DEV_MFORWARD(in_dev))
24732474
#endif
24742475
) {
2475-
err = ip_route_input_mc(skb, daddr, saddr,
2476-
tos, dev, our);
2476+
reason = ip_route_input_mc(skb, daddr, saddr, tos,
2477+
dev, our);
24772478
}
2478-
return err;
2479+
return reason ? -EINVAL : 0;
24792480
}
24802481

24812482
return ip_route_input_slow(skb, daddr, saddr, tos, dev, res);

0 commit comments

Comments
 (0)