From owner-freebsd-ipfw Mon Feb 28 16:36:37 2000 Delivered-To: freebsd-ipfw@freebsd.org Received: from ns.itga.com.au (ns.itga.com.au [202.53.40.210]) by hub.freebsd.org (Postfix) with ESMTP id 7C31D37B9CC; Mon, 28 Feb 2000 16:36:29 -0800 (PST) (envelope-from gnb@itga.com.au) Received: from lightning.itga.com.au (lightning.itga.com.au [192.168.71.20]) by ns.itga.com.au (8.9.3/8.9.3) with ESMTP id LAA11065; Tue, 29 Feb 2000 11:36:25 +1100 (EST) (envelope-from gnb@itga.com.au) Received: from itga.com.au (lightning.itga.com.au [192.168.71.20]) by lightning.itga.com.au (8.9.3/8.9.3) with ESMTP id LAA23453; Tue, 29 Feb 2000 11:36:19 +1100 (EST) Message-Id: <200002290036.LAA23453@lightning.itga.com.au> X-Mailer: exmh version 2.0.1 12/23/97 From: Gregory Bond To: Jim Bloom Cc: Kai =?iso-8859-1?Q?Gro=DFjohann?= , freebsd-current@FreeBSD.ORG, freebsd-ipfw@FreeBSD.ORG Subject: Re: cpp change breaks ipfw In-reply-to: Your message of Mon, 28 Feb 2000 09:18:44 -0500. Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Date: Tue, 29 Feb 2000 11:36:19 +1100 Sender: owner-freebsd-ipfw@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > #define addr 192.186.2.5 > #define mask 255.255.240.0 > = > #define rule(ADDR,MASK) add pass tcp from ADDR ## : ## MASK to any 25 s= etup > rule(addr,mask) This is a well-known artifact of the ANSI C rules. You need to do two le= vels = of macro in order to get the macro args expanded in the paste operator: #define addr 1.2.3.4 #define mask 255.255.255.0 #define hn(A,M) A ## : ## M #define rule(A,M) add pass tcp from hn(A,M) to any 25 setup rule(addr, mask) which produces add pass tcp from 1.2.3.4:255.255.255.0 to any 25 setup = when fed through an ANSI preprocessor (i.e. not "gcc -E" and not /usr/bin= /cpp on 3.x!). This also works if (e.g.) addr is defined on the command line.= To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ipfw" in the body of the message