2 * Fundamental constants relating to Neighbor Discovery Protocol
4 * Copyright (C) 1999-2016, Broadcom Corporation
6 * Unless you and Broadcom execute a separate written software license
7 * agreement governing use of this software, this software is licensed to you
8 * under the terms of the GNU General Public License version 2 (the "GPL"),
9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10 * following added to such license:
12 * As a special exception, the copyright holders of this software give you
13 * permission to link this software with independent modules, and to copy and
14 * distribute the resulting executable under terms of your choice, provided that
15 * you also meet, for each linked independent module, the terms and conditions of
16 * the license of that module. An independent module is a module which is not
17 * derived from this software. The special exception does not apply to any
18 * modifications of the software.
20 * Notwithstanding the above, under no circumstances may you combine this
21 * software in any way with any other Broadcom software provided under a license
22 * other than the GPL, without Broadcom's express prior written consent.
25 * <<Broadcom-WL-IPTag/Open:>>
27 * $Id: bcmipv6.h 518342 2014-12-01 23:21:41Z $
37 /* This marks the start of a packed structure section. */
38 #include <packed_section_start.h>
40 /* Extension headers */
41 #define IPV6_EXT_HOP 0
42 #define IPV6_EXT_ROUTE 43
43 #define IPV6_EXT_FRAG 44
44 #define IPV6_EXT_DEST 60
45 #define IPV6_EXT_ESEC 50
46 #define IPV6_EXT_AUTH 51
48 /* Minimum size (extension header "word" length) */
49 #define IPV6_EXT_WORD 8
51 /* Offsets for most extension headers */
52 #define IPV6_EXT_NEXTHDR 0
53 #define IPV6_EXT_HDRLEN 1
55 /* Constants specific to fragmentation header */
56 #define IPV6_FRAG_MORE_MASK 0x0001
57 #define IPV6_FRAG_MORE_SHIFT 0
58 #define IPV6_FRAG_OFFS_MASK 0xfff8
59 #define IPV6_FRAG_OFFS_SHIFT 3
62 #define ICMPV6_HEADER_TYPE 0x3A
63 #define ICMPV6_PKT_TYPE_RA 134
64 #define ICMPV6_PKT_TYPE_NS 135
65 #define ICMPV6_PKT_TYPE_NA 136
67 #define ICMPV6_ND_OPT_TYPE_TARGET_MAC 2
68 #define ICMPV6_ND_OPT_TYPE_SRC_MAC 1
70 #define ICMPV6_ND_OPT_LEN_LINKADDR 1
72 #define ICMPV6_ND_OPT_LEN_LINKADDR 1
74 #define IPV6_VERSION 6
75 #define IPV6_HOP_LIMIT 255
77 #define IPV6_ADDR_NULL(a) ((a[0] | a[1] | a[2] | a[3] | a[4] | \
78 a[5] | a[6] | a[7] | a[8] | a[9] | \
79 a[10] | a[11] | a[12] | a[13] | \
82 #define IPV6_ADDR_LOCAL(a) (((a[0] == 0xfe) && (a[1] & 0x80))? TRUE: FALSE)
85 BWL_PRE_PACKED_STRUCT struct ipv6_addr {
87 } BWL_POST_PACKED_STRUCT;
91 BWL_PRE_PACKED_STRUCT struct icmp6_hdr {
95 BWL_PRE_PACKED_STRUCT union {
97 BWL_PRE_PACKED_STRUCT struct nd_advt {
103 } BWL_POST_PACKED_STRUCT nd_advt;
104 } BWL_POST_PACKED_STRUCT opt;
105 } BWL_POST_PACKED_STRUCT;
107 /* Ipv6 Header Format */
108 BWL_PRE_PACKED_STRUCT struct ipv6_hdr {
115 struct ipv6_addr saddr;
116 struct ipv6_addr daddr;
117 } BWL_POST_PACKED_STRUCT;
119 /* Neighbor Advertisement/Solicitation Packet Structure */
120 BWL_PRE_PACKED_STRUCT struct bcm_nd_msg {
121 struct icmp6_hdr icmph;
122 struct ipv6_addr target;
123 } BWL_POST_PACKED_STRUCT;
126 /* Neighibor Solicitation/Advertisement Optional Structure */
127 BWL_PRE_PACKED_STRUCT struct nd_msg_opt {
130 uint8 mac_addr[ETHER_ADDR_LEN];
131 } BWL_POST_PACKED_STRUCT;
133 /* Ipv6 Fragmentation Header */
134 BWL_PRE_PACKED_STRUCT struct ipv6_frag {
139 } BWL_POST_PACKED_STRUCT;
141 /* This marks the end of a packed structure section. */
142 #include <packed_section_end.h>
144 static const struct ipv6_addr all_node_ipv6_maddr = {
151 #define IPV6_ISMULTI(a) (a[0] == 0xff)
153 #define IPV6_MCAST_TO_ETHER_MCAST(ipv6, ether) \
157 ether[2] = ipv6[12]; \
158 ether[3] = ipv6[13]; \
159 ether[4] = ipv6[14]; \
160 ether[5] = ipv6[15]; \
163 #endif /* !defined(_bcmipv6_h_) */