Hi all!

I'm trying to receive multicast packets sent using a tunnel.

int main()
{ int fd;
  struct ip_mreqn mreq;
  mreq.imr_multiaddr.s_addr = inet_addr("224.0.0.5");
  mreq.imr_address.s_addr = inet_addr("x.x.x.x");
  mreq.imr_ifindex = 8;
  int maxpktlen = 1500;
  if ((fd = socket(AF_INET,SOCK_RAW,OSPF_PROTOCOL)) == -1)
    panic("pkt::socket: socket error");
  setsockopt(fd,IPPROTO_IP,IP_ADD_MEMBERSHIP,&mreq,sizeof(mreq));
  unsigned char* buf = new unsigned char[maxpktlen];
  if (!buf)
    panic("pkt::receive: memory allocation error");
  n = recv(fd,buf,maxpktlen,0);
}

When mreq.imr_ifindex = 7 (eth2), everything works fine. 
With mreq.imr_ifindex = 8 (gre1), recv never returns. 

netstat says the nic is configured to recv these mcasts:
gondolin:~# netstat -g -n
IPv4 Group Memberships
Interface       RefCnt Group
--------------- ------ ---------------------
lo              1      224.0.0.1
eth0            1      224.0.1.1
eth0            1      224.0.0.1
eth1            1      224.0.0.1
eth2            1      224.0.0.1
gre1            1      224.0.0.5
gre1            1      224.0.0.1
gre2            1      224.0.0.1

tcpdump says it's receiving mcasts to 224.0.0.5:
gondolin:~# tcpdump -i gre1 -n
Kernel filter, protocol ALL, datagram packet socket
tcpdump: listening on gre1
12:11:27.211136 < x.x.x.x > 224.0.0.5: OSPFv2-hello 44: rtrid x.x.x.x
backbone [tos 0xc0]  [ttl 1]

I'm using kernel 2.2.13.

Does anyone know what i'm doing wrong?

Thank you for your help,

Eric.
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to