From: Phil Sutter Date: Wed, 12 Oct 2022 00:25:04 +0000 (+0200) Subject: extensions: libebt_mark: Use guided option parser X-Git-Tag: v1.8.11~106 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ee315943000675420c7b1daa143071187546c27b;p=thirdparty%2Fiptables.git extensions: libebt_mark: Use guided option parser --- diff --git a/extensions/libebt_mark.c b/extensions/libebt_mark.c index 40e49618..0dc598fe 100644 --- a/extensions/libebt_mark.c +++ b/extensions/libebt_mark.c @@ -12,27 +12,39 @@ #include #include #include -#include #include #include #include "iptables/nft.h" #include "iptables/nft-bridge.h" -#define MARK_TARGET '1' -#define MARK_SETMARK '2' -#define MARK_ORMARK '3' -#define MARK_ANDMARK '4' -#define MARK_XORMARK '5' -static const struct option brmark_opts[] = { - { .name = "mark-target",.has_arg = true, .val = MARK_TARGET }, +enum { + O_SET_MARK = 0, + O_AND_MARK, + O_OR_MARK, + O_XOR_MARK, + O_MARK_TARGET, + F_SET_MARK = 1 << O_SET_MARK, + F_AND_MARK = 1 << O_AND_MARK, + F_OR_MARK = 1 << O_OR_MARK, + F_XOR_MARK = 1 << O_XOR_MARK, + F_ANY = F_SET_MARK | F_AND_MARK | F_OR_MARK | F_XOR_MARK, +}; + +static const struct xt_option_entry brmark_opts[] = { + { .name = "mark-target",.id = O_MARK_TARGET, .type = XTTYPE_STRING }, /* an oldtime messup, we should have always used the scheme * -