IGMP

Jump to: navigation, search

Table of Contents >> Optional Protocols


Introduction

IP multicasting is the transmission of an IP datagram to a "host group", a set of zero or more hosts identified by a single IP destination address. A host group IP address is a multicast IP address, or class D IP address, where the first 4 bits of the address are 1110. The range of host group IP addresses (class D) are from 224.0.0.1 to 239.255.255.255. Class D addresses starting with 224.0.0.x and 224.0.1.x have been reserved for various permanent assignments (see RFC 1700). The range of addresses between 224.0.0.1 and 224.0.0.255 are local multicast addresses (i.e. they cannot be forwarded beyond the local subnet), and have been reserved for the use of routing protocols and other low-level topology discovery or maintenance protocols, such as gateway discovery and group membership recording. The membership of a host group is dynamic: hosts may join and leave groups at any time. IGMP (Internet Group Management Protocol) is the protocol used by IP hosts to report their multicast group memberships to multicast routers. Local host groups (224.0.0.0 through 224.0.0.255) memberships do not need to be reported, since as indicated above they cannot be forwarded beyond the local subnet. Without the IGMP protocol, a host can send multicast IP datagrams, but cannot receive any.


Description

The following RFC's are implemented in the Treck IGMP implementation:

We will describe the design of the IP multicasting, and the host IP IGMP protocol implementation in the Treck stack in detail.

Enabling the IGMP Code

To compile in the IGMP code you must define TM_IGMP in <trsystem.h>.


Sending Multicast Packets

Send API

Sending multicast packets does not require new API functions. The user uses the send and sendto functions on a UDP socket with a multicast IP address destination.


IP Outgoing Interface for Multicast Packets

The user can choose a per socket default interface to send multicast packets by using a new setsockopt() option (IPO_MULTICAST_IF) at the IPPROTO_IP level with the IP address of the outgoing interface as the option value. If the user does not specify a destination interface that way, then a default outgoing interface will be used, if, after having configured the interface, the user specified a system wide one, using the new tfSetMcastInterface() API. Otherwise, the multicast sendto() will fail.

IP TTL for Multicast Packets

By default, the IP layer will send a multicast packet with a TTL value of 1, unless the user changes the default multicast IP ttl value for the socket with setsockopt(). A TTL value of 1, will not allow the multicast IP datagram to be forwarded beyond the local subnet. The option IPO_MULTICAST_TTL at the IPPROTO_IP level has been added to setsockopt(), and getsockopt().


Mapping Multicast Addresses to Layer 2 Hardware Addresses

To enable multicast mapping from the IP multicast address to an Ethernet multicast address, the TM_DEV_MCAST_ENB flag must be set in the tfOpenInterface() flags parameter.


IGMP Protocol

Receiving UDP Multicast Packets

When a UDP datagram whose destination IP address is a multicast address, arrives on an interface from the network, we check that the host is a member of the multicast group on the interface it came in. A host is a member of a group address for a given interface, if it joined that multicast group.


Note Note: In order to receive multicast packets, the user must join a host group.


Joining a Host Group

To join a host group, a user socket application calls setsockopt with the IPO_ADD_MEMBERSHIP option at the IPPROTO_IP level. The option pointer points to a structure containing the IP host group address and the interface (defined by its IP address). It will return TM_EINVAL if the IP host group address is not a class D address or if there is no interface configured with the IP address stored in the structure. It will return TM_EADDRINUSE if there was a previous successful IPO_ADD_MEMBERSHIP call for that host group on the same interface. Otherwise, this is the first call to IPO_ADD_MEMBERSHIP for the pair. The IP host group address will be added to the interface. In order to enable reception of that multicast address, the Treck stack will call the interface driver specific ioctl() function. The driver specific ioctl() function is called with the TM_DEV_SET_MCAST_LIST flag value, optionPtr pointing to the list of Ethernet multicast addresses corresponding to all the IP host group addresses added so far, and optionLen indicating the number of those Ethernet multicast addresses. We keep track of the list of Ethernet multicast addresses, so that the driver does not have to.

With the addition of RFC 3678 (see New Treck Features), the user socket application may use the setsockopt() MCAST_JOIN_GROUP option at the IPPROTO_IP level.


Note Note: In order to receive multicast packets, the user must implement a section in drvIoctlFunc() to create a multicast address from a list of Ethernet addresses, and store that multicast address in the Ethernet chip. (See drvIoctlFunc() for details.)

Leaving a Host Group

To stop receiving multicast packets for a given host group destination on an interface, the user need to leave that host group on that interface by calling setsockopt with the IPO_DROP_MEMBERSHIP option at the IPPROTO_IP level. The option pointer points to a structure containing the IP host group address, and the interface (defined by its IP address). It will return TM_EINVAL if the IP host group address is not a class D address or if there is no interface configured with the IP address stored in the structure. It will return TM_ENOENT if there is no such host group on the interface. Otherwise, the IP Host group address will be deleted from the interface, and the Treck stack will call the interface driver specific ioctl() to update the list of Ethernet multicast addresses corresponding to the IP host group addresses that have been added and not dropped. The driver specific ioctl() function is called with the TM_DEV_SET_MCAST_LIST flag value, and with optionPtr pointing to the list of Ethernet multicast addresses corresponding to all the IP host group addresses added (and not dropped), and with optionLen indicating the number of those Ethernet multicast addresses. We keep track of the list of Ethernet multicast addresses so that the driver does not have to.

With the addition of RFC 3678 (see New Treck Features), the user socket application may use the setsockopt() MCAST_LEAVE_GROUP option at the IPPROTO_IP level.

Treck Stack Initialization of the IGMP Protocol

When a new interface is configured, the Treck stack will automatically join the 224.0.0.1 host group on that interface. If RIP is enabled, the Treck stack will also automatically join the 224.0.0.2 host group on that interface.


Limitations

This implementation is for IP hosts only. It does not include multicast routing.


Warning Warning: No loop back of multicast packets is allowed.

Function Calls


Table of Contents >> Optional Protocols