summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vat/api_format.c50
-rw-r--r--src/vnet/classify/vnet_classify.c4
-rw-r--r--src/vnet/classify/vnet_classify.h1
3 files changed, 36 insertions, 19 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 039fca06891..226e129e955 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -112,6 +112,7 @@ errmsg (char *fmt, ...)
vec_free (s);
}
+#if VPP_API_TEST_BUILTIN == 0
static uword
api_unformat_sw_if_index (unformat_input_t * input, va_list * args)
{
@@ -130,7 +131,6 @@ api_unformat_sw_if_index (unformat_input_t * input, va_list * args)
return 1;
}
-#if VPP_API_TEST_BUILTIN == 0
/* Parse an IP4 address %d.%d.%d.%d. */
uword
unformat_ip4_address (unformat_input_t * input, va_list * args)
@@ -387,6 +387,21 @@ unformat_ikev2_id_type (unformat_input_t * input, va_list * args)
return 0;
return 1;
}
+#else /* VPP_API_TEST_BUILTIN == 1 */
+static uword
+api_unformat_sw_if_index (unformat_input_t * input, va_list * args)
+{
+ vat_main_t *vam __attribute__ ((unused)) = va_arg (*args, vat_main_t *);
+ vnet_main_t *vnm = vnet_get_main ();
+ u32 *result = va_arg (*args, u32 *);
+ u32 sw_if_index;
+
+ if (!unformat (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
+ return 0;
+
+ *result = sw_if_index;
+ return 1;
+}
#endif /* VPP_API_TEST_BUILTIN */
static uword
@@ -511,6 +526,7 @@ static const char *mfib_flag_long_names[] = MFIB_ENTRY_NAMES_LONG;
static const char *mfib_itf_flag_long_names[] = MFIB_ITF_NAMES_LONG;
static const char *mfib_itf_flag_names[] = MFIB_ITF_NAMES_SHORT;
+#if (VPP_API_TEST_BUILTIN==0)
uword
unformat_mfib_itf_flags (unformat_input_t * input, va_list * args)
{
@@ -553,7 +569,6 @@ unformat_mfib_entry_flags (unformat_input_t * input, va_list * args)
return (old == *eflags ? 0 : 1);
}
-#if (VPP_API_TEST_BUILTIN==0)
u8 *
format_ip4_address (u8 * s, va_list * args)
{
@@ -8724,6 +8739,12 @@ _(ttl) \
_(protocol) \
_(checksum)
+typedef struct
+{
+ u16 src_port, dst_port;
+} tcpudp_header_t;
+
+#if VPP_API_TEST_BUILTIN == 0
uword
unformat_tcp_mask (unformat_input_t * input, va_list * args)
{
@@ -8806,11 +8827,6 @@ unformat_udp_mask (unformat_input_t * input, va_list * args)
return 1;
}
-typedef struct
-{
- u16 src_port, dst_port;
-} tcpudp_header_t;
-
uword
unformat_l4_mask (unformat_input_t * input, va_list * args)
{
@@ -9204,6 +9220,7 @@ unformat_classify_mask (unformat_input_t * input, va_list * args)
return 0;
}
+#endif /* VPP_API_TEST_BUILTIN */
#define foreach_l2_next \
_(drop, DROP) \
@@ -9242,7 +9259,7 @@ _(local, LOCAL) \
_(rewrite, REWRITE)
uword
-unformat_ip_next_index (unformat_input_t * input, va_list * args)
+api_unformat_ip_next_index (unformat_input_t * input, va_list * args)
{
u32 *miss_next_indexp = va_arg (*args, u32 *);
u32 next_index = 0;
@@ -9270,7 +9287,7 @@ out:
_(deny, DENY)
uword
-unformat_acl_next_index (unformat_input_t * input, va_list * args)
+api_unformat_acl_next_index (unformat_input_t * input, va_list * args)
{
u32 *miss_next_indexp = va_arg (*args, u32 *);
u32 next_index = 0;
@@ -9358,13 +9375,13 @@ api_classify_add_del_table (vat_main_t * vam)
;
else if (unformat (i, "next-table %d", &next_table_index))
;
- else if (unformat (i, "miss-next %U", unformat_ip_next_index,
+ else if (unformat (i, "miss-next %U", api_unformat_ip_next_index,
&miss_next_index))
;
else if (unformat (i, "l2-miss-next %U", unformat_l2_next_index,
&miss_next_index))
;
- else if (unformat (i, "acl-miss-next %U", unformat_acl_next_index,
+ else if (unformat (i, "acl-miss-next %U", api_unformat_acl_next_index,
&miss_next_index))
;
else if (unformat (i, "current-data-flag %d", &current_data_flag))
@@ -9421,6 +9438,7 @@ api_classify_add_del_table (vat_main_t * vam)
return ret;
}
+#if VPP_API_TEST_BUILTIN == 0
uword
unformat_l4_match (unformat_input_t * input, va_list * args)
{
@@ -9785,10 +9803,10 @@ unformat_l2_match (unformat_input_t * input, va_list * args)
*matchp = match;
return 1;
}
-
+#endif
uword
-unformat_classify_match (unformat_input_t * input, va_list * args)
+api_unformat_classify_match (unformat_input_t * input, va_list * args)
{
u8 **matchp = va_arg (*args, u8 **);
u32 skip_n_vectors = va_arg (*args, u32);
@@ -9884,13 +9902,13 @@ api_classify_add_del_session (vat_main_t * vam)
{
if (unformat (i, "del"))
is_add = 0;
- else if (unformat (i, "hit-next %U", unformat_ip_next_index,
+ else if (unformat (i, "hit-next %U", api_unformat_ip_next_index,
&hit_next_index))
;
else if (unformat (i, "l2-hit-next %U", unformat_l2_next_index,
&hit_next_index))
;
- else if (unformat (i, "acl-hit-next %U", unformat_acl_next_index,
+ else if (unformat (i, "acl-hit-next %U", api_unformat_acl_next_index,
&hit_next_index))
;
else if (unformat (i, "policer-hit-next %d", &hit_next_index))
@@ -9903,7 +9921,7 @@ api_classify_add_del_session (vat_main_t * vam)
;
else if (unformat (i, "match_n %d", &match_n_vectors))
;
- else if (unformat (i, "match %U", unformat_classify_match,
+ else if (unformat (i, "match %U", api_unformat_classify_match,
&match, skip_n_vectors, match_n_vectors))
;
else if (unformat (i, "advance %d", &advance))
diff --git a/src/vnet/classify/vnet_classify.c b/src/vnet/classify/vnet_classify.c
index ce38f9f173e..6093e2acb19 100644
--- a/src/vnet/classify/vnet_classify.c
+++ b/src/vnet/classify/vnet_classify.c
@@ -1093,8 +1093,6 @@ uword unformat_l2_mask (unformat_input_t * input, va_list * args)
uword unformat_classify_mask (unformat_input_t * input, va_list * args)
{
- vnet_classify_main_t * CLIB_UNUSED(cm)
- = va_arg (*args, vnet_classify_main_t *);
u8 ** maskp = va_arg (*args, u8 **);
u32 * skipp = va_arg (*args, u32 *);
u32 * matchp = va_arg (*args, u32 *);
@@ -1417,7 +1415,7 @@ classify_table_command_fn (vlib_main_t * vm,
else if (unformat (input, "table %d", &table_index))
;
else if (unformat (input, "mask %U", unformat_classify_mask,
- cm, &mask, &skip, &match))
+ &mask, &skip, &match))
;
else if (unformat (input, "memory-size %uM", &tmp))
memory_size = tmp<<20;
diff --git a/src/vnet/classify/vnet_classify.h b/src/vnet/classify/vnet_classify.h
index d0b896ed7d2..2c9666323df 100644
--- a/src/vnet/classify/vnet_classify.h
+++ b/src/vnet/classify/vnet_classify.h
@@ -502,6 +502,7 @@ unformat_function_t unformat_ip_next_index;
unformat_function_t unformat_ip4_match;
unformat_function_t unformat_ip6_match;
unformat_function_t unformat_l3_match;
+unformat_function_t unformat_l4_match;
unformat_function_t unformat_vlan_tag;
unformat_function_t unformat_l2_match;
unformat_function_t unformat_classify_match;
f='#n238'>238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565