preprocessor questions

Daniela dgw at liwest.at
Thu Dec 2 11:05:46 PST 2004


On Thursday 02 December 2004 16:03, Reinhard Haller wrote:
> Hi,
>
> I'm using cpp as preprocessor for my firewall rules.
>
> I'd problems specifying macros.
>
> #define RULE __LINE__
> #define ldap 389
> #define ldaps 636
> #define all_ldap 389,636
>
> sample1:
> add RULE pass tcp from 192.168.0.0/24 to any ldap,ldaps  setup
> keep-state
>
> sample2:
> add RULE pass tcp from 192.168.0.0/24 to any all_ldap  setup
> keep-state
>
> Sample 1 produces an error, while sample 2 is working. Why?

Are you using IPFW 2? If no, the problem is that the preprocessor adds leading 
and trailing spaces to the macro expansions. In C, this doesn't matter, but 
IPFW doesn't like it. If you absolutely need to keep it this way, use IPFW 2.
Or modify the preprocessor.



More information about the freebsd-ipfw mailing list