Loading...
 

xPL-Perl



xPL-Perl seems to be focused on *nix platforms. It does not, as far as I can tell, support Windows. I'll attempt to add Windows support since one of my goals is to use a framework that works on both platforms. It looks like there are some basic network layer incompatibilities in the Perl source. The Base.pm code uses the *nix "ifconfig" command to get a list of IP interfaces and properties. This needs to be augmented to use the Win32 "ipconfig" program. Also it appears that the xPL-Perl source tries to bind to the network broadcast address. This appears to work fine in *nix but fails in Win32. It turns out that this is topic is an area that is quite inconsistent between xPL applications and frameworks. I made up some theories and tests to prove those theories below. If I'm right, xPL-Perl should be changed to bind only to the host IP and not to the network broadcast. My concern is that this may cause other parts of the code (e.g. packet reception checks) to break.



Notes on IP broadcast


Notes for IP broadcast sending and reception

1) bind to the address you want to use for the source address when sending (192.168.1.69) or (INADDR_ANY) to let the stack pick.
2) send to the address you want to use as the destination address for the packets (192.168.1.255) or (255.255.255.255, INADDR_BROADCAST). When this message is received by an IP stack, a socket bound and listening to any IP on the destination subnet should get a copy of the message (i.e. sent to 192.168.1.255 or 255.255.255.255 will be received by a socket bound to 192.168.1.69).

From what I can tell the applications should not be binding to the broadcast addresses. It seems that windows does not allow this where as linux does. Hoever I honestly do not see the purpose of binding to a broadcast address. The problem that might interfere with this logic is that some of the xPL frameworks and applications try to match the IP destination address when processing incoming messages. Those matches might fail if the logic does not take into count all the ways that the destination broadcast address can be specified.


Tests to verify:
Each test should be run on both linux and windows (mac OS would be great but I don't have such a box).

one host ip on a subnet; receiving on same host
send from host ip to the network broadcast; receive on socket bound to host ip and to socket bound to INADDR_ANY
send from host ip to the INADDR_BROADCAST; receive on socket bound to host ip and to socket bound to INADDR_ANY
repeat for receiving on different hosts

bind same host bind different host
send host ip INADDR_ANY host ip INADDR_ANY
Linux / net broadcast
Linux / INADDR_BROADCAST
Win32 / net broadcast
Win32 / INADDR_BROADCAST


two host ips on a subnet; receiving on same host
send from one host ip to the network broadcast; receive on socket bound to both host ips and on socket bound to INADDR_ANY
send from one host ip to INADDR_BROADCAST; receive on socket bound to both host ips and on socket bound to INADDR_ANY

repeat for receiving on different hosts

bind same host bind different host
send host ip1 host ip2 INADDR_ANY host ip1 host ip2 INADDR_ANY
Linux / net broadcast
Linux / INADDR_BROADCAST
Win32 / net broadcast
Win32 / INADDR_BROADCAST




Other similar tests can be conducted on a host with multiple host IPs on different subnets. Here it should be verified how other hosts on the same network receive the packets. The theory is that a network broadcast is only sent on the one network targeted and only received by hosts on that network (including the sending host); while all network broadcast is sent on both networks and received by everyone. In the tests below ip1 and ip2 are on different subnets.

host ips on two subnets; receiving on same host
send from one host ip to the network broadcast; only receive on socket bound to the host ip on that subnet and on socket bound to INADDR_ANY
send from one host ip to INADDR_BROADCAST; receive on both sockets bound to the host ips and on socket bound to INADDR_ANY

repeat for receiving on different hosts

bind same host bind different host
send host ip1 host ip2 INADDR_ANY host ip1 host ip2 INADDR_ANY
Linux / net broadcast
Linux / INADDR_BROADCAST
Win32 / net broadcast
Win32 / INADDR_BROADCAST

Contributors to this page: michael .
Page last modified on Wednesday 28 of April, 2010 10:06:06 CDT by michael.