From eaa8d3bf6d0f6405648fdc6eb9b1a73c08d2cef6 Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Wed, 18 Jun 2014 15:50:35 +0100 Subject: [PATCH] examples/ip_frag: check for non-existent ports Signed-off-by: Anatoly Burakov Acked-by: Thomas Monjalon --- examples/ip_fragmentation/main.c | 4 ++++ examples/ip_reassembly/main.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 02e40a1357..ac575553c4 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -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 */ diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 7311b29f07..d612c311b2 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -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 */ -- 2.20.1