IPv6 Multicast Interface: mif6{} Structure (IPv6 Multicasting)

The KAME kernel maintains a separate data structure for interfaces that are used in multicast forwarding. These interfaces are called multicast interfaces. The corresponding notion in the IPv4 multicast routing implementation is called virtual interfaces, since the implementation was originally developed for DVMRP, which used tunneling to bypass routers that do not support the protocol. Since DVMRP is not defined for IPv6 multicast routing, there is no need for the built-in notion of virtual interfaces in the IPv6 implementation, and the interfaces are simply called multicast interfaces.

Yet a special interface, called the Register interface, is reserved for the PIM Register message processing. The Register interface is implemented as an ifnet{} structure just like any other network interface. The Register interface, however, is only available in the IPv6 multicast forwarding code, i.e., ip6_mroute.c, and is not linked in the global ifnet{} chain(*).

(*) Recent versions of FreeBSD link the Register structure into the global chain as a side effect of calling common initialization functions for ifnet{} structures.

An IPv6 multicast interface corresponds to one network interface in the kernel, and stores information specific to multicast forwarding. The set of multicast interfaces is a subset of the entire network interfaces installed in the kernel with one exception, the Register interface.


Each multicast interface is described by an instance of the mif6{} structure. The structure definition is given in Listing 2-16.

Listing 2-16

Listing 2-16

The only currently defined flag for the m6_flags member is the MIFF_REGISTER flag, which marks the multicast interface as being the Register interface. The m6_ifp member points to the corresponding network interface or the Register interface. The m6_pkt_in, m6_pkt_out, m6_bytes_in and m6_bytes_out members are per-interface statistics variables used by the routing daemon. The other members of the structure are not in use by the KAME IPv6 implementation at the time of this writing.

Figure 2-20 shows the relationship between data structures and global variables related to multicast interfaces. All mif6{} structures are stored in a global array named mif6table. This array currently has a fixed size of 64. The number of configured mif6{} structures is stored in a file-scope global variable nummifs. When the Register interface is configured, the corresponding array index in mif6table is stored in a file-scope global variable reg_mif_num. The ifnet{} structure for the Register interface is statically allocated via a global variable of multicast_register_if. Note that the if_index member of the Register interface is set to the array index in mif6table, which is irrelevant to the normal ifnet{} structure that has the same index.

FIGURE 2-20

FIGURE 2-20

Next post:

Previous post: