Date: Tue, 18 May 1999 07:39:17 -0400 From: "Andrew Chalupka" <andcha@nortelnetworks.com> To: net@freebsd.org Subject: RE: RAW IP socket for IGMP packet.. Message-ID: <C51ED84B6F47D211917A0000F8BCBD11E7257B@zcard00g.ca.nortel.com>
next in thread | raw e-mail | index | archive | help
The problem here is that IGMP packets (and any other IP packets addressed to a multicast group), are also addressed to a group address *at the data link layer*. Normally, the kernel takes care of telling the data link layer to accept group-addressed frames when you join a mcast group. However, simply creating a raw socket with IPPROTO_IGMP is probably not sufficient to do that. Your best bet is to use libpcap to grab the IGMP packets. Andrew > -----Original Message----- > From: Youngsu Chae [SMTP:yschae@cc.gatech.edu] > Sent: Tuesday, May 18, 1999 4:44 AM > To: net@freebsd.org > Subject: RAW IP socket for IGMP packet.. > > Hi all, > > I've been struggling with raw ip socket to pick up IP/IGMP packet. > As I understand from the 'raw_ip.c' source code, if the following three > conditions are satisfied > > 1) open a raw ip socket with protocol value as IPPROTO_IGMP, > 2) do not bind local address, > 3) do not specify foreign address, > > then, the socket should get all the IP/IGMP packets with whatever > destination group addresses. > But, I couldn't get any IGMP packets.. > The only way I can get the IP/IGMP packet is to subscribe to a specific > group. > That gives me only the IGMP packets destined to the group. > How can I get all IGMP packets with raw ip socket? > I've also tested with protocol value IPPROTO_IP(0). > In this case it should pick up all IP packets except TCP/UDP (those > packets are handled only in kernel). > It picks up ICMP packets but not IGMPs. > > > The following is the code for opening raw IP socket for IGMP.. > /* get an IGMP socket */ > if ((igmp_socket = socket(AF_INET,SOCK_RAW,IPPROTO_IGMP)) < 0){ > panic ("socket() failed!"); > } > > k_hdr_include(TRUE); /* turn on header include option */ > k_set_rcvbuf(256*1024,48*1024); /* lots of input buffering */ > k_set_ttl(1); /* restrict multicasts to one hop */ > k_set_loop(FALSE); /* disable multicast loopback */ > > > Thanks, > > Y.Chae > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-net" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C51ED84B6F47D211917A0000F8BCBD11E7257B>