[PATCH][EBTABLES] Add wildcard support for interface matching

Bart De Schuymer <[email protected]>
Newsgroups gmane.linux.network.bridge.ebtables.devel
Message-ID <[email protected]>
Hi Dave,

Due to an old braindead decision, ebtables doesn't yet support the
wildcard '+' for matching interface names. The following patch removes
this nuissance and is backwards compatible.

cheers,
Bart

--- linux-2.6.10-rc1-bk1/net/bridge/netfilter/ebtables.c.old	2004-10-24 10:11:02.000000000 +0200
+++ linux-2.6.10-rc1-bk1/net/bridge/netfilter/ebtables.c	2004-10-24 10:08:36.000000000 +0200
@@ -109,11 +109,17 @@ static inline int ebt_do_match (struct e
 
 static inline int ebt_dev_check(char *entry, const struct net_device *device)
 {
+	int i = 0;
+	char *devname = device->name;
+
 	if (*entry == '\0')
 		return 0;
 	if (!device)
 		return 1;
-	return !!strcmp(entry, device->name);
+	/* 1 is the wildcard token */
+	while (entry[i] != '\0' && entry[i] != 1 && entry[i] == devname[i])
+		i++;
+	return (devname[i] != entry[i] && entry[i] != 1);
 }
 
 #define FWINV2(bool,invflg) ((bool) ^ !!(e->invflags & invflg))



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.