]> git.neil.brown.name Git - history.git/commitdiff
Make sure outgoing ICMP and TCP resets
authorCharles-Edouard Ruault <cruault@724.com>
Thu, 21 Mar 2002 13:53:51 +0000 (05:53 -0800)
committerDavid S. Miller <davem@nuts.ninka.net>
Thu, 21 Mar 2002 13:53:51 +0000 (05:53 -0800)
use the most uptodate value of ip_default_ttl sysctl.

net/ipv4/icmp.c
net/ipv4/tcp_ipv4.c

index aafb6c6a956a2189f75e94dbbb701a34b747ec67..a5b7dbb0d0e1ca85583ed8cd7ad804075d317d12 100644 (file)
@@ -139,6 +139,8 @@ struct icmp_err icmp_err_convert[] = {
   { EHOSTUNREACH,      1 }     /*      ICMP_PREC_CUTOFF        */
 };
 
+extern int sysctl_ip_default_ttl;
+
 /* Control parameters for ECHO replies. */
 int sysctl_icmp_echo_ignore_all;
 int sysctl_icmp_echo_ignore_broadcasts;
@@ -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);
 
        inet->tos = skb->nh.iph->tos;
+       inet->ttl = sysctl_ip_default_ttl;
        daddr = ipc.addr = rt->rt_src;
        ipc.opt = NULL;
        if (icmp_param->replyopts.optlen) {
@@ -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_out_count(icmp_param.data.icmph.type);
        inet_sk(icmp_socket->sk)->tos = tos;
+       inet_sk(icmp_socket->sk)->ttl = sysctl_ip_default_ttl;
        ipc.addr = iph->saddr;
        ipc.opt = &icmp_param.replyopts;
        if (icmp_param.replyopts.srr) {
index ab2cf76c1edcf7a9b607f0a7656172044ac1c7b2..ef33bf3a45b97eedb456b14e078e74ec576a7a91 100644 (file)
@@ -64,6 +64,7 @@
 #include <linux/ipsec.h>
 
 extern int sysctl_ip_dynaddr;
+extern int sysctl_ip_default_ttl;
 int sysctl_tcp_tw_reuse = 0;
 
 /* Check TCP sequence numbers in ICMP packets. */
@@ -1201,6 +1202,7 @@ static void tcp_v4_send_reset(struct sk_buff *skb)
        arg.n_iov = 1;
        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);
 
        TCP_INC_STATS_BH(TcpOutSegs);