Patch for TTL target
[Please CC me on replies, I am not subscribed to the list, thanks]
Hello,
Here is the patch that fix some C formatting issues (so source are more readable).
Signature · 2 lines
Best Regards Marcin Garski
patchlets/TTL/linux/net/ipv4/netfilter/ipt_TTL.c +7 -7
@@ -26,7 +26,7 @@const struct ipt_TTL_info *info = targinfo;u_int16_t diffs[2 ];int new_ttl; - +switch (info->mode) {case IPT_TTL_SET : new_ttl = info->ttl;
@@ -51,9 +51,9 @@ iph->ttl = new_ttl; diffs[1 ] =htons (((unsigned )iph->ttl) <<8 ); iph->check =csum_fold (csum_partial ((char *)diffs, -sizeof (diffs), - iph->check^0xFFFF )); - (*pskb)->nfcache |=NFC_ALTERED ; +sizeof (diffs), + iph->check^0xFFFF )); + (*pskb)->nfcache |=NFC_ALTERED ; }return IPT_CONTINUE ;
@@ -71,8 +71,8 @@printk (KERN_WARNING "TTL: targinfosize %u != %Zu\n" , targinfosize,IPT_ALIGN (sizeof (struct ipt_TTL_info ))); -return 0 ; - } +return 0 ; + }if (strcmp (tablename,"mangle" )) {printk (KERN_WARNING "TTL: can only be called from \"mangle\" table, not \"%s\"\n" , tablename);
@@ -89,7 +89,7 @@printk (KERN_WARNING "TTL: increment/decrement doesn't make sense with value 0\n" );return 0 ; } - +return 1 ; }
patchlets/TTL/linux-2.6/net/ipv4/netfilter/ipt_TTL.c +7 -7
@@ -32,7 +32,7 @@return NF_DROP ; iph = (*pskb)->nh.iph; - +switch (info->mode) {case IPT_TTL_SET : new_ttl = info->ttl;
@@ -57,9 +57,9 @@ iph->ttl = new_ttl; diffs[1 ] =htons (((unsigned )iph->ttl) <<8 ); iph->check =csum_fold (csum_partial ((char *)diffs, -sizeof (diffs), - iph->check^0xFFFF )); - (*pskb)->nfcache |=NFC_ALTERED ; +sizeof (diffs), + iph->check^0xFFFF )); + (*pskb)->nfcache |=NFC_ALTERED ; }return IPT_CONTINUE ;
@@ -77,8 +77,8 @@printk (KERN_WARNING "TTL: targinfosize %u != %Zu\n" , targinfosize,IPT_ALIGN (sizeof (struct ipt_TTL_info ))); -return 0 ; - } +return 0 ; + }if (strcmp (tablename,"mangle" )) {printk (KERN_WARNING "TTL: can only be called from \"mangle\" table, not \"%s\"\n" , tablename);
@@ -95,7 +95,7 @@printk (KERN_WARNING "TTL: increment/decrement doesn't make sense with value 0\n" );return 0 ; } - +return 1 ; }
Quoted 6 lines · Marcin Garski
[Please CC me on replies, I am not subscribed to the list, thanks]
Hello,
Here is the patch that fix some C formatting issues (so source are more readable).
I'm only applying this cosmetic whitespace-change patch because the code is only in svn and not in the mainline kernel. I've also done some further cleanups, result is revision 4244.
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie