#103 Problem with several Interfaces having the same IP

Unstable (example)
open
ip_mreqn (1)
1
2013-08-24
2013-08-24
pericles944
No

Situation:
Simple LAN, eth0, Server is 192.168.0.1/24
In addition there are some ppp-interfaces having "192.168.0.1 Ptp xxx.xxx.xxx.xxx"
(or some openvpn tun-interfaces having "192.168.0.1 Ptp xxx.xxx.xxx.xxx")
Linux kernel is 3.2.45
minidlna ist configured to serve eth0.
=> minidlna will NOT work at all in this lan !

Problem:
minidlna examines the IP-addresses at startup only, even if you configure the devices.
Later in startup minidlna use the ip-addresses in setsockopt(...,IP_ADD_MEMBERSHIP,..).
With older kernels everythings was ok, 'cause the net-devices was sorted by the kernel and
the ethX-devices got the membership.
With newer kernels the list of the net-devices is unsorted and the membership
will be bound to the first net-device match.
in my case the membership was bound to tun5 !

Solution:
minidlna uses a really very old struct to add the membership: ip_mreq (without device-support)
i've simply added to keep while startup the net-device index and added the membership
with the newer struct ip_mreqn with the appropriate device-index.

Note:
Patch is against 1.0.24 (Debian stable), but the problem exists in newer versions also.

1 Attachments

Discussion