Skip to contentSkip to conversation

HOPLIMIT

PATCH Maciej Soltysiak 1 participant 1 message Feb 20, 2004 netfilter

lore
Share & tools
lore
#0 lore raw
Quoted 5 lines
Quoted 3 lines

I would like to take care of this, but I would like to have a clear
decision. Let's decide whether we stay with HL or switch to HOPLIMIT. I am in favor of HL.

Thanks, please submit a patch.

I did, but here it is again.
It changes HOPLIMIT to HL in files so that it comiles, and corrects the naming.
It does not change the name of the directory in CVS from HOPLIMIT to HL. Please change the dir in cvs to reflect the current name.

Regards,
Maciej

Index: HOPLIMIT/help
===================================================================
RCS file: /cvspublic/patch-o-matic-ng/HOPLIMIT/help,v retrieving revision 1.1

help +3 -3
diff -u -r1.1 help
@@ -2,6 +2,6 @@
 to increment or decrement it by a given value.
 
 Example:
-# ip6tables -t mangle -A OUTPUT -j HOPLIMIT --hl-inc 1
-# ip6tables -t mangle -A INPUT -j HOPLIMIT --hl-eq 64
-# ip6tables -t mangle -A OUTPUT -j HOPLIMIT --hl-dec 2
+# ip6tables -t mangle -A OUTPUT -j HL --hl-inc 1
+# ip6tables -t mangle -A INPUT -j HL --hl-eq 64
+# ip6tables -t mangle -A OUTPUT -j HL --hl-dec 2

Index: HOPLIMIT/info
===================================================================
RCS file: /cvspublic/patch-o-matic-ng/HOPLIMIT/info,v retrieving revision 1.1

info +1 -1
diff -u -r1.1 info
@@ -1,4 +1,4 @@
-Title: ip6tables HOPLIMIT target
+Title: ip6tables HL target
 Author: Maciej Soltysiak <[email protected]>
 Status: Works for me.
 Repository: base

Index: HOPLIMIT/linux/include/linux/netfilter_ipv6/ip6t_HL.h
===================================================================
RCS file: /cvspublic/patch-o-matic-ng/HOPLIMIT/linux/include/linux/netfilter_ipv6/ip6t_HL.h,v retrieving revision 1.1

linux/include/linux/netfilter_ipv6/ip6t_HL.h +7 -7
diff -u -r1.1 ip6t_HL.h
@@ -2,18 +2,18 @@
  * Maciej Soltysiak <[email protected]>
  * Based on HW's TTL module */
 
-#ifndef _IP6T_HOPLIMIT_H
-#define _IP6T_HOPLIMIT_H
+#ifndef _IP6T_HL_H
+#define _IP6T_HL_H
 
 enum {
-	IP6T_HOPLIMIT_SET = 0,
-	IP6T_HOPLIMIT_INC,
-	IP6T_HOPLIMIT_DEC
+	IP6T_HL_SET = 0,
+	IP6T_HL_INC,
+	IP6T_HL_DEC
 };
 
-#define IP6T_HOPLIMIT_MAXMODE	IP6T_HOPLIMIT_DEC
+#define IP6T_HL_MAXMODE	IP6T_HL_DEC
 
