Re: [PATCH] Add support unified match/target files to iptables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 2009-06-09 15:12, Jozsef Kadlecsik wrote:
>
>The patch below adds supporting unified match/target files - and the 
>possibility to lowercase all target files - to iptables. There are a 
>couple of match/target pairs (say mark/MARK), which could be covered in a 
>single file, but the current search logic prevents it. The patch modifies 
>the searching with adding an extra check with lowercased filename for 
>targets. Comments are welcomed!

I like it.

> static void *load_extension(const char *search_path, const char *prefix,
>     const char *name, bool is_target)
> {
> 	const char *dir = search_path, *next;
> 	void *ptr = NULL;
>-	struct stat sb;
>-	char path[256];
>+	char lcname[XT_FUNCTION_MAXNAMELEN-1];
>+	unsigned int fmtlen;
>+	int i;
>+
>+	if (is_target)
>+		for (i = 0; name[i] && i < XT_FUNCTION_MAXNAMELEN - 1; i++)
>+			lcname[i] = tolower(name[i]);

This needs to check for name[i] == '\0'.

> 	do {
> 		next = strchr(dir, ':');
> 		if (next == NULL)
> 			next = dir + strlen(dir);
> 
>+		fmtlen = (unsigned int)(next - dir);

Cast is not needed. It only was previously in place, because fmtlen was
calculated directly during the call to sprintf and would not always have
type unsigned int; by storing it to a variable, you explicitly make it
unsigned int.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux