FD.io VPP
v17.01.1-3-gc6833f8
Vector Packet Processing
Main Page
Related Pages
Data Structures
Source
Files
Symbols
packet.h
Go to the documentation of this file.
1
#ifndef included_vnet_dhcp_packet_h
2
#define included_vnet_dhcp_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
DHCPV6_MSG_SOLICIT
= 1,
36
DHCPV6_MSG_ADVERTISE
= 2,
37
DHCPV6_MSG_REQUEST
= 3,
38
DHCPV6_MSG_CONFIRM
= 4,
39
DHCPV6_MSG_RENEW
= 5,
40
DHCPV6_MSG_REBIND
= 6,
41
DHCPV6_MSG_REPLY
= 7,
42
DHCPV6_MSG_RELEASE
= 8,
43
DHCPV6_MSG_DECLINE
= 9,
44
DHCPV6_MSG_RECONFIGURE
= 10,
45
DHCPV6_MSG_INFORMATION_REQUEST
= 11,
46
DHCPV6_MSG_RELAY_FORW
= 12,
47
DHCPV6_MSG_RELAY_REPL
= 13,
48
}
dhcpv6_msg_type_t
;
49
50
/*
51
* DHCPv6 options types
52
*/
53
enum
{
54
DHCPV6_OPTION_CLIENTID
= 1,
55
DHCPV6_OPTION_SERVERID
= 2,
56
DHCPV6_OPTION_IA_NA
= 3,
57
DHCPV6_OPTION_IA_TA
= 4,
58
DHCPV6_OPTION_IAADDR
= 5,
59
DHCPV6_OPTION_ORO
= 6,
60
DHCPV6_OPTION_PREFERENCE
= 7,
61
DHCPV6_OPTION_ELAPSED_TIME
= 8,
62
DHCPV6_OPTION_RELAY_MSG
= 9,
63
DHCPV6_OPTION_AUTH
= 11,
64
DHCPV6_OPTION_UNICAST
= 12,
65
DHCPV6_OPTION_STATUS_CODE
= 13,
66
DHCPV6_OPTION_RAPID_COMMIT
= 14,
67
DHCPV6_OPTION_USER_CLASS
= 15,
68
DHCPV6_OPTION_VENDOR_CLASS
= 16,
69
DHCPV6_OPTION_VENDOR_OPTS
= 17,
70
DHCPV6_OPTION_INTERFACE_ID
= 18,
// relay agent fills this
71
DHCPV6_OPTION_RECONF_MSG
= 19,
72
DHCPV6_OPTION_RECONF_ACCEPT
= 20,
73
DHCPV6_OPTION_REMOTEID
= 37,
// relay agent fills this
74
DHCPV6_OPTION_VSS
= 68,
// relay agent fills this
75
DHCPV6_OPTION_CLIENT_LINK_LAYER_ADDRESS
= 79,
76
DHCPV6_OPTION_MAX
77
};
78
79
/*
80
* DHCPv6 status codes
81
*/
82
enum
{
83
DHCPV6_STATUS_SUCCESS
= 0,
84
DHCPV6_STATUS_UNSPEC_FAIL
= 1,
85
DHCPV6_STATUS_NOADDRS_AVAIL
= 2,
86
DHCPV6_STATUS_NO_BINDING
= 3,
87
DHCPV6_STATUS_NOT_ONLINK
= 4,
88
DHCPV6_STATUS_USE_MULTICAST
= 5,
89
};
90
91
/*
92
* DHCPv6 DUID types
93
*/
94
enum
{
95
DHCPV6_DUID_LLT
= 1,
/* DUID Based on Link-layer Address Plus Time */
96
DHCPV6_DUID_EN
= 2,
/* DUID Based on Enterprise Number */
97
DHCPV6_DUID_LL
= 3,
/* DUID Based on Link-layer Address */
98
};
99
100
//Structure for DHCPv6 payload from client
101
typedef
struct
dhcpv6_hdr_
{
102
union
{
103
u8
msg_type
;
//DHCP msg type
104
u32
xid
;
// transaction id
105
}
u
;
106
u8
data
[0];
107
}
dhcpv6_header_t
;
108
109
110
111
typedef
CLIB_PACKED
(
struct
dhcpv6_relay_ctx_ {
112
dhcpv6_header_t
*pkt;
113
u32
pkt_len;
114
u32
dhcpv6_len;
//DHCPv6 payload load
115
// if_ordinal iod;
116
u32
if_index;
117
u32
ctx_id;
118
char
ctx_name[32+1];
119
u8
dhcp_msg_type;
120
}) dhcpv6_relay_ctx_t;
121
122
//Structure for DHCPv6 RELAY-FORWARD and DHCPv6 RELAY-REPLY pkts
123
typedef
CLIB_PACKED
(
struct
dhcpv6_relay_hdr_ {
124
u8
msg_type
;
125
u8
hop_count;
126
ip6_address_t
link_addr;
127
ip6_address_t
peer_addr;
128
u8
data
[0];
129
}) dhcpv6_relay_hdr_t;
130
131
typedef
enum
dhcp_stats_action_type_
{
132
DHCP_STATS_ACTION_FORWARDED
=1,
133
DHCP_STATS_ACTION_RECEIVED
,
134
DHCP_STATS_ACTION_DROPPED
135
}
dhcp_stats_action_type_t
;
136
//Generic counters for a packet
137
typedef
struct
dhcp_stats_counters_
{
138
u64
rx_pkts
;
//counter for received pkts
139
u64
tx_pkts
;
//counter for forwarded pkts
140
u64
drops
;
//counter for dropped pkts
141
}
dhcp_stats_counters_t
;
142
143
144
typedef
enum
dhcpv6_stats_drop_reason_
{
145
DHCPV6_RELAY_PKT_DROP_RELAYDISABLE
= 1,
146
DHCPV6_RELAY_PKT_DROP_MAX_HOPS
,
147
DHCPV6_RELAY_PKT_DROP_VALIDATION_FAIL
,
148
DHCPV6_RELAY_PKT_DROP_UNKNOWN_OP_INTF
,
149
DHCPV6_RELAY_PKT_DROP_BAD_CONTEXT
,
150
DHCPV6_RELAY_PKT_DROP_OPT_INSERT_FAIL
,
151
DHCPV6_RELAY_PKT_DROP_REPLY_FROM_CLIENT
,
152
}
dhcpv6_stats_drop_reason_t
;
153
154
typedef
CLIB_PACKED
(
struct
{
155
u16
option;
156
u16
length;
157
u8
data
[0];
158
}) dhcpv6_option_t;
159
160
typedef
CLIB_PACKED
(
struct
{
161
dhcpv6_option_t opt;
162
u32
int_idx;
163
}) dhcpv6_int_id_t;
164
165
typedef
CLIB_PACKED
(
struct
{
166
dhcpv6_option_t opt;
167
u8
data
[8];
// data[0]:type, data[1..7]: VPN ID
168
}) dhcpv6_vss_t;
169
170
typedef
CLIB_PACKED
(
struct
{
171
dhcpv6_option_t opt;
172
u32
ent_num;
173
u32
rmt_id;
174
}) dhcpv6_rmt_id_t;
175
176
typedef
CLIB_PACKED
(
struct
{
177
dhcpv6_option_t opt;
178
u16
link_type;
179
u8
data
[6];
// data[0]:data[5]: MAC address
180
}) dhcpv6_client_mac_t;
181
182
183
#endif
/* included_vnet_dhcp_packet_h */
DHCPV6_OPTION_VENDOR_OPTS
Definition:
packet.h:69
DHCPV6_MSG_RELAY_FORW
Definition:
packet.h:46
DHCPV6_MSG_RENEW
Definition:
packet.h:39
dhcp_stats_counters_
Definition:
packet.h:137
dhcpv6_header_t
struct dhcpv6_hdr_ dhcpv6_header_t
DHCPV6_RELAY_PKT_DROP_RELAYDISABLE
Definition:
packet.h:145
DHCPV6_OPTION_PREFERENCE
Definition:
packet.h:60
DHCPV6_OPTION_USER_CLASS
Definition:
packet.h:67
DHCPV6_MSG_REPLY
Definition:
packet.h:41
ip6_packet.h
DHCPV6_OPTION_RECONF_MSG
Definition:
packet.h:71
DHCP_STATS_ACTION_FORWARDED
Definition:
packet.h:132
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
DHCPV6_RELAY_PKT_DROP_MAX_HOPS
Definition:
packet.h:146
DHCPV6_MSG_REQUEST
Definition:
packet.h:37
DHCPV6_MSG_ADVERTISE
Definition:
packet.h:36
DHCPV6_MSG_CONFIRM
Definition:
packet.h:38
DHCPV6_DUID_LLT
Definition:
packet.h:95
DHCPV6_OPTION_IA_NA
Definition:
packet.h:56
DHCPV6_MSG_RELEASE
Definition:
packet.h:42
DHCPV6_OPTION_RELAY_MSG
Definition:
packet.h:62
dhcp_stats_counters_::drops
u64 drops
Definition:
packet.h:140
DHCPV6_RELAY_PKT_DROP_UNKNOWN_OP_INTF
Definition:
packet.h:148
DHCPV6_OPTION_RAPID_COMMIT
Definition:
packet.h:66
DHCPV6_MSG_REBIND
Definition:
packet.h:40
DHCPV6_OPTION_VSS
Definition:
packet.h:74
u64
unsigned long u64
Definition:
types.h:89
DHCPV6_MSG_SOLICIT
Definition:
packet.h:35
dhcpv6_stats_drop_reason_t
enum dhcpv6_stats_drop_reason_ dhcpv6_stats_drop_reason_t
DHCPV6_STATUS_NOT_ONLINK
Definition:
packet.h:87
dhcpv6_msg_type_t
enum dhcpv6_msg_type_ dhcpv6_msg_type_t
DHCPV6_RELAY_PKT_DROP_OPT_INSERT_FAIL
Definition:
packet.h:150
DHCPV6_OPTION_VENDOR_CLASS
Definition:
packet.h:68
DHCPV6_OPTION_MAX
Definition:
packet.h:76
dhcpv6_msg_type_
dhcpv6_msg_type_
Definition:
packet.h:34
DHCP_STATS_ACTION_RECEIVED
Definition:
packet.h:133
DHCPV6_OPTION_AUTH
Definition:
packet.h:63
dhcp_stats_counters_::rx_pkts
u64 rx_pkts
Definition:
packet.h:138
DHCPV6_OPTION_SERVERID
Definition:
packet.h:55
DHCPV6_OPTION_IA_TA
Definition:
packet.h:57
DHCPV6_STATUS_SUCCESS
Definition:
packet.h:83
DHCPV6_OPTION_REMOTEID
Definition:
packet.h:73
DHCPV6_RELAY_PKT_DROP_VALIDATION_FAIL
Definition:
packet.h:147
DHCPV6_DUID_LL
Definition:
packet.h:97
DHCPV6_DUID_EN
Definition:
packet.h:96
DHCPV6_OPTION_CLIENTID
Definition:
packet.h:54
dhcpv6_hdr_::xid
u32 xid
Definition:
packet.h:104
DHCPV6_MSG_INFORMATION_REQUEST
Definition:
packet.h:45
DHCPV6_OPTION_ORO
Definition:
packet.h:59
DHCPV6_MSG_RELAY_REPL
Definition:
packet.h:47
DHCPV6_OPTION_RECONF_ACCEPT
Definition:
packet.h:72
dhcp_stats_counters_::tx_pkts
u64 tx_pkts
Definition:
packet.h:139
DHCPV6_OPTION_STATUS_CODE
Definition:
packet.h:65
DHCPV6_STATUS_USE_MULTICAST
Definition:
packet.h:88
dhcpv6_hdr_::data
u8 data[0]
Definition:
packet.h:106
DHCPV6_MSG_DECLINE
Definition:
packet.h:43
u32
unsigned int u32
Definition:
types.h:88
dhcpv6_hdr_
Definition:
packet.h:101
DHCPV6_RELAY_PKT_DROP_BAD_CONTEXT
Definition:
packet.h:149
dhcpv6_hdr_::msg_type
u8 msg_type
Definition:
packet.h:103
dhcp_stats_counters_t
struct dhcp_stats_counters_ dhcp_stats_counters_t
DHCP_STATS_ACTION_DROPPED
Definition:
packet.h:134
u16
unsigned short u16
Definition:
types.h:57
DHCPV6_OPTION_UNICAST
Definition:
packet.h:64
u8
unsigned char u8
Definition:
types.h:56
DHCPV6_RELAY_PKT_DROP_REPLY_FROM_CLIENT
Definition:
packet.h:151
dhcp_stats_action_type_
dhcp_stats_action_type_
Definition:
packet.h:131
DHCPV6_STATUS_NO_BINDING
Definition:
packet.h:86
DHCPV6_STATUS_NOADDRS_AVAIL
Definition:
packet.h:85
dhcpv6_hdr_::u
union dhcpv6_hdr_::@119 u
dhcpv6_stats_drop_reason_
dhcpv6_stats_drop_reason_
Definition:
packet.h:144
DHCPV6_OPTION_ELAPSED_TIME
Definition:
packet.h:61
DHCPV6_OPTION_CLIENT_LINK_LAYER_ADDRESS
Definition:
packet.h:75
DHCPV6_MSG_RECONFIGURE
Definition:
packet.h:44
DHCPV6_OPTION_INTERFACE_ID
Definition:
packet.h:70
ip6_address_t
Definition:
ip6_packet.h:46
dhcp_stats_action_type_t
enum dhcp_stats_action_type_ dhcp_stats_action_type_t
DHCPV6_OPTION_IAADDR
Definition:
packet.h:58
DHCPV6_STATUS_UNSPEC_FAIL
Definition:
packet.h:84
vnet
vnet
dhcpv6
packet.h
Generated on Mon May 15 2017 22:01:57 for FD.io VPP by
1.8.11