summaryrefslogtreecommitdiffstats
path: root/libxtables
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2023-12-17 15:10:15 +0100
committerPhil Sutter <phil@nwl.cc>2024-01-10 16:07:30 +0100
commit810f8568f44f5863c2350a39f4f5c8d60f762958 (patch)
tree06fcabcc577f937d22e090be877cf527753dc127 /libxtables
parent122300a6fff9892b697f8900a7f84e94bac151ee (diff)
libxtables: xtoptions: Implement XTTYPE_ETHERMACMASK
Accept an Ethernet MAC address with optional mask in the format xtables_parse_mac_and_mask() expects it. Does not support XTOPT_PUT (for now) due to the lack of defined data structure.
Diffstat (limited to 'libxtables')
-rw-r--r--libxtables/xtoptions.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libxtables/xtoptions.c b/libxtables/xtoptions.c
index 5a432ea1..7a0e44b3 100644
--- a/libxtables/xtoptions.c
+++ b/libxtables/xtoptions.c
@@ -791,6 +791,15 @@ static void xtopt_parse_ethermac(struct xt_option_call *cb)
xt_params->exit_err(PARAMETER_PROBLEM, "Invalid MAC address specified.");
}
+static void xtopt_parse_ethermacmask(struct xt_option_call *cb)
+{
+ memset(cb->val.ethermacmask, 0xff, ETH_ALEN);
+ if (xtables_parse_mac_and_mask(cb->arg, cb->val.ethermac,
+ cb->val.ethermacmask))
+ xt_params->exit_err(PARAMETER_PROBLEM,
+ "Invalid MAC/mask address specified.");
+}
+
static void (*const xtopt_subparse[])(struct xt_option_call *) = {
[XTTYPE_UINT8] = xtopt_parse_int,
[XTTYPE_UINT16] = xtopt_parse_int,
@@ -813,6 +822,7 @@ static void (*const xtopt_subparse[])(struct xt_option_call *) = {
[XTTYPE_PLEN] = xtopt_parse_plen,
[XTTYPE_PLENMASK] = xtopt_parse_plenmask,
[XTTYPE_ETHERMAC] = xtopt_parse_ethermac,
+ [XTTYPE_ETHERMACMASK]= xtopt_parse_ethermacmask,
};
/**