netfilter-2.6/iptables/trunk: extensions/libip6t_physdev.c extensions/libipt_physdev.c include/ip6ta...

pluto cvs at pld-linux.org
Wed Jun 22 15:20:07 CEST 2005


Author: pluto
Date: Wed Jun 22 15:20:02 2005
New Revision: 6172

Modified:
   netfilter-2.6/iptables/trunk/extensions/libip6t_physdev.c
   netfilter-2.6/iptables/trunk/extensions/libipt_physdev.c
   netfilter-2.6/iptables/trunk/include/ip6tables.h
   netfilter-2.6/iptables/trunk/include/iptables.h
   netfilter-2.6/iptables/trunk/ip6tables.c
   netfilter-2.6/iptables/trunk/iptables.c
Log:
- delete parse_interface() in libip{6}t_physdev.c and use same function
  in ip{6}tables.c instead. this cleanup will also fix the bug [1] reported
  last year (Yasuyuki Kozakai).

  [1] https://lists.netfilter.org/pipermail/netfilter-devel/2004-April/014893.html


Modified: netfilter-2.6/iptables/trunk/extensions/libip6t_physdev.c
==============================================================================
--- netfilter-2.6/iptables/trunk/extensions/libip6t_physdev.c	(original)
+++ netfilter-2.6/iptables/trunk/extensions/libip6t_physdev.c	Wed Jun 22 15:20:02 2005
@@ -34,45 +34,6 @@
 	{0}
 };
 
-/* copied from iptables.c */
-static void
-parse_interface(const char *arg, char *vianame, unsigned char *mask)
-{
-	int vialen = strlen(arg);
-	unsigned int i;
-
-	memset(mask, 0, IFNAMSIZ);
-	memset(vianame, 0, IFNAMSIZ);
-
-	if (vialen + 1 > IFNAMSIZ)
-		exit_error(PARAMETER_PROBLEM,
-			   "interface name `%s' must be shorter than IFNAMSIZ"
-			   " (%i)", arg, IFNAMSIZ-1);
-
-	strcpy(vianame, arg);
-	if (vialen == 0)
-		memset(mask, 0, IFNAMSIZ);
-	else if (vianame[vialen - 1] == '+') {
-		memset(mask, 0xFF, vialen - 1);
-		memset(mask + vialen - 1, 0, IFNAMSIZ - vialen + 1);
-		/* Don't remove `+' here! -HW */
-	} else {
-		/* Include nul-terminator in match */
-		memset(mask, 0xFF, vialen + 1);
-		memset(mask + vialen + 1, 0, IFNAMSIZ - vialen - 1);
-		for (i = 0; vianame[i]; i++) {
-			if (!isalnum(vianame[i])
-			    && vianame[i] != '_'
-			    && vianame[i] != '.') {
-				printf("Warning: wierd character in interface"
-				       " `%s' (No aliases, :, ! or *).\n",
-				       vianame);
-				break;
-			}
-		}
-	}
-}
-
 static void
 init(struct ip6t_entry_match *m, unsigned int *nfcache)
 {

Modified: netfilter-2.6/iptables/trunk/extensions/libipt_physdev.c
==============================================================================
--- netfilter-2.6/iptables/trunk/extensions/libipt_physdev.c	(original)
+++ netfilter-2.6/iptables/trunk/extensions/libipt_physdev.c	Wed Jun 22 15:20:02 2005
@@ -34,45 +34,6 @@
 	{0}
 };
 
