aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-06-28 06:21:41 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-28 06:21:41 -0400
commit70e7341673a47fb1525cfc7d6651cc98b5348928 (patch)
treedfab978a554b6badff83381bf03c42543cd37eb6
parent160eb5a6b14ca2eab5c598bdbbb24c24624bad34 (diff)
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 <davem@davemloft.net>
-rw-r--r--include/net/ip.h5
-rw-r--r--net/ipv4/ip_output.c9
-rw-r--r--net/ipv4/tcp_ipv4.c8
3 files changed, 12 insertions, 10 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index 50841bd6f10..ec5cfde85e9 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -158,8 +158,9 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg)
158 return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0; 158 return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0;
159} 159}
160 160
161void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, 161void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
162 const struct ip_reply_arg *arg, unsigned int len); 162 __be32 saddr, const struct ip_reply_arg *arg,
163 unsigned int len);
163 164
164struct ipv4_config { 165struct ipv4_config {
165 int log_martians; 166 int log_martians;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 0f3185a662c..2630900e480 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1459,13 +1459,14 @@ static int ip_reply_glue_bits(void *dptr, char *to, int offset,
1459 1459
1460/* 1460/*
1461 * Generic function to send a packet as reply to another packet. 1461 * 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.
1463 * 1463 *
1464 * Should run single threaded per socket because it uses the sock 1464 * Should run single threaded per socket because it uses the sock
1465 * structure to pass arguments. 1465 * structure to pass arguments.
1466 */ 1466 */
1467void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, 1467void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
1468 const struct ip_reply_arg *arg, unsigned int len) 1468 __be32 saddr, const struct ip_reply_arg *arg,
1469 unsigned int len)
1469{ 1470{
1470 struct inet_sock *inet = inet_sk(sk); 1471 struct inet_sock *inet = inet_sk(sk);
1471 struct ip_options_data replyopts; 1472 struct ip_options_data replyopts;
@@ -1491,7 +1492,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
1491 RT_TOS(arg->tos), 1492 RT_TOS(arg->tos),
1492 RT_SCOPE_UNIVERSE, sk->sk_protocol, 1493 RT_SCOPE_UNIVERSE, sk->sk_protocol,
1493 ip_reply_arg_flowi_flags(arg), 1494 ip_reply_arg_flowi_flags(arg),
1494 daddr, rt->rt_spec_dst, 1495 daddr, saddr,
1495 tcp_hdr(skb)->source, tcp_hdr(skb)->dest); 1496 tcp_hdr(skb)->source, tcp_hdr(skb)->dest);
1496 security_skb_classify_flow(skb, flowi4_to_flowi(&fl4)); 1497 security_skb_classify_flow(skb, flowi4_to_flowi(&fl4));
1497 rt = ip_route_output_key(sock_net(sk), &fl4); 1498 rt = ip_route_output_key(sock_net(sk), &fl4);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index b4ae1c199f3..64568fa21d0 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -698,8 +698,8 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
698 698
699 net = dev_net(skb_dst(skb)->dev); 699 net = dev_net(skb_dst(skb)->dev);
700 arg.tos = ip_hdr(skb)->tos; 700 arg.tos = ip_hdr(skb)->tos;
701 ip_send_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr, 701 ip_send_unicast_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr,
702 &arg, arg.iov[0].iov_len); 702 ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len);
703 703
704 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); 704 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
705 TCP_INC_STATS_BH(net, TCP_MIB_OUTRSTS); 705 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,
781 if (oif) 781 if (oif)
782 arg.bound_dev_if = oif; 782 arg.bound_dev_if = oif;
783 arg.tos = tos; 783 arg.tos = tos;
784 ip_send_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr, 784 ip_send_unicast_reply(net->ipv4.tcp_sock, skb, ip_hdr(skb)->saddr,
785 &arg, arg.iov[0].iov_len); 785 ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len);
786 786
787 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS); 787 TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
788} 788}