FD.io VPP
v18.01.2-1-g9b554f3
Vector Packet Processing
Main Page
Related Pages
Modules
Namespaces
Data Structures
Source
Files
Symbols
dhcp6_packet.h
Go to the documentation of this file.
1
#ifndef included_vnet_dhcp6_packet_h
2
#define included_vnet_dhcp6_packet_h
3
4
/*
5
* DHCP packet format
6
*
7
* Copyright (c) 2013 Cisco and/or its affiliates.
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at:
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*/
20
#include <
vnet/ip/ip6_packet.h
>
21
22
// #define DHCP_VRF_NAME_MAX_LEN L3VM_MAX_NAME_STR_LEN
23
// #define DHCPV6_MAX_VRF_NAME_LEN L3VM_MAX_NAME_STR_LEN
24
#define DHCP_MAX_RELAY_ADDR 16
25
#define PROTO_UDP 17
26
#define DHCPV6_CLIENT_PORT 546
27
#define DHCPV6_SERVER_PORT 547
28
#define HOP_COUNT_LIMIT 32
29
#define DHCPV6_CISCO_ENT_NUM 9
30
31
/*
32
* DHCPv6 message types
33
*/
34
typedef
enum
dhcpv6_msg_type_
35
{
36
DHCPV6_MSG_SOLICIT
= 1,
37
DHCPV6_MSG_ADVERTISE
= 2,
38
DHCPV6_MSG_REQUEST
= 3,
39
DHCPV6_MSG_CONFIRM
= 4,
40
DHCPV6_MSG_RENEW
= 5,
41
DHCPV6_MSG_REBIND
= 6,
42
DHCPV6_MSG_REPLY
= 7,
43
DHCPV6_MSG_RELEASE
= 8,
44
DHCPV6_MSG_DECLINE
= 9,
45
DHCPV6_MSG_RECONFIGURE
= 10,
46
DHCPV6_MSG_INFORMATION_REQUEST
= 11,
47
DHCPV6_MSG_RELAY_FORW
= 12,
48
DHCPV6_MSG_RELAY_REPL
= 13,
49
}
dhcpv6_msg_type_t
;
50
51
/*
52
* DHCPv6 options types
53
*/
54
enum
55
{
56
DHCPV6_OPTION_CLIENTID
= 1,
57
DHCPV6_OPTION_SERVERID
= 2,
58
DHCPV6_OPTION_IA_NA
= 3,
59
DHCPV6_OPTION_IA_TA
= 4,
60
DHCPV6_OPTION_IAADDR
= 5,
61
DHCPV6_OPTION_ORO
= 6,
62
DHCPV6_OPTION_PREFERENCE
= 7,
63
DHCPV6_OPTION_ELAPSED_TIME
= 8,
64
DHCPV6_OPTION_RELAY_MSG
= 9,
65
DHCPV6_OPTION_AUTH
= 11,
66
DHCPV6_OPTION_UNICAST
= 12,
67
DHCPV6_OPTION_STATUS_CODE
= 13,
68
DHCPV6_OPTION_RAPID_COMMIT
= 14,
69
DHCPV6_OPTION_USER_CLASS
= 15,
70
DHCPV6_OPTION_VENDOR_CLASS
= 16,
71
DHCPV6_OPTION_VENDOR_OPTS
= 17,
72
DHCPV6_OPTION_INTERFACE_ID
= 18,
// relay agent fills this
73
DHCPV6_OPTION_RECONF_MSG
= 19,
74
DHCPV6_OPTION_RECONF_ACCEPT
= 20,
75
DHCPV6_OPTION_REMOTEID
= 37,
// relay agent fills this
76
DHCPV6_OPTION_VSS
= 68,
// relay agent fills this
77
DHCPV6_OPTION_CLIENT_LINK_LAYER_ADDRESS
= 79,
78
DHCPV6_OPTION_MAX
79
};
80
81
/*
82
* DHCPv6 status codes
83
*/
84
enum
85
{
86
DHCPV6_STATUS_SUCCESS
= 0,
87
DHCPV6_STATUS_UNSPEC_FAIL
= 1,
88
DHCPV6_STATUS_NOADDRS_AVAIL
= 2,
89
DHCPV6_STATUS_NO_BINDING
= 3,
90
DHCPV6_STATUS_NOT_ONLINK
= 4,
91
DHCPV6_STATUS_USE_MULTICAST
= 5,
92
};
93
94
/*
95
* DHCPv6 DUID types
96
*/
97
enum
98
{
99
DHCPV6_DUID_LLT
= 1,
/* DUID Based on Link-layer Address Plus Time */
100
DHCPV6_DUID_EN
= 2,
/* DUID Based on Enterprise Number */
101
DHCPV6_DUID_LL
= 3,
/* DUID Based on Link-layer Address */
102
};
103
104
//Structure for DHCPv6 payload from client
105
typedef
struct
dhcpv6_hdr_
106
{
107
union
108
{
109
u8
msg_type
;
//DHCP msg type
110
u32
xid
;
// transaction id
111
}
u
;
112
u8
data
[0];
113
}
dhcpv6_header_t
;
114
115
116
117
/* *INDENT-OFF* */
118
typedef
CLIB_PACKED
(
struct
dhcpv6_relay_ctx_ {
119
dhcpv6_header_t
*pkt;
120
u32
pkt_len;
121
u32
dhcpv6_len;
//DHCPv6 payload load
122
// if_ordinal iod;
123
u32
if_index;
124
u32
ctx_id;
125
char
ctx_name[32+1];
126
u8
dhcp_msg_type;
127
}) dhcpv6_relay_ctx_t;
128
/* *INDENT-ON* */
129
130
//Structure for DHCPv6 RELAY-FORWARD and DHCPv6 RELAY-REPLY pkts
131
/* *INDENT-OFF* */
132
typedef
CLIB_PACKED
(
struct
dhcpv6_relay_hdr_ {
133
u8
msg_type
;
134
u8
hop_count;
135
ip6_address_t
link_addr;
136
ip6_address_t
peer_addr;
137
u8
data
[0];
138
}) dhcpv6_relay_hdr_t;
139
/* *INDENT-ON* */
140
141
typedef
enum
dhcp_stats_action_type_
142
{
143
DHCP_STATS_ACTION_FORWARDED
= 1,
144
DHCP_STATS_ACTION_RECEIVED
,
145
DHCP_STATS_ACTION_DROPPED
146
}
dhcp_stats_action_type_t
;
147
//Generic counters for a packet
148
typedef
struct
dhcp_stats_counters_
149
{
150
u64
rx_pkts
;
//counter for received pkts
151
u64
tx_pkts
;
//counter for forwarded pkts
152
u64
drops
;
//counter for dropped pkts
153
}
dhcp_stats_counters_t
;
154
155
156
typedef
enum
dhcpv6_stats_drop_reason_
157
{
158
DHCPV6_RELAY_PKT_DROP_RELAYDISABLE
= 1,
159
DHCPV6_RELAY_PKT_DROP_MAX_HOPS
,
160
DHCPV6_RELAY_PKT_DROP_VALIDATION_FAIL
,
161
DHCPV6_RELAY_PKT_DROP_UNKNOWN_OP_INTF
,
162
DHCPV6_RELAY_PKT_DROP_BAD_CONTEXT
,
163
DHCPV6_RELAY_PKT_DROP_OPT_INSERT_FAIL
,
164
DHCPV6_RELAY_PKT_DROP_REPLY_FROM_CLIENT
,
165
}
dhcpv6_stats_drop_reason_t
;
166
167
/* *INDENT-OFF* */
168
typedef
CLIB_PACKED
(
struct
{
169
u16
option;
170
u16
length;
171
u8
data
[0];
172
}) dhcpv6_option_t;
173
/* *INDENT-ON* */
174
175
/* *INDENT-OFF* */
176
typedef
CLIB_PACKED
(
struct
{
177
dhcpv6_option_t opt;
178
u32
int_idx;
179
}) dhcpv6_int_id_t;
180
/* *INDENT-ON* */
181
182
/* *INDENT-OFF* */
183
typedef
CLIB_PACKED
(
struct
{
184
dhcpv6_option_t opt;
185
u8
vss_type;
186
u8
data
[0];
187
}) dhcpv6_vss_t;
188
/* *INDENT-ON* */
189
190
/* *INDENT-OFF* */
191
typedef
CLIB_PACKED
(
struct
{
192
dhcpv6_option_t opt;
193
u32
ent_num;
194
u32
rmt_id;
195
}) dhcpv6_rmt_id_t;
196
/* *INDENT-ON* */
197
198
/* *INDENT-OFF* */
199
typedef
CLIB_PACKED
(
struct
{
200
dhcpv6_option_t opt;
201
u16
link_type;
202
u8
data
[6];
// data[0]:data[5]: MAC address
203
}) dhcpv6_client_mac_t;
204
/* *INDENT-ON* */
205
206
207
#endif
/* included_vnet_dhcp6_packet_h */
208
209
/*
210
* fd.io coding-style-patch-verification: ON
211
*
212
* Local Variables:
213
* eval: (c-set-style "gnu")
214
* End:
215
*/
DHCPV6_DUID_LL
Definition:
dhcp6_packet.h:101
DHCPV6_MSG_RELAY_FORW
Definition:
dhcp6_packet.h:47
dhcp_stats_counters_
Definition:
dhcp6_packet.h:148
DHCPV6_DUID_EN
Definition:
dhcp6_packet.h:100
DHCPV6_MSG_RENEW
Definition:
dhcp6_packet.h:40
dhcp_stats_action_type_t
enum dhcp_stats_action_type_ dhcp_stats_action_type_t
DHCPV6_MSG_REQUEST
Definition:
dhcp6_packet.h:38
DHCPV6_STATUS_NOADDRS_AVAIL
Definition:
dhcp6_packet.h:88
DHCPV6_OPTION_IA_NA
Definition:
dhcp6_packet.h:58
DHCPV6_MSG_RELEASE
Definition:
dhcp6_packet.h:43
ip6_packet.h
DHCP_STATS_ACTION_RECEIVED
Definition:
dhcp6_packet.h:144
DHCPV6_RELAY_PKT_DROP_VALIDATION_FAIL
Definition:
dhcp6_packet.h:160
DHCPV6_OPTION_MAX
Definition:
dhcp6_packet.h:78
DHCPV6_RELAY_PKT_DROP_OPT_INSERT_FAIL
Definition:
dhcp6_packet.h:163
DHCPV6_OPTION_AUTH
Definition:
dhcp6_packet.h:65
DHCPV6_STATUS_NOT_ONLINK
Definition:
dhcp6_packet.h:90
DHCPV6_OPTION_VENDOR_OPTS
Definition:
dhcp6_packet.h:71
DHCPV6_OPTION_UNICAST
Definition:
dhcp6_packet.h:66
DHCPV6_STATUS_USE_MULTICAST
Definition:
dhcp6_packet.h:91
DHCPV6_MSG_SOLICIT
Definition:
dhcp6_packet.h:36
dhcpv6_msg_type_
dhcpv6_msg_type_
Definition:
dhcp6_packet.h:34
DHCPV6_MSG_RECONFIGURE
Definition:
dhcp6_packet.h:45
DHCPV6_OPTION_CLIENT_LINK_LAYER_ADDRESS
Definition:
dhcp6_packet.h:77
DHCPV6_OPTION_ELAPSED_TIME
Definition:
dhcp6_packet.h:63
DHCPV6_MSG_INFORMATION_REQUEST
Definition:
dhcp6_packet.h:46
dhcp_stats_counters_::drops
u64 drops
Definition:
dhcp6_packet.h:152
DHCPV6_STATUS_SUCCESS
Definition:
dhcp6_packet.h:86
DHCPV6_OPTION_PREFERENCE
Definition:
dhcp6_packet.h:62
DHCPV6_MSG_REPLY
Definition:
dhcp6_packet.h:42
u64
unsigned long u64
Definition:
types.h:89
DHCPV6_MSG_ADVERTISE
Definition:
dhcp6_packet.h:37
DHCPV6_OPTION_RAPID_COMMIT
Definition:
dhcp6_packet.h:68
DHCPV6_OPTION_RECONF_MSG
Definition:
dhcp6_packet.h:73
DHCPV6_RELAY_PKT_DROP_REPLY_FROM_CLIENT
Definition:
dhcp6_packet.h:164
DHCPV6_OPTION_INTERFACE_ID
Definition:
dhcp6_packet.h:72
DHCPV6_OPTION_SERVERID
Definition:
dhcp6_packet.h:57
dhcpv6_header_t
struct dhcpv6_hdr_ dhcpv6_header_t
DHCPV6_OPTION_REMOTEID
Definition:
dhcp6_packet.h:75
dhcpv6_msg_type_t
enum dhcpv6_msg_type_ dhcpv6_msg_type_t
DHCPV6_RELAY_PKT_DROP_UNKNOWN_OP_INTF
Definition:
dhcp6_packet.h:161
DHCPV6_OPTION_VENDOR_CLASS
Definition:
dhcp6_packet.h:70
DHCPV6_OPTION_IAADDR
Definition:
dhcp6_packet.h:60
dhcp_stats_counters_::rx_pkts
u64 rx_pkts
Definition:
dhcp6_packet.h:150
DHCPV6_STATUS_UNSPEC_FAIL
Definition:
dhcp6_packet.h:87
dhcpv6_hdr_::xid
u32 xid
Definition:
dhcp6_packet.h:110
DHCPV6_OPTION_STATUS_CODE
Definition:
dhcp6_packet.h:67
dhcpv6_stats_drop_reason_
dhcpv6_stats_drop_reason_
Definition:
dhcp6_packet.h:156
DHCPV6_OPTION_ORO
Definition:
dhcp6_packet.h:61
DHCPV6_OPTION_CLIENTID
Definition:
dhcp6_packet.h:56
DHCPV6_OPTION_IA_TA
Definition:
dhcp6_packet.h:59
dhcp_stats_action_type_
dhcp_stats_action_type_
Definition:
dhcp6_packet.h:141
DHCPV6_OPTION_RELAY_MSG
Definition:
dhcp6_packet.h:64
CLIB_PACKED
typedef CLIB_PACKED(struct dhcpv6_relay_ctx_{dhcpv6_header_t *pkt;u32 pkt_len;u32 dhcpv6_len;u32 if_index;u32 ctx_id;char ctx_name[32+1];u8 dhcp_msg_type;}) dhcpv6_relay_ctx_t
dhcp_stats_counters_::tx_pkts
u64 tx_pkts
Definition:
dhcp6_packet.h:151
dhcpv6_hdr_::data
u8 data[0]
Definition:
dhcp6_packet.h:112
dhcpv6_stats_drop_reason_t
enum dhcpv6_stats_drop_reason_ dhcpv6_stats_drop_reason_t
u32
unsigned int u32
Definition:
types.h:88
DHCPV6_OPTION_VSS
Definition:
dhcp6_packet.h:76
DHCP_STATS_ACTION_FORWARDED
Definition:
dhcp6_packet.h:143
dhcpv6_hdr_
Definition:
dhcp6_packet.h:105
DHCP_STATS_ACTION_DROPPED
Definition:
dhcp6_packet.h:145
DHCPV6_MSG_RELAY_REPL
Definition:
dhcp6_packet.h:48
dhcpv6_hdr_::msg_type
u8 msg_type
Definition:
dhcp6_packet.h:109
DHCPV6_OPTION_USER_CLASS
Definition:
dhcp6_packet.h:69
DHCPV6_MSG_REBIND
Definition:
dhcp6_packet.h:41
u16
unsigned short u16
Definition:
types.h:57
DHCPV6_RELAY_PKT_DROP_RELAYDISABLE
Definition:
dhcp6_packet.h:158
u8
unsigned char u8
Definition:
types.h:56
DHCPV6_DUID_LLT
Definition:
dhcp6_packet.h:99
DHCPV6_OPTION_RECONF_ACCEPT
Definition:
dhcp6_packet.h:74
dhcpv6_hdr_::u
union dhcpv6_hdr_::@103 u
DHCPV6_RELAY_PKT_DROP_MAX_HOPS
Definition:
dhcp6_packet.h:159
DHCPV6_MSG_CONFIRM
Definition:
dhcp6_packet.h:39
DHCPV6_MSG_DECLINE
Definition:
dhcp6_packet.h:44
ip6_address_t
Definition:
ip6_packet.h:46
dhcp_stats_counters_t
struct dhcp_stats_counters_ dhcp_stats_counters_t
DHCPV6_STATUS_NO_BINDING
Definition:
dhcp6_packet.h:89
DHCPV6_RELAY_PKT_DROP_BAD_CONTEXT
Definition:
dhcp6_packet.h:162
src
vnet
dhcp
dhcp6_packet.h
Generated on Wed Sep 5 2018 06:02:30 for FD.io VPP by
1.8.11