Broadcast address patch and interface selection fix

On Ubunutu 11.10 Server the broadcast address returned by getifaddrs() is
the same as the interface address. This patch derives the broadcast address
from the interface address and the netmask if this occurs.

Also fixed bug that would potentially choose the wireless interface over
the specified interface if it was encountered first.