Re: [PATCH,RFC] Route match, user

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

 



On Thu, Jul 03, 2008 at 09:26:04AM +0200, Jan Engelhardt wrote:
> 
> >+static const struct option route_opts[] = {
> >+	{ "route-src-exists", 0, NULL, '1' },
> >+	{ "route-src-eq", 1, NULL, '2' },
> >+	{ "route-src-gt", 1, NULL, '3' },
> >+	{ "route-src-lt", 1, NULL, '4' },
> >+	{ "route-dst-exists", 0, NULL, '5' },
> >+	{ "route-dst-eq", 1, NULL, '6' },
> >+	{ "route-dst-gt", 1, NULL, '7' },
> >+	{ "route-dst-lt", 1, NULL, '8' },
> >+	{ .name = NULL }
> >+};
> 
> You are mixing non-C99 and C99 style.

Copy/paste from other iptables code.  Guess a new match should remain
consistent.
 
> >+static int route_parse(int c, char **argv, int invert, unsigned int *flags,
> >+                       const void *entry, struct xt_entry_match **match)
> >+{
> >+	struct xt_route_info *info = (struct xt_route_info *) (*match)->data;
> >+	unsigned int value;
> >+
> >+	check_inverse(optarg, &invert, &optind, 0);
> 
> I would not bother supporting intraplaced ! at all. Just remove that line.

Sorry..."intraplaced"?
 
> >+		case '6':
> >+			if (invert) 
> >+				exit_error(PARAMETER_PROBLEM,
> >+						"route: unexpected `!'");
> >+
> >+			if (string_to_number(optarg, 1, 128, &value) == -1)
> >+				exit_error(PARAMETER_PROBLEM,
> >+				           "route: Expected prefix between 1 and 128");
> >+
> >+			info->mode = XT_ROUTE_DST_EQ;
> >+			info->value = value;
> >+			break;
> 
> There is a lot of code to unify between route_mt_parse and route_mt6_parse.

I suppose I could pass a 32 or 128 to a common function, yes.

Phil
--
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