numam-dpdk/app/test
Alan Carew aaa662e75c cmdline: fix overflow on bsd
When using test-pmd with flow director in FreeBSD, the application will
segfault/Bus error while parsing the command-line. This is due to how
each commands result structure is represented during parsing, where the offsets
for each tokens value is stored in a character array(char result_buf[BUFSIZ])
in cmdline_parse()(./lib/librte_cmdline/cmdline_parse.c).

The overflow occurs where BUFSIZ is less than the size of a commands result
structure, in this case "struct cmd_pkt_filter_result"
(app/test-pmd/cmdline.c) is 1088 bytes and BUFSIZ on FreeBSD is 1024 bytes as
opposed to 8192 bytes on Linux.

The problem can be reproduced by running test-pmd on FreeBSD:
./testpmd -c 0x3 -n 4 -- -i --portmask=0x3 --pkt-filter-mode=perfect
And adding a filter:
add_perfect_filter 0 udp src 192.168.0.0 1024 dst 192.168.0.0 1024 flexbytes
0x800 vlan 0 queue 0 soft 0x17

This patch removes the OS dependency on BUFSIZ and defines and uses a
library #define CMDLINE_PARSE_RESULT_BUFSIZE 8192

Added boundary checking to ensure this buffer size cannot overflow, with
an error message being produced.

Suggested-by: Olivier Matz <olivier.matz@6wind.com>
http://git.droids-corp.org/?p=libcmdline.git;a=commitdiff;h=b1d5b169352e57df3fc14c51ffad4b83f3e5613f

