tags:

views:

80

answers:

2

Can I send out IGMP packets with a PHP script? Is IGMP even on the Transport Layer?

I was looking at some JOIN packets that are destined for 224.0.0.251.

I noticed that the IP header had no port assigned but did have MAC addresses specified, which led me to believe that IGMP was not on the Transport Layer but rather on the Network Layer. (hopefully I said that right)

Can someone clarify this for me? I'm just trying to send out a JOIN packet.

I was reading through rfc3376 to try and find the answer, but it just shows how to construct one. On trying to do so, I just get a malformed packet.

A: 

Probably not with existing PHP means. Existing extensions allow you access to TCP/UDP layer but not below. You probably could use some command-line tool like nemesis-igmp from Nemesis project to do it.

StasM
A: 

Traditionally you would use the socket option IP_ADD_MEMBERSHIP (and the corresponding IP_DROP_MEMBERSHIP) to join a multicast group. That would trigger the operating system to generate an IGMP join packet.

These options are set using the IPPROTO_IP "level" to setsockopt()

According to this issue on the bugs.php.net site these options are not available by default. However there is a patch listed on that page that should add them to your php installation.

Andrew Edgecombe