18
19 /*
20 * SVP protocol Definitions
21 */
22
23 #include <sys/types.h>
24 #include <inttypes.h>
25 #include <sys/ethernet.h>
26 #include <netinet/in.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /*
33 * SDC VXLAN Protocol Definitions
34 */
35
36 #define SVP_VERSION_ONE 1
37 #define SVP_VERSION_TWO 2
38 /* XXX KEBE SAYS -- we are not yet ready to bump this. */
39 #define SVP_CURRENT_VERSION SVP_VERSION_ONE
40
41 typedef struct svp_req {
42 uint16_t svp_ver;
43 uint16_t svp_op;
44 uint32_t svp_size;
45 uint32_t svp_id;
46 uint32_t svp_crc32;
47 } svp_req_t;
48
49 typedef enum svp_op {
50 SVP_R_UNKNOWN = 0x00,
51 SVP_R_PING = 0x01,
52 SVP_R_PONG = 0x02,
53 SVP_R_VL2_REQ = 0x03,
54 SVP_R_VL2_ACK = 0x04,
55 SVP_R_VL3_REQ = 0x05,
56 SVP_R_VL3_ACK = 0x06,
57 SVP_R_BULK_REQ = 0x07,
58 SVP_R_BULK_ACK = 0x08,
59 SVP_R_LOG_REQ = 0x09,
60 SVP_R_LOG_ACK = 0x0A,
61 SVP_R_LOG_RM = 0x0B,
62 SVP_R_LOG_RM_ACK = 0x0C,
63 SVP_R_SHOOTDOWN = 0x0D,
64 SVP_R_ROUTE_REQ = 0x0E,
65 SVP_R_ROUTE_ACK = 0x0F
66 } svp_op_t;
67
68 typedef enum svp_status {
69 SVP_S_OK = 0x00, /* Everything OK */
70 SVP_S_FATAL = 0x01, /* Fatal error, close connection */
71 SVP_S_NOTFOUND = 0x02, /* Entry not found */
72 SVP_S_BADL3TYPE = 0x03, /* Unknown svp_vl3_type_t */
73 SVP_S_BADBULK = 0x04 /* Unknown svp_bulk_type_t */
74 } svp_status_t;
75
76 /*
77 * A client issues the SVP_R_VL2_REQ whenever it needs to perform a VL2->UL3
78 * lookup. Requests have the following structure:
79 */
80 typedef struct svp_vl2_req {
81 uint8_t sl2r_mac[ETHERADDRL];
82 uint8_t sl2r_pad[2];
83 uint32_t sl2r_vnetid;
84 } svp_vl2_req_t;
85
157 * may return less than svlr_count bytes back. We identify the IP address of the
158 * underlay to use here explicitly.
159 */
160 typedef struct svp_log_req {
161 uint32_t svlr_count;
162 uint8_t svlr_ip[16];
163 } svp_log_req_t;
164
165 /*
166 * The server replies to a log request by sending a series of log entries.
167 * These log entries may be a mixture of both vl2 and vl3 records. The reply is
168 * a stream of bytes after the status message whose length is determined baseed
169 * on the header itself. Each entry begins with a uint32_t that describes its
170 * type and then is followed by the remaining data payload. The next entry
171 * follows immediately which again begins with the uint32_t word that describes
172 * what it should be.
173 */
174 typedef enum svp_log_type {
175 SVP_LOG_VL2 = 0x01,
176 SVP_LOG_VL3 = 0x02,
177 SVP_LOG_ROUTE = 0x03
178 } svp_log_type_t;
179
180 typedef struct svp_log_vl2 {
181 uint32_t svl2_type; /* Should be SVP_LOG_VL2 */
182 uint8_t svl2_id[16]; /* 16-byte UUID */
183 uint8_t svl2_mac[ETHERADDRL];
184 uint8_t svl2_pad[2];
185 uint32_t svl2_vnetid;
186 } svp_log_vl2_t;
187
188 typedef struct svp_log_vl3 {
189 uint32_t svl3_type; /* Should be SVP_LOG_VL3 */
190 uint8_t svl3_id[16]; /* 16-byte UUID */
191 uint8_t svl3_ip[16];
192 uint8_t svl3_pad[2];
193 uint16_t svl3_vlan;
194 uint32_t svl3_vnetid;
195 } svp_log_vl3_t;
196
197 typedef struct svp_log_route {
198 uint32_t svlr_type; /* Should be SVP_LOG_ROUTE */
199 uint8_t svlr_id[16]; /* 16-byte UUID */
200 uint32_t svlr_src_vnetid; /* Source VXLAN vnetid. */
201 uint32_t svlr_dst_vnetid; /* Dest. VXLAN vnetid. */
202 uint32_t svlr_dcid; /* Remote/dest Data Center ID. */
203 uint8_t svlr_srcip[16]; /* Source IP address base. */
204 uint8_t svlr_dstip[16]; /* Destination IP address base. */
205 uint16_t svlr_dst_vlan; /* Source VLAN id. */
206 uint16_t svlr_src_vlan; /* Destination VLAN id. */
207 uint8_t svlr_src_prefixlen; /* Source IP prefix length. */
208 uint8_t svlr_dst_prefixlen; /* Dest. IP prefix length. */
209 uint16_t svlr_pad; /* So we can be aligned... */
210 } svp_log_route_t;
211
212 typedef struct svp_log_ack {
213 uint32_t svla_status;
214 uint8_t svla_data[];
215 } svp_log_ack_t;
216
238 * A shootdown (SVP_R_SHOOTDOWN) is used by a CN to reply to another CN that it
239 * sent an invalid entry that could not be processed. This should be a
240 * relatively infrequent occurrence. Unlike the rest of the messages, there is
241 * no reply to it. It's a single request to try and help get us out there. When
242 * a node receives this, it will issue a conditional revocation ioctl, that
243 * removes the entry if and only if, it matches the IP. That way if we've
244 * already gotten an updated entry for this, we don't remove it again.
245 */
246 typedef struct svp_shootdown {
247 uint8_t svsd_mac[ETHERADDRL];
248 uint8_t svsd_pad[2];
249 uint32_t svsd_vnetid;
250 } svp_shootdown_t;
251
252 /*
253 * A route-request (SVP_R_ROUTE_REQ) queries the local SVP server to get a
254 * far-remote (i.e. another Triton Data Center, nee. SDC) SVP server for
255 * far-remote networks. Modern overlay modules will request IP destinations
256 * for remote-Triton networks, but they must know how to reach the
257 * remote-Triton SVP server.
258 */
259 typedef struct svp_route_req {
260 uint32_t srr_vnetid; /* Requester's vnet ID. */
261 uint16_t srr_vlan; /* Requester's VLAN ID. */
262 uint16_t srr_pad; /* Zero on xmit, ignore on receipt. */
263 uint8_t srr_srcip[16]; /* VL3 Source IP. */
264 uint8_t srr_dstip[16]; /* VL3 Destination IP. */
265 } svp_route_req_t;
266
267 /*
268 * The far-remote Triton Data Center will answer with the requisite information
269 * to send overlay packets to the appropriate far-remote CNs.
270 */
271 typedef struct svp_route_ack {
272 uint32_t sra_status; /* Status. */
273 uint32_t sra_dcid; /* Far-remote Data Center ID. */
274 uint32_t sra_vnetid; /* Far-remote vnet ID. */
275 uint16_t sra_vlan; /* Far-remote VLAN ID. */
276 uint16_t sra_port; /* Destination UL3 port. */
277 uint8_t sra_ip[16]; /* Destination UL3 address. */
|
18
19 /*
20 * SVP protocol Definitions
21 */
22
23 #include <sys/types.h>
24 #include <inttypes.h>
25 #include <sys/ethernet.h>
26 #include <netinet/in.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /*
33 * SDC VXLAN Protocol Definitions
34 */
35
36 #define SVP_VERSION_ONE 1
37 #define SVP_VERSION_TWO 2
38 /*
39 * Bump this to 2. Version 1 SVP is a subset of version 2, and can be
40 * determined using an SVP_R_PING as part of connection establishment.
41 * Version-2 specific changes will be highlighed (look for "v2").
42 */
43 #define SVP_CURRENT_VERSION SVP_VERSION_TWO
44
45 typedef struct svp_req {
46 uint16_t svp_ver;
47 uint16_t svp_op;
48 uint32_t svp_size;
49 uint32_t svp_id;
50 uint32_t svp_crc32;
51 } svp_req_t;
52
53 /*
54 * Unless specified, all message types function identically between v1 and v2
55 * of SVP.
56 */
57 typedef enum svp_op {
58 SVP_R_UNKNOWN = 0x00,
59 SVP_R_PING = 0x01,
60 SVP_R_PONG = 0x02,
61 SVP_R_VL2_REQ = 0x03,
62 SVP_R_VL2_ACK = 0x04,
63 SVP_R_VL3_REQ = 0x05,
64 SVP_R_VL3_ACK = 0x06,
65 SVP_R_BULK_REQ = 0x07,
66 SVP_R_BULK_ACK = 0x08,
67 SVP_R_LOG_REQ = 0x09,
68 SVP_R_LOG_ACK = 0x0A,
69 SVP_R_LOG_RM = 0x0B, /* v2 introduces new log type */
70 SVP_R_LOG_RM_ACK = 0x0C, /* See svp_log_route_t */
71 SVP_R_SHOOTDOWN = 0x0D,
72 SVP_R_ROUTE_REQ = 0x0E, /* v2 only */
73 SVP_R_ROUTE_ACK = 0x0F /* v2 only */
74 } svp_op_t;
75
76 typedef enum svp_status {
77 SVP_S_OK = 0x00, /* Everything OK */
78 SVP_S_FATAL = 0x01, /* Fatal error, close connection */
79 SVP_S_NOTFOUND = 0x02, /* Entry not found */
80 SVP_S_BADL3TYPE = 0x03, /* Unknown svp_vl3_type_t */
81 SVP_S_BADBULK = 0x04 /* Unknown svp_bulk_type_t */
82 } svp_status_t;
83
84 /*
85 * A client issues the SVP_R_VL2_REQ whenever it needs to perform a VL2->UL3
86 * lookup. Requests have the following structure:
87 */
88 typedef struct svp_vl2_req {
89 uint8_t sl2r_mac[ETHERADDRL];
90 uint8_t sl2r_pad[2];
91 uint32_t sl2r_vnetid;
92 } svp_vl2_req_t;
93
165 * may return less than svlr_count bytes back. We identify the IP address of the
166 * underlay to use here explicitly.
167 */
168 typedef struct svp_log_req {
169 uint32_t svlr_count;
170 uint8_t svlr_ip[16];
171 } svp_log_req_t;
172
173 /*
174 * The server replies to a log request by sending a series of log entries.
175 * These log entries may be a mixture of both vl2 and vl3 records. The reply is
176 * a stream of bytes after the status message whose length is determined baseed
177 * on the header itself. Each entry begins with a uint32_t that describes its
178 * type and then is followed by the remaining data payload. The next entry
179 * follows immediately which again begins with the uint32_t word that describes
180 * what it should be.
181 */
182 typedef enum svp_log_type {
183 SVP_LOG_VL2 = 0x01,
184 SVP_LOG_VL3 = 0x02,
185 SVP_LOG_ROUTE = 0x03 /* v2 only */
186 } svp_log_type_t;
187
188 typedef struct svp_log_vl2 {
189 uint32_t svl2_type; /* Should be SVP_LOG_VL2 */
190 uint8_t svl2_id[16]; /* 16-byte UUID */
191 uint8_t svl2_mac[ETHERADDRL];
192 uint8_t svl2_pad[2];
193 uint32_t svl2_vnetid;
194 } svp_log_vl2_t;
195
196 typedef struct svp_log_vl3 {
197 uint32_t svl3_type; /* Should be SVP_LOG_VL3 */
198 uint8_t svl3_id[16]; /* 16-byte UUID */
199 uint8_t svl3_ip[16];
200 uint8_t svl3_pad[2];
201 uint16_t svl3_vlan;
202 uint32_t svl3_vnetid;
203 } svp_log_vl3_t;
204
205 /*
206 * This log entry only appears on v2 connections.
207 */
208 typedef struct svp_log_route {
209 uint32_t svlr_type; /* Should be SVP_LOG_ROUTE */
210 uint8_t svlr_id[16]; /* 16-byte UUID */
211 uint32_t svlr_src_vnetid; /* Source VXLAN vnetid. */
212 uint32_t svlr_dst_vnetid; /* Dest. VXLAN vnetid. */
213 uint32_t svlr_dcid; /* Remote/dest Data Center ID. */
214 uint8_t svlr_srcip[16]; /* Source IP address base. */
215 uint8_t svlr_dstip[16]; /* Destination IP address base. */
216 uint16_t svlr_dst_vlan; /* Source VLAN id. */
217 uint16_t svlr_src_vlan; /* Destination VLAN id. */
218 uint8_t svlr_src_prefixlen; /* Source IP prefix length. */
219 uint8_t svlr_dst_prefixlen; /* Dest. IP prefix length. */
220 uint16_t svlr_pad; /* So we can be aligned... */
221 } svp_log_route_t;
222
223 typedef struct svp_log_ack {
224 uint32_t svla_status;
225 uint8_t svla_data[];
226 } svp_log_ack_t;
227
249 * A shootdown (SVP_R_SHOOTDOWN) is used by a CN to reply to another CN that it
250 * sent an invalid entry that could not be processed. This should be a
251 * relatively infrequent occurrence. Unlike the rest of the messages, there is
252 * no reply to it. It's a single request to try and help get us out there. When
253 * a node receives this, it will issue a conditional revocation ioctl, that
254 * removes the entry if and only if, it matches the IP. That way if we've
255 * already gotten an updated entry for this, we don't remove it again.
256 */
257 typedef struct svp_shootdown {
258 uint8_t svsd_mac[ETHERADDRL];
259 uint8_t svsd_pad[2];
260 uint32_t svsd_vnetid;
261 } svp_shootdown_t;
262
263 /*
264 * A route-request (SVP_R_ROUTE_REQ) queries the local SVP server to get a
265 * far-remote (i.e. another Triton Data Center, nee. SDC) SVP server for
266 * far-remote networks. Modern overlay modules will request IP destinations
267 * for remote-Triton networks, but they must know how to reach the
268 * remote-Triton SVP server.
269 *
270 * NOTE: SVP_R_ROUTE_{REQ,ACK} are only present in SVP v2.
271 */
272 typedef struct svp_route_req {
273 uint32_t srr_vnetid; /* Requester's vnet ID. */
274 uint16_t srr_vlan; /* Requester's VLAN ID. */
275 uint16_t srr_pad; /* Zero on xmit, ignore on receipt. */
276 uint8_t srr_srcip[16]; /* VL3 Source IP. */
277 uint8_t srr_dstip[16]; /* VL3 Destination IP. */
278 } svp_route_req_t;
279
280 /*
281 * The far-remote Triton Data Center will answer with the requisite information
282 * to send overlay packets to the appropriate far-remote CNs.
283 */
284 typedef struct svp_route_ack {
285 uint32_t sra_status; /* Status. */
286 uint32_t sra_dcid; /* Far-remote Data Center ID. */
287 uint32_t sra_vnetid; /* Far-remote vnet ID. */
288 uint16_t sra_vlan; /* Far-remote VLAN ID. */
289 uint16_t sra_port; /* Destination UL3 port. */
290 uint8_t sra_ip[16]; /* Destination UL3 address. */
|