From 0aed75d24d7beafdb41f51cfc6d6b46cd29bdf2c Mon Sep 17 00:00:00 2001 From: ae Date: Tue, 27 Nov 2018 14:03:40 +0000 Subject: [PATCH] MFC r340689: Make multiline APPLY_MASK() macro to be function-like. Reported by: cem --- sbin/ipfw/ipv6.c | 2 +- sys/netinet/ip_fw.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sbin/ipfw/ipv6.c b/sbin/ipfw/ipv6.c index 679be369389..e2d54c765ab 100644 --- a/sbin/ipfw/ipv6.c +++ b/sbin/ipfw/ipv6.c @@ -401,7 +401,7 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen, struct tidx *tstate) n2mask(&d[1], masklen); } - APPLY_MASK(d, &d[1]) /* mask base address with mask */ + APPLY_MASK(d, &d[1]); /* mask base address with mask */ av = q; diff --git a/sys/netinet/ip_fw.h b/sys/netinet/ip_fw.h index 06bc1d38db1..e6981a802d0 100644 --- a/sys/netinet/ip_fw.h +++ b/sys/netinet/ip_fw.h @@ -549,11 +549,12 @@ typedef struct _ipfw_insn_nat { } ipfw_insn_nat; /* Apply ipv6 mask on ipv6 addr */ -#define APPLY_MASK(addr,mask) \ +#define APPLY_MASK(addr,mask) do { \ (addr)->__u6_addr.__u6_addr32[0] &= (mask)->__u6_addr.__u6_addr32[0]; \ (addr)->__u6_addr.__u6_addr32[1] &= (mask)->__u6_addr.__u6_addr32[1]; \ (addr)->__u6_addr.__u6_addr32[2] &= (mask)->__u6_addr.__u6_addr32[2]; \ - (addr)->__u6_addr.__u6_addr32[3] &= (mask)->__u6_addr.__u6_addr32[3]; + (addr)->__u6_addr.__u6_addr32[3] &= (mask)->__u6_addr.__u6_addr32[3]; \ +} while (0) /* Structure for ipv6 */ typedef struct _ipfw_insn_ip6 { -- 2.45.0