[netfilter-cvslog] r6341 - trunk/patch-o-matic-ng/patchlets/TARPIT/linux-2.6/net/ipv4/netfilter

kaber at netfilter.org kaber at netfilter.org
Tue Jan 3 12:29:44 CET 2006


Author: kaber at netfilter.org
Date: 2006-01-03 12:29:44 +0100 (Tue, 03 Jan 2006)
New Revision: 6341

Modified:
   trunk/patch-o-matic-ng/patchlets/TARPIT/linux-2.6/net/ipv4/netfilter/ipt_TARPIT.c
Log:
Use RTAX_HOPLIMIT metric instead of sysctl_ip_default_ttl (Patrick McHardy)


Modified: trunk/patch-o-matic-ng/patchlets/TARPIT/linux-2.6/net/ipv4/netfilter/ipt_TARPIT.c
===================================================================
--- trunk/patch-o-matic-ng/patchlets/TARPIT/linux-2.6/net/ipv4/netfilter/ipt_TARPIT.c	2005-12-26 02:49:34 UTC (rev 6340)
+++ trunk/patch-o-matic-ng/patchlets/TARPIT/linux-2.6/net/ipv4/netfilter/ipt_TARPIT.c	2006-01-03 11:29:44 UTC (rev 6341)
@@ -170,22 +170,6 @@
 				   csum_partial((char *)ntcph,
 						sizeof(struct tcphdr), 0));
 
-	/* Adjust IP TTL */
-#ifdef CONFIG_SYSCTL
-	nskb->nh.iph->ttl = sysctl_ip_default_ttl;
-#else
-	nskb->nh.iph->ttl = IPDEFTTL;
-#endif
-
-	/* Set DF, id = 0 */
-	nskb->nh.iph->frag_off = htons(IP_DF);
-	nskb->nh.iph->id = 0;
-
-	/* Adjust IP checksum */
-	nskb->nh.iph->check = 0;
-	nskb->nh.iph->check = ip_fast_csum((unsigned char *)nskb->nh.iph,
-					   nskb->nh.iph->ihl);
-
 	fl.nl_u.ip4_u.daddr = nskb->nh.iph->daddr;
 	fl.nl_u.ip4_u.saddr = local ? nskb->nh.iph->saddr : 0;
 	fl.nl_u.ip4_u.tos = RT_TOS(nskb->nh.iph->tos) | RTO_CONN;
@@ -197,6 +181,18 @@
 	dst_release(nskb->dst);
 	nskb->dst = &nrt->u.dst;
 
+	/* Adjust IP TTL */
+	nskb->nh.iph->ttl = dst_metric(nskb->dst, RTAX_HOPLIMIT);
+
+	/* Set DF, id = 0 */
+	nskb->nh.iph->frag_off = htons(IP_DF);
+	nskb->nh.iph->id = 0;
+
+	/* Adjust IP checksum */
+	nskb->nh.iph->check = 0;
+	nskb->nh.iph->check = ip_fast_csum((unsigned char *)nskb->nh.iph,
+					   nskb->nh.iph->ihl);
+
 	/* "Never happens" */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
 	if (nskb->len > dst_mtu(nskb->dst))




More information about the netfilter-cvslog mailing list