FD.io VPP  v21.01.1
Vector Packet Processing
ikev2_payload.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <ctype.h>
17 
18 #include <vnet/vnet.h>
19 #include <vnet/api_errno.h>
20 #include <vnet/ip/ip.h>
21 #include <vnet/interface.h>
22 
23 #include <vnet/ipsec/ipsec.h>
24 #include <plugins/ikev2/ikev2.h>
26 
27 /* *INDENT-OFF* */
28 typedef CLIB_PACKED (struct {
29  u8 nextpayload;
30  u8 flags;
31  u16 length;
33  u8 spi_size;
34  u16 msg_type;
35  u8 payload[0];
36 }) ike_notify_payload_header_t;
37 /* *INDENT-ON* */
38 
39 /* *INDENT-OFF* */
40 typedef CLIB_PACKED (struct {
44 
45 typedef CLIB_PACKED (struct {
46  ip6_address_t start_addr;
47  ip6_address_t end_addr;
48 }) ikev2_ip6_addr_pair_t;
49 
50 typedef CLIB_PACKED (struct {
51  u8 ts_type;
53  u16 selector_len;
55  u16 end_port;
56  u8 addr_pair[0];
58 /* *INDENT-OFF* */
59 
60 /* *INDENT-OFF* */
61 typedef CLIB_PACKED (struct {
62  u8 nextpayload;
63  u8 flags;
64  u16 length;
65  u8 num_ts;
66  u8 reserved[3];
68 }) ike_ts_payload_header_t;
69 /* *INDENT-OFF* */
70 
71 /* *INDENT-OFF* */
72 typedef CLIB_PACKED (struct {
73  u8 last_or_more;
74  u8 reserved;
75  u16 proposal_len;
76  u8 proposal_num;
78  u8 spi_size;
79  u8 num_transforms; u32 spi[0];
81 /* *INDENT-OFF* */
82 
83 /* *INDENT-OFF* */
84 typedef CLIB_PACKED (struct {
85  u8 last_or_more;
86  u8 reserved;
87  u16 transform_len;
88  u8 transform_type;
89  u8 reserved2;
91  u8 attributes[0];
92 }) ike_sa_transform_data_t;
93 /* *INDENT-OFF* */
94 
95 /* *INDENT-OFF* */
96 typedef CLIB_PACKED (struct {
97  u8 nextpayload;
98  u8 flags;
99  u16 length;
100  u8 protocol_id;
101  u8 spi_size;
102  u16 num_of_spi;
103  u32 spi[0];
105 /* *INDENT-OFF* */
106 
107 static ike_payload_header_t *
109 {
110  ike_payload_header_t *hdr =
111  (ike_payload_header_t *) & c->data[c->last_hdr_off];
112  u8 *tmp;
113 
114  if (c->data)
115  hdr->nextpayload = payload_type;
116  else
117  c->first_payload_type = payload_type;
118 
119  c->last_hdr_off = vec_len (c->data);
120  vec_add2 (c->data, tmp, len);
121  hdr = (ike_payload_header_t *) tmp;
122  clib_memset (hdr, 0, len);
123 
124  hdr->length = clib_host_to_net_u16 (len);
125 
126  return hdr;
127 }
128 
129 static void
131 {
132  u16 len;
133  ike_payload_header_t *hdr;
134 
135  vec_append (c->data, data);
136  hdr = (ike_payload_header_t *) & c->data[c->last_hdr_off];
137  len = clib_net_to_host_u16 (hdr->length);
138  hdr->length = clib_host_to_net_u16 (len + vec_len (data));
139 }
140 
141 void
143 {
144  ikev2_payload_add_notify_2(c, msg_type, data, 0);
145 }
146 
147 void
149  u8 * data, ikev2_notify_t * notify)
150 {
151  ike_notify_payload_header_t *n;
152 
153  n =
154  (ike_notify_payload_header_t *) ikev2_payload_add_hdr (c,
156  sizeof (*n));
157  n->msg_type = clib_host_to_net_u16 (msg_type);
158  if (notify)
159  {
160  n->protocol_id = notify->protocol_id;
161  if (notify->spi)
162  {
163  n->spi_size = 4;
164  }
165  }
166  ikev2_payload_add_data (c, data);
167 }
168 
169 void
171  ikev2_sa_proposal_t * proposals)
172 {
173  ike_payload_header_t *ph;
175  ike_sa_transform_data_t *tr;
178 
179  u8 *tmp;
180  u8 *pr_data = 0;
181  u8 *tr_data = 0;
182 
183  ikev2_payload_add_hdr (c, IKEV2_PAYLOAD_SA, sizeof (*ph));
184 
185  vec_foreach (p, proposals)
186  {
187  int spi_size = (p->protocol_id == IKEV2_PROTOCOL_ESP) ? 4 : 0;
188  pr_data = vec_new (u8, sizeof (ike_sa_proposal_data_t) + spi_size);
189  prop = (ike_sa_proposal_data_t *) pr_data;
190  prop->last_or_more = proposals - p + 1 < vec_len (proposals) ? 2 : 0;
191  prop->protocol_id = p->protocol_id;
192  prop->proposal_num = p->proposal_num;
193  prop->spi_size = spi_size;
194  prop->num_transforms = vec_len (p->transforms);
195 
196  if (spi_size)
197  prop->spi[0] = clib_host_to_net_u32 (p->spi);
198 
199  vec_foreach (t, p->transforms)
200  {
201  vec_add2 (tr_data, tmp, sizeof (*tr) + vec_len (t->attrs));
202  tr = (ike_sa_transform_data_t *) tmp;
203  tr->last_or_more =
204  ((t - p->transforms) + 1 < vec_len (p->transforms)) ? 3 : 0;
205  tr->transform_type = t->type;
206  tr->transform_id = clib_host_to_net_u16 (t->transform_id);
207  tr->transform_len =
208  clib_host_to_net_u16 (sizeof (*tr) + vec_len (t->attrs));
209 
210  if (vec_len (t->attrs) > 0)
211  clib_memcpy_fast (tr->attributes, t->attrs, vec_len (t->attrs));
212  }
213 
214  prop->proposal_len =
215  clib_host_to_net_u16 (vec_len (tr_data) + vec_len (pr_data));
216  ikev2_payload_add_data (c, pr_data);
217  ikev2_payload_add_data (c, tr_data);
218  vec_free (pr_data);
219  vec_free (tr_data);
220  }
221 }
222 
223 void
225 {
226  ike_ke_payload_header_t *ke;
227  ke = (ike_ke_payload_header_t *) ikev2_payload_add_hdr (c, IKEV2_PAYLOAD_KE,
228  sizeof (*ke));
229 
230  ke->dh_group = clib_host_to_net_u16 (dh_group);
231  ikev2_payload_add_data (c, dh_data);
232 }
233 
234 void
236 {
238  sizeof (ike_payload_header_t));
239  ikev2_payload_add_data (c, nonce);
240 }
241 
242 void
244 {
245  ike_id_payload_header_t *idp;
246  idp =
247  (ike_id_payload_header_t *) ikev2_payload_add_hdr (c, type,
248  sizeof (*idp));
249 
250  idp->id_type = id->type;
251  ikev2_payload_add_data (c, id->data);
252 }
253 
254 void
256 {
258  u16 num_of_spi = vec_len (d);
259  ikev2_delete_t *d2;
260  dp =
263  sizeof (*dp));
264 
265  if (d[0].protocol_id == IKEV2_PROTOCOL_IKE)
266  {
267  dp->protocol_id = 1;
268  }
269  else
270  {
271  dp->protocol_id = d[0].protocol_id;
272  dp->spi_size = 4;
273  dp->num_of_spi = clib_host_to_net_u16 (num_of_spi);
274  vec_foreach (d2, d)
275  {
276  u8 *data = vec_new (u8, 4);
277  u32 spi = clib_host_to_net_u32 (d2->spi);
278  clib_memcpy (data, &spi, 4);
279  ikev2_payload_add_data (c, data);
280  vec_free (data);
281  }
282  }
283 }
284 
285 void
287 {
288  ike_auth_payload_header_t *ap;
289  ap =
290  (ike_auth_payload_header_t *) ikev2_payload_add_hdr (c,
292  sizeof (*ap));
293 
294  ap->auth_method = auth->method;
295  ikev2_payload_add_data (c, auth->data);
296 }
297 
298 static void
300 {
301  u8 * tmp;
303  int len = sizeof (*entry);
304 
305  if (ts->ts_type == TS_IPV4_ADDR_RANGE)
306  len += sizeof (ikev2_ip4_addr_pair_t);
307  else
308  len += sizeof (ikev2_ip6_addr_pair_t);
309 
310  vec_add2 (data[0], tmp, len);
311  entry = (ikev2_ts_payload_entry_t *) tmp;
312  entry->ts_type = ts->ts_type;
313  entry->protocol_id = ts->protocol_id;
314  entry->selector_len = clib_host_to_net_u16 (len);
315  entry->start_port = clib_host_to_net_u16 (ts->start_port);
316  entry->end_port = clib_host_to_net_u16 (ts->end_port);
317 
318  if (ts->ts_type == TS_IPV4_ADDR_RANGE)
319  {
320  ikev2_ip4_addr_pair_t *pair = (ikev2_ip4_addr_pair_t*) entry->addr_pair;
321  ip_address_copy_addr (&pair->start_addr, &ts->start_addr);
322  ip_address_copy_addr (&pair->end_addr, &ts->end_addr);
323  }
324  else
325  {
326  ikev2_ip6_addr_pair_t *pair = (ikev2_ip6_addr_pair_t*) entry->addr_pair;
327  ip_address_copy_addr (&pair->start_addr, &ts->start_addr);
328  ip_address_copy_addr (&pair->end_addr, &ts->end_addr);
329  }
330 }
331 
332 void
334 {
335  ike_ts_payload_header_t *tsh;
336  ikev2_ts_t *ts2;
337  u8 *data = 0;
338 
339  tsh =
340  (ike_ts_payload_header_t *) ikev2_payload_add_hdr (c, type,
341  sizeof (*tsh));
342  tsh->num_ts = vec_len (ts);
343 
344  vec_foreach (ts2, ts)
345  {
346  ASSERT (ts2->ts_type == TS_IPV4_ADDR_RANGE ||
347  ts2->ts_type == TS_IPV6_ADDR_RANGE);
348  ikev2_payload_add_ts_entry (&data, ts2);
349  }
350 
351  ikev2_payload_add_data (c, data);
352  vec_free (data);
353 }
354 
355 void
357 {
358  u8 *tmp __attribute__ ((unused));
359  u8 pad_len = (vec_len (c->data) / bs + 1) * bs - vec_len (c->data);
360  vec_add2 (c->data, tmp, pad_len);
361  c->data[vec_len (c->data) - 1] = pad_len - 1;
362 }
363 
365 ikev2_parse_sa_payload (ike_payload_header_t * ikep, u32 rlen)
366 {
367  ikev2_sa_proposal_t *v = 0;
368  ikev2_sa_proposal_t *proposal;
369  ikev2_sa_transform_t *transform;
370 
371  u32 plen = clib_net_to_host_u16 (ikep->length);
373  int proposal_ptr = 0;
374 
375  if (sizeof (*ikep) > rlen)
376  return 0;
377 
378  rlen -= sizeof (*ikep);
379  do
380  {
381  if (proposal_ptr + sizeof (*sap) > rlen)
382  goto data_corrupted;
383 
384  sap = (ike_sa_proposal_data_t *) & ikep->payload[proposal_ptr];
385  int i, transform_ptr;
386 
387  /* IKE proposal should not have SPI */
388  if (sap->protocol_id == IKEV2_PROTOCOL_IKE && sap->spi_size != 0)
389  goto data_corrupted;
390 
391  /* IKE proposal should not have SPI */
392  if (sap->protocol_id == IKEV2_PROTOCOL_ESP && sap->spi_size != 4)
393  goto data_corrupted;
394 
395  transform_ptr = proposal_ptr + sizeof (*sap) + sap->spi_size;
396  if (transform_ptr > rlen)
397  goto data_corrupted;
398 
399  vec_add2 (v, proposal, 1);
400  proposal->proposal_num = sap->proposal_num;
401  proposal->protocol_id = sap->protocol_id;
402 
403  if (sap->spi_size == 4)
404  {
405  proposal->spi = clib_net_to_host_u32 (sap->spi[0]);
406  }
407 
408  for (i = 0; i < sap->num_transforms; i++)
409  {
410  ike_sa_transform_data_t *tr =
411  (ike_sa_transform_data_t *) & ikep->payload[transform_ptr];
412  if (transform_ptr + sizeof (*tr) > rlen)
413  goto data_corrupted;
414  u16 tlen = clib_net_to_host_u16 (tr->transform_len);
415 
416  if (tlen < sizeof (*tr))
417  goto data_corrupted;
418 
419  vec_add2 (proposal->transforms, transform, 1);
420 
421  transform->type = tr->transform_type;
422  transform->transform_id = clib_net_to_host_u16 (tr->transform_id);
423  if (transform_ptr + tlen > rlen)
424  goto data_corrupted;
425  if (tlen > sizeof (*tr))
426  vec_add (transform->attrs, tr->attributes, tlen - sizeof (*tr));
427  transform_ptr += tlen;
428  }
429 
430  proposal_ptr += clib_net_to_host_u16 (sap->proposal_len);
431  }
432  while (proposal_ptr < (plen - sizeof (*ikep)) && sap->last_or_more == 2);
433 
434  /* data validation */
435  if (proposal_ptr != (plen - sizeof (*ikep)) || sap->last_or_more)
436  goto data_corrupted;
437 
438  return v;
439 
440 data_corrupted:
441  ikev2_elog_detail ("SA payload data corrupted");
443  return 0;
444 }
445 
446 ikev2_ts_t *
447 ikev2_parse_ts_payload (ike_payload_header_t * ikep, u32 rlen)
448 {
449  ike_ts_payload_header_t *tsp = (ike_ts_payload_header_t *) ikep;
450  ikev2_ts_t *r = 0, *ts;
451  ikev2_ip4_addr_pair_t *pair4;
452  ikev2_ip6_addr_pair_t *pair6;
453  int p = 0, n_left;
455 
456  if (sizeof (*tsp) > rlen)
457  return 0;
458 
459  rlen -= sizeof (*tsp);
460  n_left = tsp->num_ts;
461 
462  while (n_left && p + sizeof (*pe) < rlen)
463  {
464  pe = (ikev2_ts_payload_entry_t *) (((u8 *)tsp->ts) + p);
465  p += sizeof (*pe);
466 
467  if (pe->ts_type != TS_IPV4_ADDR_RANGE &&
468  pe->ts_type != TS_IPV6_ADDR_RANGE)
469  {
470  ikev2_elog_uint (IKEV2_LOG_ERROR,
471  "unsupported TS type received (%u)", pe->ts_type);
472  return 0;
473  }
474 
475  vec_add2 (r, ts, 1);
476  ts->ts_type = pe->ts_type;
477  ts->protocol_id = pe->protocol_id;
478  ts->start_port = pe->start_port;
479  ts->end_port = pe->end_port;
480 
481  if (pe->ts_type == TS_IPV4_ADDR_RANGE)
482  {
483  pair4 = (ikev2_ip4_addr_pair_t*) pe->addr_pair;
484  ip_address_set (&ts->start_addr, &pair4->start_addr, AF_IP4);
485  ip_address_set (&ts->end_addr, &pair4->end_addr, AF_IP4);
486  p += sizeof (*pair4);
487  }
488  else
489  {
490  pair6 = (ikev2_ip6_addr_pair_t*) pe->addr_pair;
491  ip_address_set (&ts->start_addr, &pair6->start_addr, AF_IP6);
492  ip_address_set (&ts->end_addr, &pair6->end_addr, AF_IP6);
493  p += sizeof (*pair6);
494  }
495  n_left--;
496  }
497 
498  if (n_left)
499  return 0;
500 
501  return r;
502 }
503 
505 ikev2_parse_notify_payload (ike_payload_header_t * ikep, u32 rlen)
506 {
507  ike_notify_payload_header_t *n = (ike_notify_payload_header_t *) ikep;
508  u32 plen = clib_net_to_host_u16 (n->length);
509  ikev2_notify_t *r = 0;
510  u32 spi;
511 
512  if (sizeof (*n) > rlen)
513  return 0;
514 
515  r = vec_new (ikev2_notify_t, 1);
516  r->msg_type = clib_net_to_host_u16 (n->msg_type);
517  r->protocol_id = n->protocol_id;
518 
519  if (n->spi_size == 4)
520  {
521  if (sizeof (spi) + sizeof (*n) > rlen)
522  goto cleanup;
523 
524  clib_memcpy (&spi, n->payload, n->spi_size);
525  r->spi = clib_net_to_host_u32 (spi);
526  }
527  else if (n->spi_size == 0)
528  {
529  r->spi = 0;
530  }
531  else
532  {
533  clib_warning ("invalid SPI Size %d", n->spi_size);
534  goto cleanup;
535  }
536 
537  if (plen > (sizeof (*n) + n->spi_size))
538  {
539  if (plen <= sizeof (*n) + n->spi_size)
540  goto cleanup;
541 
542  u32 data_len = plen - sizeof (*n) - n->spi_size;
543  vec_add (r->data, n->payload + n->spi_size, data_len);
544  }
545  return r;
546 
547 cleanup:
548  vec_free (r);
549  return 0;
550 }
551 
552 void
553 ikev2_parse_vendor_payload (ike_payload_header_t * ikep)
554 {
555  u32 plen = clib_net_to_host_u16 (ikep->length);
556  ikev2_elog_uint (IKEV2_LOG_DEBUG, "vendor payload skipped, len %d", plen);
557 }
558 
560 ikev2_parse_delete_payload (ike_payload_header_t * ikep, u32 rlen)
561 {
563  ikev2_delete_t *r = 0, *del;
564  u16 i, num_of_spi;
565 
566  if (rlen < sizeof (*d))
567  return 0;
568 
569  num_of_spi = clib_net_to_host_u16 (d->num_of_spi);
570  if (d->protocol_id == IKEV2_PROTOCOL_IKE)
571  {
572  r = vec_new (ikev2_delete_t, 1);
573  r->protocol_id = 1;
574  }
575  else
576  {
577  if (sizeof (*d) + num_of_spi * sizeof (u32) > rlen)
578  return 0;
579 
580  for (i = 0; i < num_of_spi; i++)
581  {
582  vec_add2 (r, del, 1);
583  del->protocol_id = d->protocol_id;
584  del->spi = clib_net_to_host_u32 (d->spi[i]);
585  }
586  }
587 
588  return r;
589 }
590 
591 u8 *
592 ikev2_find_ike_notify_payload (ike_header_t * ike, u32 msg_type)
593 {
594  int p = 0;
595  ike_notify_payload_header_t *n;
596  ike_payload_header_t *ikep;
597  u32 payload = ike->nextpayload;
598 
599  while (payload != IKEV2_PAYLOAD_NONE)
600  {
601  ikep = (ike_payload_header_t *) & ike->payload[p];
602  if (payload == IKEV2_PAYLOAD_NOTIFY)
603  {
604  n = (ike_notify_payload_header_t *)ikep;
605  if (n->msg_type == clib_net_to_host_u16 (msg_type))
606  return n->payload;
607  }
608  u16 plen = clib_net_to_host_u16 (ikep->length);
609  payload = ikep->nextpayload;
610  p += plen;
611  }
612  return 0;
613 }
614 
615 /*
616  * fd.io coding-style-patch-verification: ON
617  *
618  * Local Variables:
619  * eval: (c-set-style "gnu")
620  * End:
621  */
vl_api_address_t end_addr
Definition: ikev2_types.api:38
void ikev2_payload_add_nonce(ikev2_payload_chain_t *c, u8 *nonce)
ikev2_transform_type_t type
Definition: ikev2_priv.h:215
#define IKEV2_PAYLOAD_NONCE
Definition: ikev2.h:113
void ikev2_payload_add_notify(ikev2_payload_chain_t *c, u16 msg_type, u8 *data)
ip_address_t end_addr
Definition: ikev2_priv.h:253
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105
void ip_address_set(ip_address_t *dst, const void *src, u8 version)
Definition: ip_types.c:208
void ikev2_payload_add_sa(ikev2_payload_chain_t *c, ikev2_sa_proposal_t *proposals)
ikev2_traffic_selector_type_t ts_type
Definition: ikev2_priv.h:247
#define IKEV2_PAYLOAD_NONE
Definition: ikev2.h:105
vl_api_ikev2_auth_t auth
Definition: ikev2_types.api:88
vl_api_address_t start_addr
Definition: ikev2_types.api:37
#define clib_memcpy_fast(a, b, c)
Definition: string.h:81
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
Definition: vec.h:630
void ikev2_payload_add_ke(ikev2_payload_chain_t *c, u16 dh_group, u8 *dh_data)
u16 start_port
Definition: ikev2_types.api:35
u8 dh_group
Definition: ikev2_types.api:60
ikev2_ts_payload_entry_t
Definition: ikev2_payload.c:57
unsigned char u8
Definition: types.h:56
u8 data[128]
Definition: ipsec_types.api:90
u16 end_port
Definition: ikev2_types.api:36
#define clib_memcpy(d, s, n)
Definition: string.h:180
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
Definition: vec.h:668
#define IKEV2_PAYLOAD_DELETE
Definition: ikev2.h:115
#define vec_new(T, N)
Create new vector of given type and length (unspecified alignment, no header).
Definition: vec.h:350
void ikev2_parse_vendor_payload(ike_payload_header_t *ikep)
void ikev2_payload_add_id(ikev2_payload_chain_t *c, ikev2_id_t *id, u8 type)
#define IKEV2_PAYLOAD_NOTIFY
Definition: ikev2.h:114
unsigned int u32
Definition: types.h:88
#define ikev2_elog_detail(_msg)
Definition: ikev2_priv.h:176
ikev2_sa_transform_t * transforms
Definition: ikev2_priv.h:242
pool_header_t * ph(void *p)
GDB callable function: ph - call pool_header - get pool header.
Definition: gdb_funcs.c:78
void ip_address_copy_addr(void *dst, const ip_address_t *src)
Definition: ip_types.c:164
vl_api_fib_path_type_t type
Definition: fib_types.api:123
#define IKEV2_PAYLOAD_SA
Definition: ikev2.h:108
ike_sa_proposal_data_t
Definition: ikev2_payload.c:80
unsigned short u16
Definition: types.h:57
u8 data_len
Definition: ikev2_types.api:24
u16 end_port
Definition: ikev2_priv.h:251
static void cleanup(void)
Definition: client.c:101
static void ikev2_payload_add_ts_entry(u8 **data, ikev2_ts_t *ts)
typedef CLIB_PACKED(struct { u8 nextpayload;u8 flags;u16 length;u8 protocol_id;u8 spi_size;u16 msg_type;u8 payload[0];})
Definition: ikev2_payload.c:28
u8 len
Definition: ip_types.api:103
u16 transform_id
Definition: ikev2_types.api:94
void ikev2_payload_add_delete(ikev2_payload_chain_t *c, ikev2_delete_t *d)
#define ikev2_elog_uint(_level, _format, _val)
Definition: ikev2_priv.h:124
svmdb_client_t * c
ikev2_auth_method_t method
Definition: ikev2_priv.h:201
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
ikev2_sa_proposal_t * ikev2_parse_sa_payload(ike_payload_header_t *ikep, u32 rlen)
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:380
#define clib_warning(format, args...)
Definition: error.h:59
static ike_payload_header_t * ikev2_payload_add_hdr(ikev2_payload_chain_t *c, u8 payload_type, int len)
u32 spi
Definition: flow_types.api:140
#define IKEV2_PAYLOAD_KE
Definition: ikev2.h:109
ikev2_ip4_addr_pair_t
Definition: ikev2_payload.c:43
void ikev2_payload_add_auth(ikev2_payload_chain_t *c, ikev2_auth_t *auth)
ikev2_protocol_id_t protocol_id
Definition: ikev2_priv.h:240
u8 protocol_id
Definition: ikev2_priv.h:248
#define ASSERT(truth)
ikev2_notify_t * ikev2_parse_notify_payload(ike_payload_header_t *ikep, u32 rlen)
ike_delete_payload_header_t
void ikev2_sa_free_proposal_vector(ikev2_sa_proposal_t **v)
Definition: ikev2.c:284
#define IKEV2_PAYLOAD_AUTH
Definition: ikev2.h:112
#define vec_append(v1, v2)
Append v2 after v1.
Definition: vec.h:890
uword pe(void *v)
GDB callable function: pe - call pool_elts - number of elements in a pool.
Definition: gdb_funcs.c:64
char const int length
Definition: cJSON.h:163
static void ikev2_payload_add_data(ikev2_payload_chain_t *c, u8 *data)
ikev2_delete_t * ikev2_parse_delete_payload(ike_payload_header_t *ikep, u32 rlen)
u8 protocol_id
Definition: ikev2_types.api:34
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u16 start_port
Definition: ikev2_priv.h:250
void ikev2_payload_chain_add_padding(ikev2_payload_chain_t *c, int bs)
ikev2_ts_t * ikev2_parse_ts_payload(ike_payload_header_t *ikep, u32 rlen)
#define vec_foreach(var, vec)
Vector iterator.
ip_address_t start_addr
Definition: ikev2_priv.h:252
void ikev2_payload_add_ts(ikev2_payload_chain_t *c, ikev2_ts_t *ts, u8 type)
u8 * ikev2_find_ike_notify_payload(ike_header_t *ike, u32 msg_type)
void ikev2_payload_add_notify_2(ikev2_payload_chain_t *c, u16 msg_type, u8 *data, ikev2_notify_t *notify)