2 * Copyright (c) 1988 Stephen Deering.
3 * Copyright (c) 1992, 1993
4 * The Regents of the University of California. All rights reserved.
6 * This code is derived from software contributed to Berkeley by
7 * Stephen Deering of Stanford University.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * from: @(#)igmp_var.h 8.1 (Berkeley) 7/19/93
37 #ifndef _NETINET_IGMP_VAR_H_
38 #define _NETINET_IGMP_VAR_H_
41 * Internet Group Management Protocol (IGMP),
42 * implementation-specific definitions.
44 * Written by Steve Deering, Stanford, May 1988.
46 * MULTICAST Revision: 3.5.1.3
50 u_int igps_rcv_total; /* total IGMP messages received */
51 u_int igps_rcv_tooshort; /* received with too few bytes */
52 u_int igps_rcv_badsum; /* received with bad checksum */
53 u_int igps_rcv_queries; /* received membership queries */
54 u_int igps_rcv_badqueries; /* received invalid queries */
55 u_int igps_rcv_reports; /* received membership reports */
56 u_int igps_rcv_badreports; /* received invalid reports */
57 u_int igps_rcv_ourreports; /* received reports for our groups */
58 u_int igps_snd_reports; /* sent membership reports */
59 u_int igps_rcv_toolong; /* received with too many bytes */
63 #define IGMP_RANDOM_DELAY(X) (random() % (X) + 1)
66 * States for IGMPv2's leave processing
68 #define IGMP_OTHERMEMBER 0
69 #define IGMP_IREPORTEDLAST 1
72 * State masks for IGMPv3
74 #define IGMP_V3_NONEXISTENT 0x01
75 #define IGMP_V3_OTHERMEMBER 0x02
76 #define IGMP_V3_IREPORTEDLAST 0x04
79 * We must remember what version the subnet's querier is.
80 * We conveniently use the IGMP message type for the proper
81 * membership report to keep this state.
83 #define IGMP_V1_ROUTER IGMP_V1_MEMBERSHIP_REPORT
84 #define IGMP_V2_ROUTER IGMP_V2_MEMBERSHIP_REPORT
85 #define IGMP_V3_ROUTER IGMP_V3_MEMBERSHIP_REPORT
88 * Revert to new router if we haven't heard from an old router in
89 * this amount of time.
91 #define IGMP_AGE_THRESHOLD 540
94 * IGMPv3 protocol defaults
96 #define IGMP_INIT_ROBVAR 2 /* Robustness */
97 #define IGMP_MAX_ROBVAR 7
98 #define IGMP_INIT_QRYINT 125 /* Querier's Query interval */
99 #define IGMP_MAX_QRYINT 255
100 #define IGMP_INIT_QRYRSP 10 /* Query Response interval */
101 #define IGMP_DEF_QRYMRT 10
102 #define IGMP_UNSOL_INT 1 /* Unsolicited Report interval */
105 * IGMPv3 report types
107 #define IGMP_REPORT_MODE_IN 1 /* mode-is-include */
108 #define IGMP_REPORT_MODE_EX 2 /* mode-is-exclude */
109 #define IGMP_REPORT_TO_IN 3 /* change-to-include */
110 #define IGMP_REPORT_TO_EX 4 /* change-to-exclude */
111 #define IGMP_REPORT_ALLOW_NEW 5 /* allow-new-sources */
112 #define IGMP_REPORT_BLOCK_OLD 6 /* block-old-sources */
117 #define IGMP_MASK_CUR_STATE 0x01 /* Report current-state */
118 #define IGMP_MASK_ALLOW_NEW 0x02 /* Report source as allow-new */
119 #define IGMP_MASK_BLOCK_OLD 0x04 /* Report source as block-old */
120 #define IGMP_MASK_TO_IN 0x08 /* Report source as to_in */
121 #define IGMP_MASK_TO_EX 0x10 /* Report source as to_ex */
122 #define IGMP_MASK_STATE_T1 0x20 /* State at T1 */
123 #define IGMP_MASK_STATE_T2 0x40 /* State at T2 */
124 #define IGMP_MASK_IF_STATE 0x80 /* Report current-state per interface */
126 #define IGMP_MASK_STATE_TX (IGMP_MASK_STATE_T1 | IGMP_MASK_STATE_T2)
127 #define IGMP_MASK_PENDING (IGMP_MASK_CUR_STATE | \
128 IGMP_MASK_ALLOW_NEW | \
134 #define IGMP_EXCLUDE_LIST 1 /* exclude list used to tag report */
135 #define IGMP_INCLUDE_LIST 2 /* include list used to tag report */
136 #define IGMP_RECORDED_LIST 3 /* recorded list used to tag report */
138 void igmp_init(void);
139 void igmp_input(struct mbuf *, int);
140 void igmp_joingroup(struct in_multi *);
141 void igmp_leavegroup(struct in_multi *);
142 void igmp_fasttimo(void);
143 void igmp_slowtimo(void);
145 SYSCTL_DECL(_net_inet_igmp);
150 * Names for IGMP sysctl objects
152 #define IGMPCTL_STATS 1 /* statistics (read-only) */
153 #define IGMPCTL_MAXID 2
155 #define IGMPCTL_NAMES { \
157 { "stats", CTLTYPE_STRUCT } \