Skip to content

Commit 70e7341

Browse files
committed
ipv4: Show that ip_send_reply() is purely unicast routine.
Rename it to ip_send_unicast_reply() and add explicit 'saddr' argument. This removed one of the few users of rt->rt_spec_dst. Signed-off-by: David S. Miller <[email protected]>
1 parent 160eb5a commit 70e7341

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

include/net/ip.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg)
158158
return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0;
159159
}
160160

161-
void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
162-
const struct ip_reply_arg *arg, unsigned int len);
161+
void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
162+
__be32 saddr, const struct ip_reply_arg *arg,
163+
unsigned int len);
163164

164165
struct ipv4_config {
165166
int log_martians;

net/ipv4/ip_output.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,13 +1459,14 @@ static int ip_reply_glue_bits(void *dptr, char *to, int offset,
14591459

14601460
/*
14611461
* Generic function to send a packet as reply to another packet.
1462-
* Used to send TCP resets so far. ICMP should use this function too.
1462+
* Used to send TCP resets so far.
14631463
*
14641464
* Should run single threaded per socket because it uses the sock
14651465
* structure to pass arguments.
14661466
*/
1467-
void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
1468-
const struct ip_reply_arg *arg, unsigned int len)
1467+
void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
1468+
__be32 saddr, const struct ip_reply_arg *arg,
1469+
unsigned int len)
14691470
{
14701471
struct inet_sock *inet = inet_sk(sk);
14711472
struct ip_options_data replyopts;
@@ -1491,7 +1492,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
14911492
RT_TOS(arg->tos),
14921493
RT_SCOPE_UNIVERSE, sk->sk_protocol,
14931494
ip_reply_arg_flowi_flags(arg),
1494-
daddr, rt->rt_spec_dst,
1495+
daddr, saddr,
14951496
tcp_hdr(skb)->source, tcp_hdr(skb)->dest);
14961497
security_skb_classify_flow(skb, flowi4_to_flowi(&fl4));
14971498
rt = ip_route_output_key(sock_net(sk), &fl4);

net/ipv4/tcp_ipv4.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,8 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
698698

699699
net = dev_net(skb_dst(skb)->dev);
700700
arg.tos = ip_hdr(skb)->tos;
701-
ip_send_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr,
702-
&arg, arg.iov[0].iov_len);
701+
ip_send_unicast_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr,
702+
ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len);
703703

704704
TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
705705
TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS);
@@ -781,8 +781,8 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
781781
if (oif)
782782
arg.bound_dev_if = oif;
783783
arg.tos = tos;
784-
ip_send_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr,
785-
&arg, arg.iov[0].iov_len);
784+
ip_send_unicast_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr,
785+
ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len);
786786

787787
TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
788788
}

0 commit comments

Comments
 (0)