examples/ip_frag: check for non-existent ports

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
This commit is contained in:
Anatoly Burakov 2014-06-18 15:50:35 +01:00 committed by Thomas Monjalon
parent 240952a9e5
commit eaa8d3bf6d
2 changed files with 8 additions and 0 deletions

View File

@ -886,6 +886,10 @@ MAIN(int argc, char **argv)
if (init_mem() < 0)
rte_panic("Cannot initialize memory structures!\n");
/* check if portmask has non-existent ports */
if (enabled_port_mask & ~(RTE_LEN2MASK(nb_ports, unsigned)))
rte_exit(EXIT_FAILURE, "Non-existent ports in portmask!\n");
/* initialize all ports */
for (portid = 0; portid < nb_ports; portid++) {
/* skip ports that are not enabled */

View File

@ -1093,6 +1093,10 @@ MAIN(int argc, char **argv)
if (init_mem() < 0)
rte_panic("Cannot initialize memory structures!\n");
/* check if portmask has non-existent ports */
if (enabled_port_mask & ~(RTE_LEN2MASK(nb_ports, unsigned)))
rte_exit(EXIT_FAILURE, "Non-existent ports in portmask!\n");
/* initialize all ports */
for (portid = 0; portid < nb_ports; portid++) {
/* skip ports that are not enabled */