16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2607ca46eSDavid Howells #ifndef _UAPI_LINUX_ICMPV6_H 3607ca46eSDavid Howells #define _UAPI_LINUX_ICMPV6_H 4607ca46eSDavid Howells 5607ca46eSDavid Howells #include <linux/types.h> 6607ca46eSDavid Howells #include <asm/byteorder.h> 7607ca46eSDavid Howells 8607ca46eSDavid Howells struct icmp6hdr { 9607ca46eSDavid Howells 10607ca46eSDavid Howells __u8 icmp6_type; 11607ca46eSDavid Howells __u8 icmp6_code; 12607ca46eSDavid Howells __sum16 icmp6_cksum; 13607ca46eSDavid Howells 14607ca46eSDavid Howells 15607ca46eSDavid Howells union { 16607ca46eSDavid Howells __be32 un_data32[1]; 17607ca46eSDavid Howells __be16 un_data16[2]; 18607ca46eSDavid Howells __u8 un_data8[4]; 19607ca46eSDavid Howells 20607ca46eSDavid Howells struct icmpv6_echo { 21607ca46eSDavid Howells __be16 identifier; 22607ca46eSDavid Howells __be16 sequence; 23607ca46eSDavid Howells } u_echo; 24607ca46eSDavid Howells 25607ca46eSDavid Howells struct icmpv6_nd_advt { 26607ca46eSDavid Howells #if defined(__LITTLE_ENDIAN_BITFIELD) 27607ca46eSDavid Howells __u32 reserved:5, 28607ca46eSDavid Howells override:1, 29607ca46eSDavid Howells solicited:1, 30607ca46eSDavid Howells router:1, 31607ca46eSDavid Howells reserved2:24; 32607ca46eSDavid Howells #elif defined(__BIG_ENDIAN_BITFIELD) 33607ca46eSDavid Howells __u32 router:1, 34607ca46eSDavid Howells solicited:1, 35607ca46eSDavid Howells override:1, 36607ca46eSDavid Howells reserved:29; 37607ca46eSDavid Howells #else 38607ca46eSDavid Howells #error "Please fix <asm/byteorder.h>" 39607ca46eSDavid Howells #endif 40607ca46eSDavid Howells } u_nd_advt; 41607ca46eSDavid Howells 42607ca46eSDavid Howells struct icmpv6_nd_ra { 43607ca46eSDavid Howells __u8 hop_limit; 44607ca46eSDavid Howells #if defined(__LITTLE_ENDIAN_BITFIELD) 45607ca46eSDavid Howells __u8 reserved:3, 46607ca46eSDavid Howells router_pref:2, 47607ca46eSDavid Howells home_agent:1, 48607ca46eSDavid Howells other:1, 49607ca46eSDavid Howells managed:1; 50607ca46eSDavid Howells 51607ca46eSDavid Howells #elif defined(__BIG_ENDIAN_BITFIELD) 52607ca46eSDavid Howells __u8 managed:1, 53607ca46eSDavid Howells other:1, 54607ca46eSDavid Howells home_agent:1, 55607ca46eSDavid Howells router_pref:2, 56607ca46eSDavid Howells reserved:3; 57607ca46eSDavid Howells #else 58607ca46eSDavid Howells #error "Please fix <asm/byteorder.h>" 59607ca46eSDavid Howells #endif 60607ca46eSDavid Howells __be16 rt_lifetime; 61607ca46eSDavid Howells } u_nd_ra; 62607ca46eSDavid Howells 63607ca46eSDavid Howells } icmp6_dataun; 64607ca46eSDavid Howells 65607ca46eSDavid Howells #define icmp6_identifier icmp6_dataun.u_echo.identifier 66607ca46eSDavid Howells #define icmp6_sequence icmp6_dataun.u_echo.sequence 67607ca46eSDavid Howells #define icmp6_pointer icmp6_dataun.un_data32[0] 68607ca46eSDavid Howells #define icmp6_mtu icmp6_dataun.un_data32[0] 69607ca46eSDavid Howells #define icmp6_unused icmp6_dataun.un_data32[0] 70607ca46eSDavid Howells #define icmp6_maxdelay icmp6_dataun.un_data16[0] 7101370434SWillem de Bruijn #define icmp6_datagram_len icmp6_dataun.un_data8[0] 72607ca46eSDavid Howells #define icmp6_router icmp6_dataun.u_nd_advt.router 73607ca46eSDavid Howells #define icmp6_solicited icmp6_dataun.u_nd_advt.solicited 74607ca46eSDavid Howells #define icmp6_override icmp6_dataun.u_nd_advt.override 75607ca46eSDavid Howells #define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved 76607ca46eSDavid Howells #define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit 77607ca46eSDavid Howells #define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed 78607ca46eSDavid Howells #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other 79607ca46eSDavid Howells #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime 80607ca46eSDavid Howells #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref 81607ca46eSDavid Howells }; 82607ca46eSDavid Howells 83607ca46eSDavid Howells 84607ca46eSDavid Howells #define ICMPV6_ROUTER_PREF_LOW 0x3 85607ca46eSDavid Howells #define ICMPV6_ROUTER_PREF_MEDIUM 0x0 86607ca46eSDavid Howells #define ICMPV6_ROUTER_PREF_HIGH 0x1 87607ca46eSDavid Howells #define ICMPV6_ROUTER_PREF_INVALID 0x2 88607ca46eSDavid Howells 89607ca46eSDavid Howells #define ICMPV6_DEST_UNREACH 1 90607ca46eSDavid Howells #define ICMPV6_PKT_TOOBIG 2 91607ca46eSDavid Howells #define ICMPV6_TIME_EXCEED 3 92607ca46eSDavid Howells #define ICMPV6_PARAMPROB 4 93607ca46eSDavid Howells 940bc19985SStephen Suryaputra #define ICMPV6_ERRMSG_MAX 127 950bc19985SStephen Suryaputra 96607ca46eSDavid Howells #define ICMPV6_INFOMSG_MASK 0x80 97607ca46eSDavid Howells 98607ca46eSDavid Howells #define ICMPV6_ECHO_REQUEST 128 99607ca46eSDavid Howells #define ICMPV6_ECHO_REPLY 129 100607ca46eSDavid Howells #define ICMPV6_MGM_QUERY 130 101607ca46eSDavid Howells #define ICMPV6_MGM_REPORT 131 102607ca46eSDavid Howells #define ICMPV6_MGM_REDUCTION 132 103607ca46eSDavid Howells 104607ca46eSDavid Howells #define ICMPV6_NI_QUERY 139 105607ca46eSDavid Howells #define ICMPV6_NI_REPLY 140 106607ca46eSDavid Howells 107607ca46eSDavid Howells #define ICMPV6_MLD2_REPORT 143 108607ca46eSDavid Howells 109607ca46eSDavid Howells #define ICMPV6_DHAAD_REQUEST 144 110607ca46eSDavid Howells #define ICMPV6_DHAAD_REPLY 145 111607ca46eSDavid Howells #define ICMPV6_MOBILE_PREFIX_SOL 146 112607ca46eSDavid Howells #define ICMPV6_MOBILE_PREFIX_ADV 147 113607ca46eSDavid Howells 1144b3087c7SLinus Lüssing #define ICMPV6_MRDISC_ADV 151 1154b3087c7SLinus Lüssing 1160bc19985SStephen Suryaputra #define ICMPV6_MSG_MAX 255 1170bc19985SStephen Suryaputra 118607ca46eSDavid Howells /* 119607ca46eSDavid Howells * Codes for Destination Unreachable 120607ca46eSDavid Howells */ 121607ca46eSDavid Howells #define ICMPV6_NOROUTE 0 122607ca46eSDavid Howells #define ICMPV6_ADM_PROHIBITED 1 123607ca46eSDavid Howells #define ICMPV6_NOT_NEIGHBOUR 2 124607ca46eSDavid Howells #define ICMPV6_ADDR_UNREACH 3 125607ca46eSDavid Howells #define ICMPV6_PORT_UNREACH 4 12661e76b17SJiri Bohac #define ICMPV6_POLICY_FAIL 5 12761e76b17SJiri Bohac #define ICMPV6_REJECT_ROUTE 6 128607ca46eSDavid Howells 129607ca46eSDavid Howells /* 130607ca46eSDavid Howells * Codes for Time Exceeded 131607ca46eSDavid Howells */ 132607ca46eSDavid Howells #define ICMPV6_EXC_HOPLIMIT 0 133607ca46eSDavid Howells #define ICMPV6_EXC_FRAGTIME 1 134607ca46eSDavid Howells 135607ca46eSDavid Howells /* 136607ca46eSDavid Howells * Codes for Parameter Problem 137607ca46eSDavid Howells */ 138607ca46eSDavid Howells #define ICMPV6_HDR_FIELD 0 139607ca46eSDavid Howells #define ICMPV6_UNK_NEXTHDR 1 140607ca46eSDavid Howells #define ICMPV6_UNK_OPTION 2 141b59e286bSHangbin Liu #define ICMPV6_HDR_INCOMP 3 142607ca46eSDavid Howells 143*750f4fc2SAndreas Roeseler /* Codes for EXT_ECHO (PROBE) */ 144*750f4fc2SAndreas Roeseler #define ICMPV6_EXT_ECHO_REQUEST 160 145*750f4fc2SAndreas Roeseler #define ICMPV6_EXT_ECHO_REPLY 161 146607ca46eSDavid Howells /* 147607ca46eSDavid Howells * constants for (set|get)sockopt 148607ca46eSDavid Howells */ 149607ca46eSDavid Howells 150607ca46eSDavid Howells #define ICMPV6_FILTER 1 151607ca46eSDavid Howells 152607ca46eSDavid Howells /* 153607ca46eSDavid Howells * ICMPV6 filter 154607ca46eSDavid Howells */ 155607ca46eSDavid Howells 156607ca46eSDavid Howells #define ICMPV6_FILTER_BLOCK 1 157607ca46eSDavid Howells #define ICMPV6_FILTER_PASS 2 158607ca46eSDavid Howells #define ICMPV6_FILTER_BLOCKOTHERS 3 159607ca46eSDavid Howells #define ICMPV6_FILTER_PASSONLY 4 160607ca46eSDavid Howells 161607ca46eSDavid Howells struct icmp6_filter { 162607ca46eSDavid Howells __u32 data[8]; 163607ca46eSDavid Howells }; 164607ca46eSDavid Howells 165607ca46eSDavid Howells /* 166607ca46eSDavid Howells * Definitions for MLDv2 167607ca46eSDavid Howells */ 168607ca46eSDavid Howells #define MLD2_MODE_IS_INCLUDE 1 169607ca46eSDavid Howells #define MLD2_MODE_IS_EXCLUDE 2 170607ca46eSDavid Howells #define MLD2_CHANGE_TO_INCLUDE 3 171607ca46eSDavid Howells #define MLD2_CHANGE_TO_EXCLUDE 4 172607ca46eSDavid Howells #define MLD2_ALLOW_NEW_SOURCES 5 173607ca46eSDavid Howells #define MLD2_BLOCK_OLD_SOURCES 6 174607ca46eSDavid Howells 175607ca46eSDavid Howells #define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } } 176607ca46eSDavid Howells 177607ca46eSDavid Howells 178607ca46eSDavid Howells #endif /* _UAPI_LINUX_ICMPV6_H */ 179