dhcpd code changes
Ashmath Khan
hashmat.email at gmail.com
Sun Nov 15 15:38:15 UTC 2009
Thanks David.
I already did the code changes to supprt <= and >= and they seem to be
working.
On Sat, Nov 14, 2009 at 5:42 AM, David W. Hankins <dhankins at isc.org> wrote:
> On Fri, Nov 13, 2009 at 02:19:49PM +0530, Ashmath Khan wrote:
> > > Right. But <= is currently not supported by ISC DHCP.
> > thanks.
>
> One of the sad results of knowing multiple human languages is that you
> find yourself switching between them sometimes, to everyone's surprise.
>
> It seems I just did that with DHCP's config-programming-language and
> C...
>
> Ohwell, let's try this again in valid DHCP syntax this time;
>
> class "0-11" {
> # Ethernet hardware addresses where the last three octets are
> # between 0x00 and 0x11 inclusive.
> match if (extract-int(substring(hardware, 0, 1), 8) = 1 and
> (((extract-int(suffix(hardware, 4), 32) &
> 15790320) = 0) or # 0xf0f0f0
> ((extract-int(suffix(hardware, 4), 32) &
> 15790318) = 0) or # 0xf0f0ee
> ((extract-int(suffix(hardware, 4), 32) &
> 15789808) = 0) or # 0xf0eef0
> ((extract-int(suffix(hardware, 4), 32) &
> 15789806) = 0) or # 0xf0eeee
> ((extract-int(suffix(hardware, 4), 32) &
> 15659248) = 0) or # 0xeef0f0
> ((extract-int(suffix(hardware, 4), 32) &
> 15659246) = 0) or # 0xeef0ee
> ((extract-int(suffix(hardware, 4), 32) &
> 15658736) = 0) or # 0xeeeef0
> ((extract-int(suffix(hardware, 4), 32) &
> 15658734) = 0))); # 0xeeeeee
> }
>
> Which is admittedly ugly. So you may prefer capitalizing on integer
> rounding on divide instead (extract-int is unsigned);
>
> class "0-11" {
> # Ethernet hardware addresses where the last three octets are
> # between 0x00 and 0x11 inclusive.
> match if (extract-int(substring(hardware, 0, 1), 8) = 1 and
> (((extract-int(substring(hardware, 4, 1), 8) / 18) = 0) and
> ((extract-int(substring(hardware, 5, 1), 8) / 18) = 0) and
> ((extract-int(substring(hardware, 6, 1), 8) / 18) = 0)));
> }
>
> 0x11 is 17, so 17 / 18 will produce a zero. 0x12 is 18, so 18/18 will
> produce a 1 and fail the equal operator.
>
> --
> David W. Hankins "If you don't do it right the first time,
> Software Engineer you'll just have to do it again."
> Internet Systems Consortium, Inc. -- Jack T. Hankins
>
> _______________________________________________
> dhcp-workers mailing list
> dhcp-workers at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-workers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-workers/attachments/20091115/9429dfbf/attachment.html>
More information about the dhcp-workers
mailing list