-/* copied from iptables.c */
-static void
-parse_interface(const char *arg, char *vianame, unsigned char *mask)
-{
-	int vialen = strlen(arg);
-	unsigned int i;
-
-	memset(mask, 0, IFNAMSIZ);
-	memset(vianame, 0, IFNAMSIZ);
-
-	if (vialen + 1 > IFNAMSIZ)
-		exit_error(PARAMETER_PROBLEM,
-			   "interface name `%s' must be shorter than IFNAMSIZ"
-			   " (%i)", arg, IFNAMSIZ-1);
-
-	strcpy(vianame, arg);
-	if (vialen == 0)
-		memset(mask, 0, IFNAMSIZ);
-	else if (vianame[vialen - 1] == '+') {
-		memset(mask, 0xFF, vialen - 1);
-		memset(mask + vialen - 1, 0, IFNAMSIZ - vialen + 1);
-		/* Don't remove `+' here! -HW */
-	} else {
-		/* Include nul-terminator in match */
-		memset(mask, 0xFF, vialen + 1);
-		memset(mask + vialen + 1, 0, IFNAMSIZ - vialen - 1);
-		for (i = 0; vianame[i]; i++) {
-			if (!isalnum(vianame[i])
-			    && vianame[i] != '_'
-			    && vianame[i] != '.') {
-				printf("Warning: wierd character in interface"
-				       " `%s' (No aliases, :, ! or *).\n",
-				       vianame);
-				break;
-			}
-		}
-	}
-}
-
 static void
 init(struct ipt_entry_match *m, unsigned int *nfcache)
 {

Modified: netfilter-2.6/iptables/trunk/include/ip6tables.h
==============================================================================
--- netfilter-2.6/iptables/trunk/include/ip6tables.h	(original)
+++ netfilter-2.6/iptables/trunk/include/ip6tables.h	Wed Jun 22 15:20:02 2005
@@ -137,6 +137,8 @@
 extern struct ip6tables_target *find_target(const char *name, enum ip6t_tryload);
 extern struct ip6tables_match *find_match(const char *name, enum ip6t_tryload, struct ip6tables_rule_match **match);
 
+extern void parse_interface(const char *arg, char *vianame, unsigned char *mask);
+
 extern int for_each_chain(int (*fn)(const ip6t_chainlabel, int, ip6tc_handle_t *), int verbose, int builtinstoo, ip6tc_handle_t *handle);
 extern int flush_entries(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle);
 extern int delete_chain(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle);

Modified: netfilter-2.6/iptables/trunk/include/iptables.h
==============================================================================
--- netfilter-2.6/iptables/trunk/include/iptables.h	(original)
+++ netfilter-2.6/iptables/trunk/include/iptables.h	Wed Jun 22 15:20:02 2005
@@ -152,6 +152,7 @@
 extern void parse_hostnetworkmask(const char *name, struct in_addr **addrpp,
                       struct in_addr *maskp, unsigned int *naddrs);
 extern u_int16_t parse_protocol(const char *s);
+extern void parse_interface(const char *arg, char *vianame, unsigned char *mask);
 
 extern int do_command(int argc, char *argv[], char **table,
 		      iptc_handle_t *handle);

Modified: netfilter-2.6/iptables/trunk/ip6tables.c
==============================================================================
--- netfilter-2.6/iptables/trunk/ip6tables.c	(original)
+++ netfilter-2.6/iptables/trunk/ip6tables.c	Wed Jun 22 15:20:02 2005
@@ -829,8 +829,7 @@
 	return (u_int16_t)proto;
 }
 
-static void
-parse_interface(const char *arg, char *vianame, unsigned char *mask)
+void parse_interface(const char *arg, char *vianame, unsigned char *mask)
 {
 	int vialen = strlen(arg);
 	unsigned int i;

Modified: netfilter-2.6/iptables/trunk/iptables.c
==============================================================================
--- netfilter-2.6/iptables/trunk/iptables.c	(original)
+++ netfilter-2.6/iptables/trunk/iptables.c	Wed Jun 22 15:20:02 2005
@@ -769,8 +769,7 @@
 	return (u_int16_t)proto;
 }
 
-static void
-parse_interface(const char *arg, char *vianame, unsigned char *mask)
+void parse_interface(const char *arg, char *vianame, unsigned char *mask)
 {
 	int vialen = strlen(arg);
 	unsigned int i;



More information about the pld-cvs-commit mailing list