Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Nov 2018 18:38:29 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340689 - in head: sbin/ipfw sys/netinet
Message-ID:  <201811201838.wAKIcTEs049094@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Tue Nov 20 18:38:28 2018
New Revision: 340689
URL: https://svnweb.freebsd.org/changeset/base/340689

Log:
  Make multiline APPLY_MASK() macro to be function-like.
  
  Reported by:	cem
  MFC after:	1 week

Modified:
  head/sbin/ipfw/ipv6.c
  head/sys/netinet/ip_fw.h

Modified: head/sbin/ipfw/ipv6.c
==============================================================================
--- head/sbin/ipfw/ipv6.c	Tue Nov 20 18:14:30 2018	(r340688)
+++ head/sbin/ipfw/ipv6.c	Tue Nov 20 18:38:28 2018	(r340689)
@@ -401,7 +401,7 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen, stru
 				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;
 

Modified: head/sys/netinet/ip_fw.h
==============================================================================
--- head/sys/netinet/ip_fw.h	Tue Nov 20 18:14:30 2018	(r340688)
+++ head/sys/netinet/ip_fw.h	Tue Nov 20 18:38:28 2018	(r340689)
@@ -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 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811201838.wAKIcTEs049094>