| 144 | } |
| 145 | |
| 146 | static void |
| 147 | cli_ipv4_lookup(void *parsed_result, __rte_unused struct cmdline *cl, void *data __rte_unused) |
| 148 | { |
| 149 | struct ip4_lookup_cmd_tokens *res = parsed_result; |
| 150 | struct route_ipv4_config config; |
| 151 | int rc = -EINVAL; |
| 152 | |
| 153 | if (parser_ip4_read(&config.ip, res->ip)) { |
| 154 | printf(MSG_ARG_INVALID, "ipv4"); |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | if (parser_ip4_read(&config.netmask, res->mask)) { |
| 159 | printf(MSG_ARG_INVALID, "netmask"); |
| 160 | return; |
| 161 | } |
| 162 | |
| 163 | if (parser_ip4_read(&config.via, res->via_ip)) { |
| 164 | printf(MSG_ARG_INVALID, "via ip"); |
| 165 | return; |
| 166 | } |
| 167 | |
| 168 | rc = route_ip4_add(&config); |
| 169 | if (rc < 0) |
| 170 | printf(MSG_CMD_FAIL, res->cmd); |
| 171 | } |
| 172 | |
| 173 | cmdline_parse_token_string_t ip4_lookup_cmd = |
| 174 | TOKEN_STRING_INITIALIZER(struct ip4_lookup_cmd_tokens, cmd, "ipv4_lookup"); |
nothing calls this directly
no test coverage detected