On 11/26/2012 11:20 AM, Tom Eastep wrote: > On 11/26/2012 10:55 AM, Mr Dash Four wrote: >> >>>> Indeed. It works, though I have another question regarding macros: >>>> since these are included in the chain 'inline' so to speak, is it >>>> possible for a macro to get the name of the chain in which this >>>> particular macro is going to be 'inlined'? >>>> >>> >>> It would be possible but I don't think that it is desirable. >> Eh? Who decides what is "desirable" and what isn't? >> >> If I, as end-user, wish to create a macro, which has different switches >> for different chains (so that I switch them "on" and "off" if and when I >> well so please), I could do so, like: >> >> M_DROP >> ~~~~~~~ >> LOG >> NFLOG(1,0,1) - .... ${chain}_nflog_drop >> >> > ... > >> You may wish to leave the current implementation of a "macro" as it is >> and add a new type of action (call it inline action or whatever) and >> start afresh if that would be easier, instead of dragging the millstone >> of backward compatibility with you by sticking with the old "macro" >> definition. This, though, is a decision for you to make. > > I misunderstood your original request; I thought that you were asking > for the compiler to always qualify switch names by the chain name. > > What you are proposing above doesn't work in the general case, given the > current compiler architecture. Currently, variable expansion takes place > in the preprocessor which has no knowledge of chains, macros, etc. The > chain isn't known until the input line handed to it by the preprocessor > is parsed by rule processor. > > Within the body of a macro or an action, however, the chain name is > known. So if we limit the availability of $chain (or whatever we call > it), to macro and action bodies, would that meet your needs?
Actually, the chain name is only known within the body of an action or within a macro expansion occurring within the body of an action. -Tom -- Tom Eastep \ When I die, I want to go like my Grandfather who Shoreline, \ died peacefully in his sleep. Not screaming like Washington, USA \ all of the passengers in his car http://shorewall.net \________________________________________________ ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ Shorewall-devel mailing list Shorewall-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/shorewall-devel