1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

Make multiline APPLY_MASK() macro to be function-like.

Reported by:	cem
MFC after:	1 week
This commit is contained in:
Andrey V. Elsukov 2018-11-20 18:38:28 +00:00
parent 9ed1e4ecd4
commit 5786c6b9f9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=340689
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -551,11 +551,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 {