Hello everybody, for testing purposes I need to modify the source address of IGMP V2 membership report messages. I gave my machine an additional IP address and a route to a local router 192.168.213.1 (for testing): fook:/home/penz # ip addr 1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 brd 127.255.255.255 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:e0:18:a6:7b:dc brd ff:ff:ff:ff:ff:ff inet 137.226.12.188/24 brd 137.226.12.255 scope global eth0 inet 192.168.213.188 peer 192.168.213.1/32 scope global eth0 inet6 fe80::2e0:18ff:fea6:7bdc/64 scope link valid_lft forever preferred_lft forever 3: sit0: <NOARP> mtu 1480 qdisc noqueue link/sit 0.0.0.0 brd 0.0.0.0 fook:/home/penz # route Kernel IP Routentabelle Ziel Router Genmask Flags Metric Ref Use Iface 192.168.213.1 * 255.255.255.255 UH 0 0 0 eth0 192.168.213.0 192.168.213.1 255.255.255.0 UG 0 0 0 eth0 137.226.12.0 * 255.255.255.0 U 0 0 0 eth0 link-local * 255.255.0.0 U 0 0 0 eth0 loopback * 255.0.0.0 U 0 0 0 lo default routus.informat 0.0.0.0 UG 0 0 0 eth0 Now when an application joins a multicast group on interface 192.168.213.188, an IGMP membership report is sent, but with source address 137.226.12.188. I wrote a little test routine (see below) and wonder how the source address for IGMP packets is chosen by the kernel. For my purpose I need the source address 192.168.213.188. Can anybody tell me how to set this up? Thanks in advance, Stefan Test routine: #include <unistd.h> #include <string.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> #define RESERVED_PORT 50427 #define MCAST_ADDR "239.255.254.253" #define IF_ADDR "192.168.213.188" int main() { int sockfd; struct ip_mreq mreq; struct sockaddr_in mysockaddr; struct in_addr ifaddr; memset(&mysockaddr, 0, sizeof(mysockaddr)); mysockaddr.sin_family = AF_INET; mysockaddr.sin_port = htons(RESERVED_PORT); mysockaddr.sin_addr.s_addr = inet_addr(MCAST_ADDR); memset(&ifaddr, 0, sizeof(ifaddr)); ifaddr.s_addr = inet_addr(IF_ADDR); sockfd = socket(PF_INET, SOCK_DGRAM, 0); bind(sockfd, (struct sockaddr *) &mysockaddr, sizeof(mysockaddr)); memcpy(&mreq.imr_multiaddr, &(mysockaddr.sin_addr), sizeof(struct in_addr)); memcpy(&mreq.imr_interface, &ifaddr, sizeof(struct in_addr)); setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_IF, &ifaddr, sizeof(ifaddr)); setsockopt(sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)); sleep(2); return 0; } -- Dipl.-Inform. Stefan Penz Aachen University of Technology Computer Science Department Informatik IV (Communication and Distributed Systems) Ahornstr. 55, D-52074 Aachen, Germany Tel.: +49 (241) 80-21424 Fax: +49 (241) 80-22220 EMail: penz@cs.rwth-aachen.de - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html