diff options
-rw-r--r-- | include/net/ip.h | 5 | ||||
-rw-r--r-- | net/ipv4/ip_output.c | 9 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 8 |
3 files changed, 12 insertions, 10 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index 50841bd6f10e..ec5cfde85e9a 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 | ||
161 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, | 161 | void 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 | ||
164 | struct ipv4_config { | 165 | struct 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 0f3185a662c3..2630900e480a 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 | */ |
1467 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, | 1467 | void 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 b4ae1c199f3e..64568fa21d05 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 | } |