summaryrefslogtreecommitdiffstats
path: root/extensions/libip6t_rt.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2011-05-24 23:50:29 +0200
committerJan Engelhardt <jengelh@medozas.de>2011-05-25 00:38:50 +0200
commit6944f2c8190f1c4319aeac748470c71b0ba45025 (patch)
treebadf3e40fe0b47be98d0f24ef078cc7e6831da0d /extensions/libip6t_rt.c
parent1b6c7632e5e35ecce91f87a4ae36eca3103cfee2 (diff)
libxtables: have xtopt_parse_mint interpret partially-spec'd ranges
When ":n" or "n:" is specified, it will now be interpreted as "0:n" and "n:<max>", respecitvely. nvals will always reflect the number of (expanded) components. This restores the functionality of options that take such partially-unspecified ranges. This makes it possible to nuke the per-matchdata init functions of some extensions and simply the extensions postparsing to the point where it only needs to check for nvals==1 or ==2. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'extensions/libip6t_rt.c')
-rw-r--r--extensions/libip6t_rt.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/extensions/libip6t_rt.c b/extensions/libip6t_rt.c
index 9e6868de..d470488d 100644
--- a/extensions/libip6t_rt.c
+++ b/extensions/libip6t_rt.c
@@ -99,13 +99,6 @@ parse_addresses(const char *addrstr, struct in6_addr *addrp)
return i;
}
-static void rt_init(struct xt_entry_match *m)
-{
- struct ip6t_rt *rtinfo = (struct ip6t_rt *)m->data;
-
- rtinfo->segsleft[1] = 0xFFFFFFFF;
-}
-
static void rt_parse(struct xt_option_call *cb)
{
struct ip6t_rt *rtinfo = cb->data;
@@ -118,6 +111,8 @@ static void rt_parse(struct xt_option_call *cb)
rtinfo->flags |= IP6T_RT_TYP;
break;
case O_RT_SEGSLEFT:
+ if (cb->nvals == 1)
+ rtinfo->segsleft[1] = rtinfo->segsleft[0];
if (cb->invert)
rtinfo->invflags |= IP6T_RT_INV_SGS;
rtinfo->flags |= IP6T_RT_SGS;
@@ -250,7 +245,6 @@ static struct xtables_match rt_mt6_reg = {
.size = XT_ALIGN(sizeof(struct ip6t_rt)),
.userspacesize = XT_ALIGN(sizeof(struct ip6t_rt)),
.help = rt_help,
- .init = rt_init,
.x6_parse = rt_parse,
.print = rt_print,
.save = rt_save,