Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _UAPI_LINUX_ICMPV6_H
0003 #define _UAPI_LINUX_ICMPV6_H
0004 
0005 #include <linux/types.h>
0006 #include <asm/byteorder.h>
0007 
0008 struct icmp6hdr {
0009 
0010     __u8        icmp6_type;
0011     __u8        icmp6_code;
0012     __sum16     icmp6_cksum;
0013 
0014 
0015     union {
0016         __be32          un_data32[1];
0017         __be16          un_data16[2];
0018         __u8            un_data8[4];
0019 
0020         struct icmpv6_echo {
0021             __be16      identifier;
0022             __be16      sequence;
0023         } u_echo;
0024 
0025                 struct icmpv6_nd_advt {
0026 #if defined(__LITTLE_ENDIAN_BITFIELD)
0027                         __u32       reserved:5,
0028                                 override:1,
0029                                 solicited:1,
0030                                 router:1,
0031                     reserved2:24;
0032 #elif defined(__BIG_ENDIAN_BITFIELD)
0033                         __u32       router:1,
0034                     solicited:1,
0035                                 override:1,
0036                                 reserved:29;
0037 #else
0038 #error  "Please fix <asm/byteorder.h>"
0039 #endif                      
0040                 } u_nd_advt;
0041 
0042                 struct icmpv6_nd_ra {
0043             __u8        hop_limit;
0044 #if defined(__LITTLE_ENDIAN_BITFIELD)
0045             __u8        reserved:3,
0046                     router_pref:2,
0047                     home_agent:1,
0048                     other:1,
0049                     managed:1;
0050 
0051 #elif defined(__BIG_ENDIAN_BITFIELD)
0052             __u8        managed:1,
0053                     other:1,
0054                     home_agent:1,
0055                     router_pref:2,
0056                     reserved:3;
0057 #else
0058 #error  "Please fix <asm/byteorder.h>"
0059 #endif
0060             __be16      rt_lifetime;
0061                 } u_nd_ra;
0062 
0063     } icmp6_dataun;
0064 
0065 #define icmp6_identifier    icmp6_dataun.u_echo.identifier
0066 #define icmp6_sequence      icmp6_dataun.u_echo.sequence
0067 #define icmp6_pointer       icmp6_dataun.un_data32[0]
0068 #define icmp6_mtu       icmp6_dataun.un_data32[0]
0069 #define icmp6_unused        icmp6_dataun.un_data32[0]
0070 #define icmp6_maxdelay      icmp6_dataun.un_data16[0]
0071 #define icmp6_datagram_len  icmp6_dataun.un_data8[0]
0072 #define icmp6_router        icmp6_dataun.u_nd_advt.router
0073 #define icmp6_solicited     icmp6_dataun.u_nd_advt.solicited
0074 #define icmp6_override      icmp6_dataun.u_nd_advt.override
0075 #define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved
0076 #define icmp6_hop_limit     icmp6_dataun.u_nd_ra.hop_limit
0077 #define icmp6_addrconf_managed  icmp6_dataun.u_nd_ra.managed
0078 #define icmp6_addrconf_other    icmp6_dataun.u_nd_ra.other
0079 #define icmp6_rt_lifetime   icmp6_dataun.u_nd_ra.rt_lifetime
0080 #define icmp6_router_pref   icmp6_dataun.u_nd_ra.router_pref
0081 };
0082 
0083 
0084 #define ICMPV6_ROUTER_PREF_LOW      0x3
0085 #define ICMPV6_ROUTER_PREF_MEDIUM   0x0
0086 #define ICMPV6_ROUTER_PREF_HIGH     0x1
0087 #define ICMPV6_ROUTER_PREF_INVALID  0x2
0088 
0089 #define ICMPV6_DEST_UNREACH     1
0090 #define ICMPV6_PKT_TOOBIG       2
0091 #define ICMPV6_TIME_EXCEED      3
0092 #define ICMPV6_PARAMPROB        4
0093 
0094 #define ICMPV6_ERRMSG_MAX       127
0095 
0096 #define ICMPV6_INFOMSG_MASK     0x80
0097 
0098 #define ICMPV6_ECHO_REQUEST     128
0099 #define ICMPV6_ECHO_REPLY       129
0100 #define ICMPV6_MGM_QUERY        130
0101 #define ICMPV6_MGM_REPORT           131
0102 #define ICMPV6_MGM_REDUCTION        132
0103 
0104 #define ICMPV6_NI_QUERY         139
0105 #define ICMPV6_NI_REPLY         140
0106 
0107 #define ICMPV6_MLD2_REPORT      143
0108 
0109 #define ICMPV6_DHAAD_REQUEST        144
0110 #define ICMPV6_DHAAD_REPLY      145
0111 #define ICMPV6_MOBILE_PREFIX_SOL    146
0112 #define ICMPV6_MOBILE_PREFIX_ADV    147
0113 
0114 #define ICMPV6_MRDISC_ADV       151
0115 
0116 #define ICMPV6_MSG_MAX          255
0117 
0118 /*
0119  *  Codes for Destination Unreachable
0120  */
0121 #define ICMPV6_NOROUTE          0
0122 #define ICMPV6_ADM_PROHIBITED       1
0123 #define ICMPV6_NOT_NEIGHBOUR        2
0124 #define ICMPV6_ADDR_UNREACH     3
0125 #define ICMPV6_PORT_UNREACH     4
0126 #define ICMPV6_POLICY_FAIL      5
0127 #define ICMPV6_REJECT_ROUTE     6
0128 
0129 /*
0130  *  Codes for Time Exceeded
0131  */
0132 #define ICMPV6_EXC_HOPLIMIT     0
0133 #define ICMPV6_EXC_FRAGTIME     1
0134 
0135 /*
0136  *  Codes for Parameter Problem
0137  */
0138 #define ICMPV6_HDR_FIELD        0
0139 #define ICMPV6_UNK_NEXTHDR      1
0140 #define ICMPV6_UNK_OPTION       2
0141 #define ICMPV6_HDR_INCOMP       3
0142 
0143 /* Codes for EXT_ECHO (PROBE) */
0144 #define ICMPV6_EXT_ECHO_REQUEST     160
0145 #define ICMPV6_EXT_ECHO_REPLY       161
0146 /*
0147  *  constants for (set|get)sockopt
0148  */
0149 
0150 #define ICMPV6_FILTER           1
0151 
0152 /*
0153  *  ICMPV6 filter
0154  */
0155 
0156 #define ICMPV6_FILTER_BLOCK     1
0157 #define ICMPV6_FILTER_PASS      2
0158 #define ICMPV6_FILTER_BLOCKOTHERS   3
0159 #define ICMPV6_FILTER_PASSONLY      4
0160 
0161 struct icmp6_filter {
0162     __u32       data[8];
0163 };
0164 
0165 /*
0166  *  Definitions for MLDv2
0167  */
0168 #define MLD2_MODE_IS_INCLUDE    1
0169 #define MLD2_MODE_IS_EXCLUDE    2
0170 #define MLD2_CHANGE_TO_INCLUDE  3
0171 #define MLD2_CHANGE_TO_EXCLUDE  4
0172 #define MLD2_ALLOW_NEW_SOURCES  5
0173 #define MLD2_BLOCK_OLD_SOURCES  6
0174 
0175 #define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } }
0176 
0177 
0178 #endif /* _UAPI_LINUX_ICMPV6_H */