summaryrefslogtreecommitdiffstats
path: root/xtoptions.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2011-02-27 19:03:28 +0100
committerJan Engelhardt <jengelh@medozas.de>2011-04-06 13:12:55 +0200
commitdfe99f1bf291b4b954d3608dbe95a43e16a8bb49 (patch)
tree9110ff4ec68214bcda0ae4bf4da5c8c5ad7b2f72 /xtoptions.c
parentb18ffe3636b07cd817628de81643136e4755a944 (diff)
libxtables: XTTYPE_UINT8 support
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'xtoptions.c')
-rw-r--r--xtoptions.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/xtoptions.c b/xtoptions.c
index 6a119ec7..693c06d6 100644
--- a/xtoptions.c
+++ b/xtoptions.c
@@ -89,6 +89,8 @@ static void xtopt_parse_int(struct xt_option_call *cb)
unsigned int lmin = 0, lmax = UINT32_MAX;
unsigned int value;
+ if (entry->type == XTTYPE_UINT8)
+ lmax = UINT8_MAX;
if (cb->entry->min != 0)
lmin = cb->entry->min;
if (cb->entry->max != 0)
@@ -100,7 +102,11 @@ static void xtopt_parse_int(struct xt_option_call *cb)
"or out of range (%u-%u).\n",
cb->ext_name, entry->name, lmin, lmax);
- if (entry->type == XTTYPE_UINT32) {
+ if (entry->type == XTTYPE_UINT8) {
+ cb->val.u8 = value;
+ if (entry->flags & XTOPT_PUT)
+ *(uint8_t *)XTOPT_MKPTR(cb) = cb->val.u8;
+ } else if (entry->type == XTTYPE_UINT32) {
cb->val.u32 = value;
if (entry->flags & XTOPT_PUT)
*(uint32_t *)XTOPT_MKPTR(cb) = cb->val.u32;
@@ -108,10 +114,12 @@ static void xtopt_parse_int(struct xt_option_call *cb)
}
static void (*const xtopt_subparse[])(struct xt_option_call *) = {
+ [XTTYPE_UINT8] = xtopt_parse_int,
[XTTYPE_UINT32] = xtopt_parse_int,
};
static const size_t xtopt_psize[] = {
+ [XTTYPE_UINT8] = sizeof(uint8_t),
[XTTYPE_UINT32] = sizeof(uint32_t),
};