Problem
With our IP-TV probes, there may occur an error message like "Multicast leave failed: Cannot assign requested address".
Reason is: leaving a multicast group with 'setsockopt' with 'optname' 'IP_DROP_MEMBERSHIP' failed. The system reports "Cannot assign requested address".
Solution
The root cause is usually a missing multicast route in the system routing table. It may be fixed quickly by setting a mutlicast default routing entry:
# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.19.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.19.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
0.0.0.0 10.19.2.252 0.0.0.0 UG 0 0 0 eth2
0.0.0.0 10.19.2.252 0.0.0.0 UG 0 0 0 eth0
The issue is, there is no clear routing rule for multicast for single interface. To solve the issue:
# route add -net 224.0.0.0 netmask 224.0.0.0 eth0