Commit aecec5f9 authored by Charles-Edouard Ruault's avatar Charles-Edouard Ruault Committed by David S. Miller

Make sure outgoing ICMP and TCP resets

use the most uptodate value of ip_default_ttl sysctl.
parent cd415a87
...@@ -139,6 +139,8 @@ struct icmp_err icmp_err_convert[] = { ...@@ -139,6 +139,8 @@ struct icmp_err icmp_err_convert[] = {
{ EHOSTUNREACH, 1 } /* ICMP_PREC_CUTOFF */ { EHOSTUNREACH, 1 } /* ICMP_PREC_CUTOFF */
}; };
extern int sysctl_ip_default_ttl;
/* Control parameters for ECHO replies. */ /* Control parameters for ECHO replies. */
int sysctl_icmp_echo_ignore_all; int sysctl_icmp_echo_ignore_all;
int sysctl_icmp_echo_ignore_broadcasts; int sysctl_icmp_echo_ignore_broadcasts;
...@@ -354,6 +356,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) ...@@ -354,6 +356,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
icmp_out_count(icmp_param->data.icmph.type); icmp_out_count(icmp_param->data.icmph.type);
inet->tos = skb->nh.iph->tos; inet->tos = skb->nh.iph->tos;
inet->ttl = sysctl_ip_default_ttl;
daddr = ipc.addr = rt->rt_src; daddr = ipc.addr = rt->rt_src;
ipc.opt = NULL; ipc.opt = NULL;
if (icmp_param->replyopts.optlen) { if (icmp_param->replyopts.optlen) {
...@@ -498,6 +501,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info) ...@@ -498,6 +501,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info)
icmp_param.offset=skb_in->nh.raw - skb_in->data; icmp_param.offset=skb_in->nh.raw - skb_in->data;
icmp_out_count(icmp_param.data.icmph.type); icmp_out_count(icmp_param.data.icmph.type);
inet_sk(icmp_socket->sk)->tos = tos; inet_sk(icmp_socket->sk)->tos = tos;
inet_sk(icmp_socket->sk)->ttl = sysctl_ip_default_ttl;
ipc.addr = iph->saddr; ipc.addr = iph->saddr;
ipc.opt = &icmp_param.replyopts; ipc.opt = &icmp_param.replyopts;
if (icmp_param.replyopts.srr) { if (icmp_param.replyopts.srr) {
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#include <linux/ipsec.h> #include <linux/ipsec.h>
extern int sysctl_ip_dynaddr; extern int sysctl_ip_dynaddr;
extern int sysctl_ip_default_ttl;
int sysctl_tcp_tw_reuse = 0; int sysctl_tcp_tw_reuse = 0;
/* Check TCP sequence numbers in ICMP packets. */ /* Check TCP sequence numbers in ICMP packets. */
...@@ -1201,6 +1202,7 @@ static void tcp_v4_send_reset(struct sk_buff *skb) ...@@ -1201,6 +1202,7 @@ static void tcp_v4_send_reset(struct sk_buff *skb)
arg.n_iov = 1; arg.n_iov = 1;
arg.csumoffset = offsetof(struct tcphdr, check) / 2; arg.csumoffset = offsetof(struct tcphdr, check) / 2;
tcp_socket->sk->protinfo.af_inet.ttl = sysctl_ip_default_ttl;
ip_send_reply(tcp_socket->sk, skb, &arg, sizeof rth); ip_send_reply(tcp_socket->sk, skb, &arg, sizeof rth);
TCP_INC_STATS_BH(TcpOutSegs); TCP_INC_STATS_BH(TcpOutSegs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment