Open crass opened 4 years ago
I had the same problem, but I could solve it by some simple modification of the code.
I have IP aliases on the interfaces, but iptables does not really like that: I changed the executed iptables commands not to use the aliases, but rather the main interface's names. Actually, it is a bit more complicated in our case: we have bonded interfaces with tagged VLAN's and aliases on those, but it works.
Also, we have a quite strict firewall, which does not forward anything from the internal networks to the external without me saying so (positive port filtering). So I had to add another forward rule allowing the internal IP address to answer the requests coming from the internet.
Although starting the UPNP daemon says that it listens on 0.0.0.0:1900, it is actually bound to the interface (or ip address) of your choice given as a parameter for UpnpInit2 (or UpnpInit). Therefore you can start many instances of the UPNP daemon on the interfaces you would like to. It might be confusing to see many listening processes on 0.0.0.0:1900, but it works well. For this to work, I also needed different configuration files, but the configuration file can also be included as an option for the UPNP daemon.
I hope this helps.
Any updates on this? I'm hitting issues with this with keepalived and gerbera, when I have multiple IPs on one interface.
I am having the same issue here. I have multiple IPs on one interface and would like to advertise on both at the same time
We need someone interested in implementing this feature. Patches are always welcome, but unfortunately I do not currently have the resources to develop it.
We also need more tests in github actions to be sure we don't break stuff when implementing new features.
Best regards.
We live in a multihomed, multi-interface world now, and it would be nice if pupnp also lived there with us. What if I want to listen on a wired and a wireless interface, or two wired interfaces or one wired interface with two IP addresses but have replies come from the second associated address on the interface (I actually do for a gerbera server on a multi-homed interface!). This isn't possible today with pupnp. My two options right now are
UpnpInit(const char *HostIP, unsigned short DestPort)
andUpnpInit2(const char *IfName, unsigned short DestPort)
. So I get to choose to listen either on one IP with the interface inferred or one interface where the IP selected can not be controlled by the user, andUpnpInit
is supposedly deprecated.Perhaps there could be a
UpnpAddIPAddress(const char *HostIP)
and aUpnpAddIPAddress(const char *IfName, const char *HostIP)
whereHostIP==NULL
in the later call would mean that the first address on that interface is replied from.Alternatively or in addition to the above (ideally both), a
UpnpInit3(const char **IfNameHostIPList, unsigned short DestPort)
could be added. IfNameHostIPList is a null-pointer terminated array of pointers to a null-pointer terminated array of size 1 or 2 where if the array is length 1 it contains a pointer to an interface name and if length 2 it contains a pointer to an interface name and a pointer to an IP address string. If just an interface name, then the first ip address associated with the interface is listened on (like is done now inUpnpInit2
). And if an {interface, IP address} pair is given, then just the specified IP on that interface is replied from.A cursory look at the code appears to suggest this is a non-trivial undertaking, but I think it would be great to have this feature.