Skip to content

Commit 4c7e622

Browse files
committed
Merge branch 'ipv4-routing-cleanups'
Alexander Duyck says: ==================== Minor IPv4 routing cleanups These patches just contain some minor cleanups to address a few minor issues. The first and the third mostly just improve readability. The second patch should improve the performance for multicast destination addresses that do not have a localhost source IP address by avoiding some unnecessary dereferences. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 0f50c10 + 0d75396 commit 4c7e622

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

include/linux/igmp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct ip_mc_list {
110110
#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
111111
#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
112112

113-
extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
113+
extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u8 proto);
114114
extern int igmp_rcv(struct sk_buff *);
115115
extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
116116
extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);

net/ipv4/igmp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2569,7 +2569,7 @@ void ip_mc_drop_socket(struct sock *sk)
25692569
}
25702570

25712571
/* called with rcu_read_lock() */
2572-
int ip_check_mc_rcu(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u16 proto)
2572+
int ip_check_mc_rcu(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u8 proto)
25732573
{
25742574
struct ip_mc_list *im;
25752575
struct ip_mc_list __rcu **mc_hash;

net/ipv4/route.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,9 +1487,8 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
14871487
skb->protocol != htons(ETH_P_IP))
14881488
goto e_inval;
14891489

1490-
if (likely(!IN_DEV_ROUTE_LOCALNET(in_dev)))
1491-
if (ipv4_is_loopback(saddr))
1492-
goto e_inval;
1490+
if (ipv4_is_loopback(saddr) && !IN_DEV_ROUTE_LOCALNET(in_dev))
1491+
goto e_inval;
14931492

14941493
if (ipv4_is_zeronet(saddr)) {
14951494
if (!ipv4_is_local_multicast(daddr))
@@ -1760,7 +1759,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
17601759
err = fib_validate_source(skb, saddr, daddr, tos,
17611760
0, dev, in_dev, &itag);
17621761
if (err < 0)
1763-
goto martian_source_keep_err;
1762+
goto martian_source;
17641763
goto local_input;
17651764
}
17661765

@@ -1782,7 +1781,7 @@ out: return err;
17821781
err = fib_validate_source(skb, saddr, 0, tos, 0, dev,
17831782
in_dev, &itag);
17841783
if (err < 0)
1785-
goto martian_source_keep_err;
1784+
goto martian_source;
17861785
}
17871786
flags |= RTCF_BROADCAST;
17881787
res.type = RTN_BROADCAST;
@@ -1858,8 +1857,6 @@ out: return err;
18581857
goto out;
18591858

18601859
martian_source:
1861-
err = -EINVAL;
1862-
martian_source_keep_err:
18631860
ip_handle_martian_source(dev, in_dev, skb, daddr, saddr);
18641861
goto out;
18651862
}

0 commit comments

Comments
 (0)