github.com/cilium/cilium@v1.16.2/bpf/include/linux/igmp.h (about)

     1  /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
     2  /*
     3   *	Linux NET3:	Internet Group Management Protocol  [IGMP]
     4   *
     5   *	Authors:
     6   *		Alan Cox <alan@lxorguk.ukuu.org.uk>
     7   *
     8   *	Extended to talk the BSD extended IGMP protocol of mrouted 3.6
     9   *
    10   *
    11   *	This program is free software; you can redistribute it and/or
    12   *	modify it under the terms of the GNU General Public License
    13   *	as published by the Free Software Foundation; either version
    14   *	2 of the License, or (at your option) any later version.
    15   */
    16  
    17  #pragma once
    18  
    19  #include <linux/types.h>
    20  
    21  /*
    22   *	IGMP protocol structures
    23   */
    24  
    25  /*
    26   *	Header in on cable format
    27   */
    28  
    29  struct igmphdr {
    30  	__u8 type;
    31  	__u8 code;		/* For newer IGMP */
    32  	__sum16 csum;
    33  	__be32 group;
    34  };
    35  
    36  /* V3 group record types [grec_type] */
    37  #define IGMPV3_MODE_IS_INCLUDE		1
    38  #define IGMPV3_MODE_IS_EXCLUDE		2
    39  #define IGMPV3_CHANGE_TO_INCLUDE	3
    40  #define IGMPV3_CHANGE_TO_EXCLUDE	4
    41  #define IGMPV3_ALLOW_NEW_SOURCES	5
    42  #define IGMPV3_BLOCK_OLD_SOURCES	6
    43  
    44  struct igmpv3_grec {
    45  	__u8	grec_type;
    46  	__u8	grec_auxwords;
    47  	__be16	grec_nsrcs;
    48  	__be32	grec_mca;
    49  	__be32	grec_src[];
    50  };
    51  
    52  struct igmpv3_report {
    53  	__u8 type;
    54  	__u8 resv1;
    55  	__sum16 csum;
    56  	__be16 resv2;
    57  	__be16 ngrec;
    58  	struct igmpv3_grec grec[];
    59  };
    60  
    61  struct igmpv3_query {
    62  	__u8 type;
    63  	__u8 code;
    64  	__sum16 csum;
    65  	__be32 group;
    66  #if defined(__LITTLE_ENDIAN_BITFIELD)
    67  	__u8 qrv:3,
    68  	     suppress:1,
    69  	     resv:4;
    70  #elif defined(__BIG_ENDIAN_BITFIELD)
    71  	__u8 resv:4,
    72  	     suppress:1,
    73  	     qrv:3;
    74  #else
    75  #error "Please fix <asm/byteorder.h>"
    76  #endif
    77  	__u8 qqic;
    78  	__be16 nsrcs;
    79  	__be32 srcs[];
    80  };
    81  
    82  #define IGMP_HOST_MEMBERSHIP_QUERY	0x11	/* From RFC1112 */
    83  #define IGMP_HOST_MEMBERSHIP_REPORT	0x12	/* Ditto */
    84  #define IGMP_DVMRP			0x13	/* DVMRP routing */
    85  #define IGMP_PIM			0x14	/* PIM routing */
    86  #define IGMP_TRACE			0x15
    87  #define IGMPV2_HOST_MEMBERSHIP_REPORT	0x16	/* V2 version of 0x12 */
    88  #define IGMP_HOST_LEAVE_MESSAGE 	0x17
    89  #define IGMPV3_HOST_MEMBERSHIP_REPORT	0x22	/* V3 version of 0x12 */
    90  
    91  #define IGMP_MTRACE_RESP		0x1e
    92  #define IGMP_MTRACE			0x1f
    93  
    94  #define IGMP_MRDISC_ADV			0x30	/* From RFC4286 */
    95  
    96  /*
    97   *	Use the BSD names for these for compatibility
    98   */
    99  
   100  #define IGMP_DELAYING_MEMBER		0x01
   101  #define IGMP_IDLE_MEMBER		0x02
   102  #define IGMP_LAZY_MEMBER		0x03
   103  #define IGMP_SLEEPING_MEMBER		0x04
   104  #define IGMP_AWAKENING_MEMBER		0x05
   105  
   106  #define IGMP_MINLEN			8
   107  
   108  #define IGMP_MAX_HOST_REPORT_DELAY	10	/* max delay for response to */
   109  						/* query (in seconds)	*/
   110  
   111  #define IGMP_TIMER_SCALE		10	/* denotes that the igmphdr->timer field */
   112  						/* specifies time in 10th of seconds	 */
   113  
   114  #define IGMP_AGE_THRESHOLD		400	/* If this host don't hear any IGMP V1	*/
   115  						/* message in this period of time,	*/
   116  						/* revert to IGMP v2 router.		*/
   117  
   118  #define IGMP_ALL_HOSTS		htonl(0xE0000001L)
   119  #define IGMP_ALL_ROUTER 	htonl(0xE0000002L)
   120  #define IGMPV3_ALL_MCR	 	htonl(0xE0000016L)
   121  #define IGMP_LOCAL_GROUP	htonl(0xE0000000L)
   122  #define IGMP_LOCAL_GROUP_MASK	htonl(0xFFFFFF00L)