Sending multicast packet on a raw socket

Sending multicast packet on a raw socket

Post by Laurent Bourqu » Fri, 10 May 2002 05:56:29

Dear all,

I'm currently trying to write a small program which sends igmp query out on
my LAN. It is currently working fine under different version of FreeBSD.
Packets are sent out on the Network and I can see them arriving on my
different routers.
I compiled this program on Solaris 8 (using gcc 2.95.2). So far so good but
when I execute it there are no packets sent out on my networks !!!!

The call I do to send the packets is easy:

nbs = sendto(s,&pkt,sizeof(struct igmp),0,(struct sockaddr *)sa,salen);
  if ( nbs < 0 ) {
    perror("Sending query");
    return FALSE;

and creation of the socket is done like this:

  if ( lsq < 0 ) {
    perror("Creation of listening socket");
    return NULL;

Has any body any idea what the problem could be ? Should I configure smth
special on the socket in order to make it run under Solaris ?

Thank you in advance for any help

Laurent Bourqui
Grubenstrasse 7
CH-3322 Sch?nbhl
+41 (0)31 858 58 58


1. Send/Recv of ethernet packets useing raw sockets

Greetings Everyone !

Im looking for a tutorial, or explanations on useing raw sockets to
send and receive raw ethernet packets on linux.

Ive found some example of the basics, but there are caveats to the
process that dont seem to be documented. For example, how to
get the interface index given the ethernet device name, whether the
socket needs to be in blocking/non-blocking mode, can I simply
stuff a socket buffer on an interfaces outgoing queue without useing
the socket functions, relevant ioctls, etc, etc.

If anyone has any information or knows where I can find a tutorial
on this, please let me know.

Thanks !


p.s. I need to send raw ethernet frames for a new protocol im
developing. IP/UDP/TCP packets just doesnt cut it in this case.

2. child's parent PID is 1 ???

3. Sending Arp reply packets using packet-sockets on linux

4. modification time of a directory accessed but not modified

5. Linux Raw Socket for IP Multicast

6. RH6.0 won't boot after install!

7. PATCH for Multicast bug in RAW IP sockets 2.4.0

8. What does UNIX stand for ??

9. SPAK(Send PAcKets)- tools to send arbitrary packets

10. How to send Multicast packets

11. sample code that sends raw Ethernet packets?

12. sending Raw IP Packets

13. send raw packet from kernel module