summaryrefslogtreecommitdiffstats
path: root/extensions/libxt_length.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/libxt_length.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/libxt_length.c')
-rw-r--r--extensions/libxt_length.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/extensions/libxt_length.c b/extensions/libxt_length.c
index 4f3a3318..6ea76465 100644
--- a/extensions/libxt_length.c
+++ b/extensions/libxt_length.c
@@ -26,7 +26,9 @@ static void length_parse(struct xt_option_call *cb)
xtables_option_parse(cb);
info->min = cb->val.u16_range[0];
- info->max = (cb->nvals == 2) ? cb->val.u16_range[1] : UINT16_MAX;
+ info->max = cb->val.u16_range[0];
+ if (cb->nvals >= 2)
+ info->max = cb->val.u16_range[1];
if (cb->invert)
info->invert = 1;
}