[Dnsmasq-discuss] IP address based on switch port number (option 82)

Simon Kelley simon at thekelleys.org.uk
Thu Feb 18 10:31:03 GMT 2010


richardvoigt at gmail.com wrote:

> as long as you're not going to prohibit
> 
> tag-if set:hipower tag:uv
> tag-if set:hipower tag:violet
> tag-if set:hipower tag:indigo
> tag-if set:hipower tag:blue
> 
> tag-if set:visible tag:violet
> tag-if set:visible tag:indigo
> tag-if set:visible tag:blue
> tag-if set:visible tag:green
> tag-if set:visible tag:yellow
> tag-if set:visible tag:orange
> tag-if set:visible tag:red
> 
> which means
> 
> hipower := blue + indigo + violet + uv;
> visible := violet + indigo + blue + green + yellow + orange + red;
> 
> and then you could e.g. assign a dhcp pool to tag:visible while
> assigning a default gateway to tag:hipower (and a different one to
> tag:!hipower), and then assign a different bootp image for each color
> individually.

No that's allowed.

I also decided that it was more useful to make

tag-if = set:true

work and set the tag "true" than to be a no-op. Maybe useful for debugging.
> 
> Actually, instead of prohibiting use of tags set by tag-if for further
> tag-if, I think it's more reasonable to execute the lines in order and
> generate a warning if there's any attempted backpropagation.  I mean,
> build a cumulative list of tags which appear on the condition side
> (tag:xyz) of tag-if lines.  If any tag-if would set:xyz when xyz is in
> the list of matched tags, warn.  But allow this:
> 
> tag-if set:F tag:A,tag:B
> tag-if set:F tag:C
> tag-if set:G tag:F,tag:D
> 
> which yields
> G := ((A*B) + C) * D;
> 
> without recursive parsing.
> 
> But then warn if a later line contained:
> tag-if set:D (any condition here)
> 
> because D is already tested in a tag-if
> 

Hmm, need to keep a list of tags test and found not-set.

> Of course this isn't really necessary, we can expand to
> sum-of-products as follows:
> G := (A*B*D) + (C*D);

Simpler not bother then. Especially as this would be the only place
anywhere in the config file where order really mattered
> 
> and get the same result via non-iterative conditional tagging:
> 
> tag-if set:G tag:A,tag:B,tag:D
> tag-if set:G tag:C,tag:D
> 
Simon.



More information about the Dnsmasq-discuss mailing list