[wpkg-users] Strange behaviour when selecting hosts

Rainer Meier r.meier at wpkg.org
Sun Aug 23 23:11:43 CEST 2009


Hi Lukasz

Lukasz Zalewski wrote:
> Thx a lot for clarifying things, i was not aware of direct ip matching
> and assumed ip address i specified was a regexp. I think regexp support
> for IP adresses would be much desired :) and if implemented the order of
> matching you listed would still be preserved.
> Does ip matching currently supports ipaddr/netmask syntax either through
> x.x.x.x/24 or x.x.x.x/255.255.255.0?

There is not much difference in regexp matching for IP-adresses versus the
current implementation. An IP-address (IPv4) has a clearly definedstructure:
a.b.c.d
Where a, b, c and d are numbers between 0 and 255. The current implementation
supports expressionslike:
192.168.0-255.0-255
10.0-255.0-255.0-255

This is usually enough to match IPv4 addresses. A regular expression would not
allow much more flexibility.

The problem in your case is that the legacy algorithm does not go through all
host definitions and check for direct match, then IP and finally regexp on
hostname. It loops by method (first all expressions are direct-matched, then all
expressions are IP-address matched and then it starts over again and tries
regexp matching (if all matching before failed).

I might change this behavior for WPKG 1.2. If possible with IPv6 support. To
allow most flexibility I intend to implement an algorithm as follows:
- for each entry in hosts.xml
  - try direct (1:1) hostname matching
  - try direct (1:1) IPv4 matching
 (- try WPKG 1.x-style IP range matching)
  - try direct (1:1) IPv6 matching
  - try regexp hostname matching
  - try regexp IPv4 matching
  - try regexp IPv6 matching


Personally I never used IP-based matching. Especially in DHCP-based environments
it's not a good choice.

br,
Rainer



More information about the wpkg-users mailing list