| 989 | " [decap]\n"; |
| 990 | |
| 991 | static void |
| 992 | cmd_table_action_profile(char **tokens, |
| 993 | uint32_t n_tokens, |
| 994 | char *out, |
| 995 | size_t out_size) |
| 996 | { |
| 997 | struct table_action_profile_params p; |
| 998 | struct table_action_profile *ap; |
| 999 | char *name; |
| 1000 | uint32_t t0; |
| 1001 | |
| 1002 | memset(&p, 0, sizeof(p)); |
| 1003 | |
| 1004 | if (n_tokens < 8) { |
| 1005 | snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); |
| 1006 | return; |
| 1007 | } |
| 1008 | |
| 1009 | if (strcmp(tokens[1], "action") != 0) { |
| 1010 | snprintf(out, out_size, MSG_ARG_NOT_FOUND, "action"); |
| 1011 | return; |
| 1012 | } |
| 1013 | |
| 1014 | if (strcmp(tokens[2], "profile") != 0) { |
| 1015 | snprintf(out, out_size, MSG_ARG_NOT_FOUND, "profile"); |
| 1016 | return; |
| 1017 | } |
| 1018 | |
| 1019 | name = tokens[3]; |
| 1020 | |
| 1021 | if (strcmp(tokens[4], "ipv4") == 0) |
| 1022 | p.common.ip_version = 1; |
| 1023 | else if (strcmp(tokens[4], "ipv6") == 0) |
| 1024 | p.common.ip_version = 0; |
| 1025 | else { |
| 1026 | snprintf(out, out_size, MSG_ARG_INVALID, "ipv4 or ipv6"); |
| 1027 | return; |
| 1028 | } |
| 1029 | |
| 1030 | if (strcmp(tokens[5], "offset") != 0) { |
| 1031 | snprintf(out, out_size, MSG_ARG_NOT_FOUND, "offset"); |
| 1032 | return; |
| 1033 | } |
| 1034 | |
| 1035 | if (parser_read_uint32(&p.common.ip_offset, tokens[6]) != 0) { |
| 1036 | snprintf(out, out_size, MSG_ARG_INVALID, "ip_offset"); |
| 1037 | return; |
| 1038 | } |
| 1039 | |
| 1040 | if (strcmp(tokens[7], "fwd") != 0) { |
| 1041 | snprintf(out, out_size, MSG_ARG_NOT_FOUND, "fwd"); |
| 1042 | return; |
| 1043 | } |
| 1044 | |
| 1045 | p.action_mask |= 1LLU << RTE_TABLE_ACTION_FWD; |
| 1046 | |
| 1047 | t0 = 8; |
| 1048 | if ((t0 < n_tokens) && (strcmp(tokens[t0], "balance") == 0)) { |
no test coverage detected