From a10eb8861c8fdc8894a8c2f6baf4dd791d5ab4f0 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Mon, 5 Nov 2018 11:46:02 +0100 Subject: extensions: libebt_ip: fix tos negation passing ->tos as uintmax_t will clear adjacent fields in the structure, including invflags. Fixes: 49479aa12a15 ("ebtables-compat: add 'ip' match extension") Signed-off-by: Florian Westphal --- extensions/libebt_ip.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'extensions/libebt_ip.c') diff --git a/extensions/libebt_ip.c b/extensions/libebt_ip.c index 2b28c615..acb9bfcd 100644 --- a/extensions/libebt_ip.c +++ b/extensions/libebt_ip.c @@ -424,14 +424,17 @@ brip_parse(int c, char **argv, int invert, unsigned int *flags, info->igmp_type, NULL); info->bitmask |= EBT_IP_IGMP; break; - case IP_EBT_TOS: + case IP_EBT_TOS: { + uintmax_t tosvalue; + if (invert) info->invflags |= EBT_IP_TOS; - if (!xtables_strtoul(optarg, NULL, (uintmax_t *)&info->tos, - 0, 255)) + if (!xtables_strtoul(optarg, NULL, &tosvalue, 0, 255)) xtables_error(PARAMETER_PROBLEM, "Problem with specified IP tos"); + info->tos = tosvalue; info->bitmask |= EBT_IP_TOS; + } break; case IP_PROTO: if (invert) -- cgit v1.2.3