summaryrefslogtreecommitdiffstats
path: root/xtoptions.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2011-03-06 17:42:51 +0100
committerJan Engelhardt <jengelh@medozas.de>2011-04-13 18:09:26 +0200
commit0eff54bd407aae6b99c3b189d356929e399b5a38 (patch)
tree8934f4a6efe6432a4bd29ff241aa85b29ee2b4b4 /xtoptions.c
parent09631dc60ce41bc484a42fcf4d4ddf7036820bd1 (diff)
libxtables: XTTYPE_UINT16 support
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'xtoptions.c')
-rw-r--r--xtoptions.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/xtoptions.c b/xtoptions.c
index a74938fa..939e6860 100644
--- a/xtoptions.c
+++ b/xtoptions.c
@@ -92,6 +92,8 @@ static void xtopt_parse_int(struct xt_option_call *cb)
if (entry->type == XTTYPE_UINT8)
lmax = UINT8_MAX;
+ else if (entry->type == XTTYPE_UINT16)
+ lmax = UINT16_MAX;
else if (entry->type == XTTYPE_UINT64)
lmax = UINT64_MAX;
if (cb->entry->min != 0)
@@ -109,6 +111,10 @@ static void xtopt_parse_int(struct xt_option_call *cb)
cb->val.u8 = value;
if (entry->flags & XTOPT_PUT)
*(uint8_t *)XTOPT_MKPTR(cb) = cb->val.u8;
+ } else if (entry->type == XTTYPE_UINT16) {
+ cb->val.u16 = value;
+ if (entry->flags & XTOPT_PUT)
+ *(uint16_t *)XTOPT_MKPTR(cb) = cb->val.u16;
} else if (entry->type == XTTYPE_UINT32) {
cb->val.u32 = value;
if (entry->flags & XTOPT_PUT)
@@ -247,6 +253,7 @@ static void xtopt_parse_markmask(struct xt_option_call *cb)
static void (*const xtopt_subparse[])(struct xt_option_call *) = {
[XTTYPE_UINT8] = xtopt_parse_int,
+ [XTTYPE_UINT16] = xtopt_parse_int,
[XTTYPE_UINT32] = xtopt_parse_int,
[XTTYPE_UINT64] = xtopt_parse_int,
[XTTYPE_UINT8RC] = xtopt_parse_mint,
@@ -259,6 +266,7 @@ static void (*const xtopt_subparse[])(struct xt_option_call *) = {
static const size_t xtopt_psize[] = {
[XTTYPE_UINT8] = sizeof(uint8_t),
+ [XTTYPE_UINT16] = sizeof(uint16_t),
[XTTYPE_UINT32] = sizeof(uint32_t),
[XTTYPE_UINT64] = sizeof(uint64_t),
[XTTYPE_UINT8RC] = sizeof(uint8_t[2]),