Thanks David.<br>I already did the code changes to supprt <= and >= and they seem to be working.<br><br><div class="gmail_quote">On Sat, Nov 14, 2009 at 5:42 AM, David W. Hankins <span dir="ltr"><<a href="mailto:dhankins@isc.org">dhankins@isc.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On Fri, Nov 13, 2009 at 02:19:49PM +0530, Ashmath Khan wrote:<br>
> > Right. But <= is currently not supported by ISC DHCP.<br>
> thanks.<br>
<br>
</div>One of the sad results of knowing multiple human languages is that you<br>
find yourself switching between them sometimes, to everyone's surprise.<br>
<br>
It seems I just did that with DHCP's config-programming-language and<br>
C...<br>
<br>
Ohwell, let's try this again in valid DHCP syntax this time;<br>
<br>
class "0-11" {<br>
<div class="im"> # Ethernet hardware addresses where the last three octets are<br>
</div> # between 0x00 and 0x11 inclusive.<br>
match if (extract-int(substring(hardware, 0, 1), 8) = 1 and<br>
(((extract-int(suffix(hardware, 4), 32) &<br>
15790320) = 0) or # 0xf0f0f0<br>
((extract-int(suffix(hardware, 4), 32) &<br>
15790318) = 0) or # 0xf0f0ee<br>
((extract-int(suffix(hardware, 4), 32) &<br>
15789808) = 0) or # 0xf0eef0<br>
((extract-int(suffix(hardware, 4), 32) &<br>
15789806) = 0) or # 0xf0eeee<br>
((extract-int(suffix(hardware, 4), 32) &<br>
15659248) = 0) or # 0xeef0f0<br>
((extract-int(suffix(hardware, 4), 32) &<br>
15659246) = 0) or # 0xeef0ee<br>
((extract-int(suffix(hardware, 4), 32) &<br>
15658736) = 0) or # 0xeeeef0<br>
((extract-int(suffix(hardware, 4), 32) &<br>
15658734) = 0))); # 0xeeeeee<br>
}<br>
<br>
Which is admittedly ugly. So you may prefer capitalizing on integer<br>
rounding on divide instead (extract-int is unsigned);<br>
<br>
class "0-11" {<br>
<div class="im"> # Ethernet hardware addresses where the last three octets are<br>
</div> # between 0x00 and 0x11 inclusive.<br>
match if (extract-int(substring(hardware, 0, 1), 8) = 1 and<br>
(((extract-int(substring(hardware, 4, 1), 8) / 18) = 0) and<br>
((extract-int(substring(hardware, 5, 1), 8) / 18) = 0) and<br>
((extract-int(substring(hardware, 6, 1), 8) / 18) = 0)));<br>
}<br>
<br>
0x11 is 17, so 17 / 18 will produce a zero. 0x12 is 18, so 18/18 will<br>
produce a 1 and fail the equal operator.<br>
<font color="#888888"><br>
--<br>
David W. Hankins "If you don't do it right the first time,<br>
Software Engineer you'll just have to do it again."<br>
Internet Systems Consortium, Inc. -- Jack T. Hankins<br>
</font><br>_______________________________________________<br>
dhcp-workers mailing list<br>
<a href="mailto:dhcp-workers@lists.isc.org">dhcp-workers@lists.isc.org</a><br>
<a href="https://lists.isc.org/mailman/listinfo/dhcp-workers" target="_blank">https://lists.isc.org/mailman/listinfo/dhcp-workers</a><br></blockquote></div><br>