Add interface to list of interfaces to capture */
| 209 | |
| 210 | /* Add interface to list of interfaces to capture */ |
| 211 | static struct interface *add_interface(const char *name) |
| 212 | { |
| 213 | struct interface *intf; |
| 214 | |
| 215 | if (strlen(name) >= RTE_ETH_NAME_MAX_LEN) |
| 216 | rte_exit(EXIT_FAILURE, "invalid name for interface: '%s'\n", name); |
| 217 | |
| 218 | intf = malloc(sizeof(*intf)); |
| 219 | if (!intf) |
| 220 | rte_exit(EXIT_FAILURE, "no memory for interface\n"); |
| 221 | |
| 222 | memset(intf, 0, sizeof(*intf)); |
| 223 | rte_strscpy(intf->name, name, sizeof(intf->name)); |
| 224 | intf->opts = capture; |
| 225 | intf->port = -1; /* port set later after EAL init */ |
| 226 | |
| 227 | TAILQ_INSERT_TAIL(&interfaces, intf, next); |
| 228 | return intf; |
| 229 | } |
| 230 | |
| 231 | /* Name has been set but need to lookup port after eal_init */ |
| 232 | static void find_interfaces(void) |
no test coverage detected