-struct ip6t_HOPLIMIT_info {
+struct ip6t_HL_info {
 	u_int8_t	mode;
 	u_int8_t	hop_limit;
 };

Index: HOPLIMIT/linux/net/ipv6/netfilter/Config.in.ladd
===================================================================
RCS file: /cvspublic/patch-o-matic-ng/HOPLIMIT/linux/net/ipv6/netfilter/Config.in.ladd,v retrieving revision 1.1

linux/net/ipv6/netfilter/Config.in.ladd +1 -1
diff -u -r1.1 Config.in.ladd
@@ -1,4 +1,4 @@
   dep_tristate '  Packet filtering' CONFIG_IP6_NF_FILTER $CONFIG_IP6_NF_IPTABLES 
   if [ "$CONFIG_IP6_NF_FILTER" != "n" ]; then
-    dep_tristate '    HOPLIMIT target support' CONFIG_IP6_NF_TARGET_HOPLIMIT $CONFIG_IP6_NF_FILTER
+    dep_tristate '    HL target support' CONFIG_IP6_NF_TARGET_HL $CONFIG_IP6_NF_FILTER
   fi

Index: HOPLIMIT/linux/net/ipv6/netfilter/Kconfig.ladd
===================================================================
RCS file: /cvspublic/patch-o-matic-ng/HOPLIMIT/linux/net/ipv6/netfilter/Kconfig.ladd,v retrieving revision 1.1

linux/net/ipv6/netfilter/Kconfig.ladd +2 -2
diff -u -r1.1 Kconfig.ladd
@@ -1,3 +1,3 @@
-config IP6_NF_TARGET_HOPLIMIT
-	tristate  'HOPLIMIT target support'
+config IP6_NF_TARGET_HL
+	tristate  'HL target support'
 	depends on IP6_NF_MANGLE

Index: HOPLIMIT/linux/net/ipv6/netfilter/Makefile.ladd
===================================================================
RCS file: /cvspublic/patch-o-matic-ng/HOPLIMIT/linux/net/ipv6/netfilter/Makefile.ladd,v retrieving revision 1.1

linux/net/ipv6/netfilter/Makefile.ladd +1 -1
diff -u -r1.1 Makefile.ladd
@@ -1,2 +1,2 @@
 obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o
-obj-$(CONFIG_IP6_NF_TARGET_HOPLIMIT) += ip6t_HOPLIMIT.o
+obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o

Index: HOPLIMIT/linux/net/ipv6/netfilter/ip6t_HL.c
===================================================================
RCS file: /cvspublic/patch-o-matic-ng/HOPLIMIT/linux/net/ipv6/netfilter/ip6t_HL.c,v retrieving revision 1.1

linux/net/ipv6/netfilter/ip6t_HL.c +17 -17
diff -u -r1.1 ip6t_HL.c
@@ -11,7 +11,7 @@
 #include <linux/ip.h>
 
 #include <linux/netfilter_ipv6/ip6_tables.h>
-#include <linux/netfilter_ipv6/ip6t_HOPLIMIT.h>
+#include <linux/netfilter_ipv6/ip6t_HL.h>
 
 MODULE_AUTHOR("Maciej Soltysiak <[email protected]>");
 MODULE_DESCRIPTION("IP tables Hop Limit modification module");
@@ -22,20 +22,20 @@
 		const void *targinfo, void *userinfo)
 {
 	struct ipv6hdr *ip6h = (*pskb)->nh.ipv6h;
-	const struct ip6t_HOPLIMIT_info *info = targinfo;
+	const struct ip6t_HL_info *info = targinfo;
 	u_int16_t diffs[2];
 	int new_hl;
 			 
 	switch (info->mode) {
-		case IP6T_HOPLIMIT_SET:
+		case IP6T_HL_SET:
 			new_hl = info->hop_limit;
 			break;
-		case IP6T_HOPLIMIT_INC:
+		case IP6T_HL_INC:
 			new_hl = ip6h->hop_limit + info->hop_limit;
 			if (new_hl > 255)
 				new_hl = 255;
 			break;
-		case IP6T_HOPLIMIT_DEC:
+		case IP6T_HL_DEC:
 			new_hl = ip6h->hop_limit + info->hop_limit;
 			if (new_hl < 0)
 				new_hl = 0;
@@ -60,45 +60,45 @@
 		unsigned int targinfosize,
 		unsigned int hook_mask)
 {
-	struct ip6t_HOPLIMIT_info *info = targinfo;
+	struct ip6t_HL_info *info = targinfo;
 
-	if (targinfosize != IP6T_ALIGN(sizeof(struct ip6t_HOPLIMIT_info))) {
-		printk(KERN_WARNING "HOPLIMIT: targinfosize %u != %Zu\n",
+	if (targinfosize != IP6T_ALIGN(sizeof(struct ip6t_HL_info))) {
+		printk(KERN_WARNING "HL: targinfosize %u != %Zu\n",
 				targinfosize,
-				IP6T_ALIGN(sizeof(struct ip6t_HOPLIMIT_info)));
+				IP6T_ALIGN(sizeof(struct ip6t_HL_info)));
 		return 0;	
 	}	
 
 	if (strcmp(tablename, "mangle")) {
-		printk(KERN_WARNING "HOPLIMIT: can only be called from \"mangle\" table, not \"%s\"\n", tablename);
+		printk(KERN_WARNING "HL: can only be called from \"mangle\" table, not \"%s\"\n", tablename);
 		return 0;
 	}
 
-	if (info->mode > IP6T_HOPLIMIT_MAXMODE) {
-		printk(KERN_WARNING "HOPLIMIT: invalid or unknown Mode %u\n", 
+	if (info->mode > IP6T_HL_MAXMODE) {
+		printk(KERN_WARNING "HL: invalid or unknown Mode %u\n", 
 			info->mode);
 		return 0;
 	}
 
-	if ((info->mode != IP6T_HOPLIMIT_SET) && (info->hop_limit == 0)) {
-		printk(KERN_WARNING "HOPLIMIT: increment/decrement doesn't make sense with value 0\n");
+	if ((info->mode != IP6T_HL_SET) && (info->hop_limit == 0)) {
+		printk(KERN_WARNING "HL: increment/decrement doesn't make sense with value 0\n");
 		return 0;
 	}
 	
 	return 1;
 }
 
-static struct ip6t_target ip6t_HOPLIMIT = { { NULL, NULL }, "HOPLIMIT", 
+static struct ip6t_target ip6t_HL = { { NULL, NULL }, "HL", 
 	ip6t_hl_target, ip6t_hl_checkentry, NULL, THIS_MODULE };
 
 static int __init init(void)
 {
-	return ip6t_register_target(&ip6t_HOPLIMIT);
+	return ip6t_register_target(&ip6t_HL);
 }
 
 static void __exit fini(void)
 {
-	ip6t_unregister_target(&ip6t_HOPLIMIT);
+	ip6t_unregister_target(&ip6t_HL);
 }
 
 module_init(init);