IGMP协议学习笔记(一)
进来在作IGMP协议栈的解析,简单记录如下:
IGMPV3 Types
There are two IGMP message types of concern to the IGMPv3 protocol
described in this document:
Type Number (hex) Message Name
----------------- ------------
0x11 Membership Query
0x22 Version 3 Membership Report
An implementation of IGMPv3 MUST also support the following three
message types, for interoperation with previous versions of IGMP (see
section 7):
0x12 Version 1 Membership Report [RFC-1112]
0x16 Version 2 Membership Report [RFC-2236]
IGMP V1 Query:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Version| Type | Unused | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Group Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
IGMP V2 Query:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type | Max Resp Time | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Group Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
IGMP V3 Membership Query Message: :
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type = 0x11 | Max Resp Code | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Group Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Resv |S| QRV | QQIC | Number of Sources (N) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Address [1] |
+- -+
| Source Address [2] |
+- . -+
. . .
. . .
+- -+
| Source Address [N] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Version 3 Membership Report Message
Version 3 Membership Reports are sent by IP systems to report (to
neighboring routers) the current multicast reception state, or
changes in the multicast reception state, of their interfaces.
Reports have the following format:
RFC 3376 IGMPv3 October 2002
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Type = 0x22 | Reserved | Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reserved | Number of Group Records (M) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Group Record [1] .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Group Record [2] .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| . |
. . .
| . |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Group Record [M] .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
where each Group Record has the following internal format:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Record Type | Aux Data Len | Number of Sources (N) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Multicast Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Address [1] |
+- -+
| Source Address [2] |
+- -+
. . .
. . .
. . .
+- -+
| Source Address [N] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Auxiliary Data .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Example:
Version 3 Membership Report Message
22 00 ea 03 | Type: 22, Checksum: ea 03
00 00 00 01 | Number of group recode 01
04 00 00 00 | Recode type: 04, Number of Sources: 00 00
ef ff ff fa | Multicast Addr: 239.255.255.250
Group Record Types
There are a number of different types of Group Records that may be
included in a Report message:
o A "Current-State Record" is sent by a system in response to a Query
received on an interface. It reports the current reception state
of that interface, with respect to a single multicast address. The
Record Type of a Current-State Record may be one of the following
two values:
Value Name and Meaning
----- ----------------
1 MODE_IS_INCLUDE - indicates that the interface has a
filter mode of INCLUDE for the specified multicast
address. The Source Address [i] fields in this Group
Record contain the interface's source list for the
specified multicast address, if it is non-empty.
2 MODE_IS_EXCLUDE - indicates that the interface has a
filter mode of EXCLUDE for the specified multicast
address. The Source Address [i] fields in this Group
Record contain the interface's source list for the
specified multicast address, if it is non-empty.
o A "Filter-Mode-Change Record" is sent by a system whenever a local
invocation of IPMulticastListen causes a change of the filter mode
(i.e., a change from INCLUDE to EXCLUDE, or from EXCLUDE to
INCLUDE), of the interface-level state entry for a particular
multicast address. The Record is included in a Report sent from
the interface on which the change occurred. The Record Type of a
Filter-Mode-Change Record may be one of the following two values:
3 CHANGE_TO_INCLUDE_MODE - indicates that the interface
has changed to INCLUDE filter mode for the specified
multicast address. The Source Address [i] fields
in this Group Record contain the interface's new
source list for the specified multicast address,
if it is non-empty.
4 CHANGE_TO_EXCLUDE_MODE - indicates that the interface
has changed to EXCLUDE filter mode for the specified
multicast address. The Source Address [i] fields
in this Group Record contain the interface's new
source list for the specified multicast address,
if it is non-empty.
o A "Source-List-Change Record" is sent by a system whenever a local
invocation of IPMulticastListen causes a change of source list that
is *not* coincident with a change of filter mode, of the
interface-level state entry for a particular multicast address.
The Record is included in a Report sent from the interface on which
the change occurred. The Record Type of a Source-List-Change
Record may be one of the following two values:
5 ALLOW_NEW_SOURCES - indicates that the Source Address
[i] fields in this Group Record contain a list of the
additional sources that the system wishes to
hear from, for packets sent to the specified
multicast address. If the change was to an INCLUDE
source list, these are the addresses that were added
to the list; if the change was to an EXCLUDE source
list, these are the addresses that were deleted from
the list.
6 BLOCK_OLD_SOURCES - indicates that the Source Address
[i] fields in this Group Record contain a list of the
sources that the system no longer wishes to
hear from, for packets sent to the specified
multicast address. If the change was to an INCLUDE
source list, these are the addresses that were
deleted from the list; if the change was to an
EXCLUDE source list, these are the addresses that
were added to the list.
If a change of source list results in both allowing new sources and
blocking old sources, then two Group Records are sent for the same
multicast address, one of type ALLOW_NEW_SOURCES and one of type
BLOCK_OLD_SOURCES.
IGMP Query
IGMP Report
图来自 Linux Networking Architecture 17.3.4 Implementing IGMP
参考:
1. IGMPV1 rfc1112
2. IGMPV2 rfc2236
3. IGMPV3 rfc3376
4. Linux下IGMP以及多播路由分析
5. Design and Implementation of IGMPv3 for Linux (2000)
6. Linux Kernel 2.6.26
7. 在线查看Kernel: http://lxr.linux.no/linux+v2.6.26/
8. RFC3376 因特网组管理协议 第3版(译)
9. Linux Networking Architecture (Chapter 17. IP Multicast for Group Communication)
10. Mapping IP Multicast to MAC-Layer Multicast
![[Google]]( http://wifihack.net/blog/wp-content/plugins/easy-adsense-lite/google-light.gif)
Recent Comments