180 lines · c
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */2#ifndef _UAPI_LINUX_ICMPV6_H3#define _UAPI_LINUX_ICMPV6_H4 5#include <linux/types.h>6#include <asm/byteorder.h>7 8struct icmp6hdr {9 10 __u8 icmp6_type;11 __u8 icmp6_code;12 __sum16 icmp6_cksum;13 14 15 union {16 __be32 un_data32[1];17 __be16 un_data16[2];18 __u8 un_data8[4];19 20 struct icmpv6_echo {21 __be16 identifier;22 __be16 sequence;23 } u_echo;24 25 struct icmpv6_nd_advt {26#if defined(__LITTLE_ENDIAN_BITFIELD)27 __u32 reserved:5,28 override:1,29 solicited:1,30 router:1,31 reserved2:24;32#elif defined(__BIG_ENDIAN_BITFIELD)33 __u32 router:1,34 solicited:1,35 override:1,36 reserved:29;37#else38#error "Please fix <asm/byteorder.h>"39#endif 40 } u_nd_advt;41 42 struct icmpv6_nd_ra {43 __u8 hop_limit;44#if defined(__LITTLE_ENDIAN_BITFIELD)45 __u8 reserved:3,46 router_pref:2,47 home_agent:1,48 other:1,49 managed:1;50 51#elif defined(__BIG_ENDIAN_BITFIELD)52 __u8 managed:1,53 other:1,54 home_agent:1,55 router_pref:2,56 reserved:3;57#else58#error "Please fix <asm/byteorder.h>"59#endif60 __be16 rt_lifetime;61 } u_nd_ra;62 63 } icmp6_dataun;64 65#define icmp6_identifier icmp6_dataun.u_echo.identifier66#define icmp6_sequence icmp6_dataun.u_echo.sequence67#define icmp6_pointer icmp6_dataun.un_data32[0]68#define icmp6_mtu icmp6_dataun.un_data32[0]69#define icmp6_unused icmp6_dataun.un_data32[0]70#define icmp6_maxdelay icmp6_dataun.un_data16[0]71#define icmp6_datagram_len icmp6_dataun.un_data8[0]72#define icmp6_router icmp6_dataun.u_nd_advt.router73#define icmp6_solicited icmp6_dataun.u_nd_advt.solicited74#define icmp6_override icmp6_dataun.u_nd_advt.override75#define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved76#define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit77#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed78#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other79#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime80#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref81};82 83 84#define ICMPV6_ROUTER_PREF_LOW 0x385#define ICMPV6_ROUTER_PREF_MEDIUM 0x086#define ICMPV6_ROUTER_PREF_HIGH 0x187#define ICMPV6_ROUTER_PREF_INVALID 0x288 89#define ICMPV6_DEST_UNREACH 190#define ICMPV6_PKT_TOOBIG 291#define ICMPV6_TIME_EXCEED 392#define ICMPV6_PARAMPROB 493 94#define ICMPV6_ERRMSG_MAX 12795 96#define ICMPV6_INFOMSG_MASK 0x8097 98#define ICMPV6_ECHO_REQUEST 12899#define ICMPV6_ECHO_REPLY 129100#define ICMPV6_MGM_QUERY 130101#define ICMPV6_MGM_REPORT 131102#define ICMPV6_MGM_REDUCTION 132103 104#define ICMPV6_NI_QUERY 139105#define ICMPV6_NI_REPLY 140106 107#define ICMPV6_MLD2_REPORT 143108 109#define ICMPV6_DHAAD_REQUEST 144110#define ICMPV6_DHAAD_REPLY 145111#define ICMPV6_MOBILE_PREFIX_SOL 146112#define ICMPV6_MOBILE_PREFIX_ADV 147113 114#define ICMPV6_MRDISC_ADV 151115#define ICMPV6_MRDISC_SOL 152116 117#define ICMPV6_MSG_MAX 255118 119/*120 * Codes for Destination Unreachable121 */122#define ICMPV6_NOROUTE 0123#define ICMPV6_ADM_PROHIBITED 1124#define ICMPV6_NOT_NEIGHBOUR 2125#define ICMPV6_ADDR_UNREACH 3126#define ICMPV6_PORT_UNREACH 4127#define ICMPV6_POLICY_FAIL 5128#define ICMPV6_REJECT_ROUTE 6129 130/*131 * Codes for Time Exceeded132 */133#define ICMPV6_EXC_HOPLIMIT 0134#define ICMPV6_EXC_FRAGTIME 1135 136/*137 * Codes for Parameter Problem138 */139#define ICMPV6_HDR_FIELD 0140#define ICMPV6_UNK_NEXTHDR 1141#define ICMPV6_UNK_OPTION 2142#define ICMPV6_HDR_INCOMP 3143 144/* Codes for EXT_ECHO (PROBE) */145#define ICMPV6_EXT_ECHO_REQUEST 160146#define ICMPV6_EXT_ECHO_REPLY 161147/*148 * constants for (set|get)sockopt149 */150 151#define ICMPV6_FILTER 1152 153/*154 * ICMPV6 filter155 */156 157#define ICMPV6_FILTER_BLOCK 1158#define ICMPV6_FILTER_PASS 2159#define ICMPV6_FILTER_BLOCKOTHERS 3160#define ICMPV6_FILTER_PASSONLY 4161 162struct icmp6_filter {163 __u32 data[8];164};165 166/*167 * Definitions for MLDv2168 */169#define MLD2_MODE_IS_INCLUDE 1170#define MLD2_MODE_IS_EXCLUDE 2171#define MLD2_CHANGE_TO_INCLUDE 3172#define MLD2_CHANGE_TO_EXCLUDE 4173#define MLD2_ALLOW_NEW_SOURCES 5174#define MLD2_BLOCK_OLD_SOURCES 6175 176#define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } }177 178 179#endif /* _UAPI_LINUX_ICMPV6_H */180