When struct ip_mreqn is passed to IP_MULTICAST_IF setsockopt option it is
always required to set also ipv4 source address. Otherwise Linux kernel
will choose default system multicast ipv4 address which does not have to
belong to chosen interface specified in struct ip_mreqn.
Therefore on system with more multicast interfaces and more ipv4 addresses,
it may happen that interface chosen by upnpc -m option would use ipv4
address which does not belong to this interface.
This change is fixing above issue and ensure that if interface is chosen by
upnpc -m option then source address which belongs to this interface would
be used.
Without this change upnpc -m eth1 can send multicast traffic over interface
eth1 but with source ipv4 address of interface eth0, which obviously would
be rejected by upnp gateway.
Option listen= is used for LAN interface/address and option ext_addr= is
used for public IP address. If users by mistake swap WAN and LAN interface
or public and private IP addresses then miniupnpd obviously would not work
and instead of hacking miniupnpd code users should rather check their
miniupnpd configuration or local firewall settings.
So add checks and hints which prevents security issues like swapping LAN
and WAN interfaces/addresses and therefore prevent exposing port forwarding
and firewall configuration on public Internet.
miniupnpc::miniupnpc becomes an ALIAS for the shared library, if
available, and the static library otherwise.
Users of the installed library can use MINIUPNPC_USE_STATIC_LIBS to
force the use of the static library.
GetBestInterfaceEx() is not supported by older i586-mingw32msvc-gcc
compiler. GetBestInterface() works only with IPv4 addresses but in this
case it is enough as it is needed only for IP address 223.255.255.255.
Older version of i586-mingw32msvc-gcc compiler does not define
_WIN32_WINNT_VISTA macro. Therefore preprocessor #if condition is
incorrectly evaluated.