Signed-off-by: Alan Carew <alan.carew@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
2014-12-05 16:54:53 +01:00
..
autotest_data.py app/test: vm power management 2014-11-26 17:27:04 +01:00
autotest_runner.py app: no more bare metal environment 2014-11-27 13:09:55 +01:00
autotest_test_funcs.py remove trailing whitespaces 2014-06-11 00:29:34 +02:00
autotest.py app: no more bare metal environment 2014-11-27 13:09:55 +01:00
commands.c app/test: measure cycles per packet in Rx/Tx 2014-11-13 00:52:29 +01:00
Makefile app: no more bare metal environment 2014-11-27 13:09:55 +01:00
packet_burst_generator.c bond: free mbufs on Tx burst failure 2014-11-24 21:43:50 +01:00
packet_burst_generator.h bond: free mbufs on Tx burst failure 2014-11-24 21:43:50 +01:00
process.h app: no more bare metal environment 2014-11-27 13:09:55 +01:00
test_acl.c acl: fix build and runtime for default target 2014-09-03 03:26:50 +02:00
test_acl.h remove trailing whitespaces 2014-06-11 00:29:34 +02:00
test_alarm.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_atomic.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_byteorder.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_cmdline_cirbuf.c eal: deprecate rte_snprintf 2014-06-27 02:31:24 +02:00
test_cmdline_etheraddr.c cmdline: fix overflow on bsd 2014-12-05 16:54:53 +01:00
test_cmdline_ipaddr.c cmdline: fix overflow on bsd 2014-12-05 16:54:53 +01:00
test_cmdline_lib.c remove trailing whitespaces 2014-06-11 00:29:34 +02:00
test_cmdline_num.c cmdline: fix overflow on bsd 2014-12-05 16:54:53 +01:00
test_cmdline_portlist.c cmdline: fix overflow on bsd 2014-12-05 16:54:53 +01:00
test_cmdline_string.c cmdline: fix overflow on bsd 2014-12-05 16:54:53 +01:00
test_cmdline.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_cmdline.h remove trailing whitespaces 2014-06-11 00:29:34 +02:00
test_common.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_cpuflags.c eal/ppc: cpu flag checks for IBM Power 2014-11-26 21:50:10 +01:00
test_cycles.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_debug.c app: no more bare metal environment 2014-11-27 13:09:55 +01:00
test_devargs.c app/test: fix misplaced braces in devargs check 2014-11-24 16:28:43 +01:00
test_distributor_perf.c add prefix to cache line macros 2014-11-27 16:21:11 +01:00
test_distributor.c mbuf: add usr alias for hash 2014-11-13 12:26:10 +01:00
test_eal_flags.c eal: add option --master-lcore 2014-11-25 14:06:40 +01:00
test_eal_fs.c eal: factorize common headers 2014-11-25 13:16:24 +01:00
test_errno.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_func_reentrancy.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_hash_perf.c app/test: fix crash for fbk hashes with a lot of entries 2014-10-20 23:50:35 +02:00
test_hash.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_interrupts.c app: no more bare metal environment 2014-11-27 13:09:55 +01:00
test_ivshmem.c add prefix to cache line macros 2014-11-27 16:21:11 +01:00
test_kni.c kni: memzone pool for alloc and release 2014-10-21 17:24:53 +02:00
test_kvargs.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_link_bonding.c bond: unit tests for mode 5 2014-11-27 21:40:01 +01:00
test_logs.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_lpm6_routes.h remove trailing whitespaces 2014-06-11 00:29:34 +02:00
test_lpm6.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_lpm_routes.h remove trailing whitespaces 2014-06-11 00:29:34 +02:00
test_lpm.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_malloc.c add prefix to cache line macros 2014-11-27 16:21:11 +01:00
test_mbuf.c add prefix to cache line macros 2014-11-27 16:21:11 +01:00
test_memcpy_perf.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_memcpy.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_memory.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_mempool_perf.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_mempool.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_memzone.c add prefix to cache line macros 2014-11-27 16:21:11 +01:00
test_meter.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_mp_secondary.c app/test: remove file prefix option for bsd 2014-11-24 13:17:49 +01:00
test_pci.c app/test: fix pci registration 2014-11-05 22:18:31 +01:00
test_per_lcore.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_pmd_perf.c add prefix to cache line macros 2014-11-27 16:21:11 +01:00
test_pmd_ring.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_power_acpi_cpufreq.c app/test: vm power management 2014-11-26 17:27:04 +01:00
test_power_kvm_vm.c app/test: vm power management 2014-11-26 17:27:04 +01:00
test_power.c app/test: vm power management 2014-11-26 17:27:04 +01:00
test_prefetch.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_red.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_ring_perf.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_ring.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_rwlock.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_sched.c mbuf: remove the rte_pktmbuf structure 2014-09-17 11:27:51 +02:00
test_spinlock.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_string_fns.c eal: remove rte_snprintf 2014-09-29 15:04:55 +02:00
test_table_acl.c mbuf: replace data pointer by an offset 2014-09-17 18:53:40 +02:00
test_table_acl.h app/test: packet framework unit tests 2014-06-17 03:34:11 +02:00
test_table_combined.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_table_combined.h app/test: packet framework unit tests 2014-06-17 03:34:11 +02:00
test_table_pipeline.c mbuf: replace data pointer by an offset 2014-09-17 18:53:40 +02:00
test_table_pipeline.h app/test: packet framework unit tests 2014-06-17 03:34:11 +02:00
test_table_ports.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_table_ports.h app/test: packet framework unit tests 2014-06-17 03:34:11 +02:00
test_table_tables.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_table_tables.h app/test: packet framework unit tests 2014-06-17 03:34:11 +02:00
test_table.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_table.h add prefix to cache line macros 2014-11-27 16:21:11 +01:00
test_tailq.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test_timer_perf.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_timer.c app/test: only build what has been selected in config 2014-08-26 17:52:34 +02:00
test_version.c app/test: convert all tests to register system 2014-08-26 17:52:33 +02:00
test.c app: no more bare metal environment 2014-11-27 13:09:55 +01:00
test.h app: no more bare metal environment 2014-11-27 13:09:55 +01:00
virtual_pmd.c bond: unit tests for mode 5 2014-11-27 21:40:01 +01:00
virtual_pmd.h bond: support link status polling 2014-11-24 21:44:02 +01:00