aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/socket.c
AgeCommit message (Collapse)AuthorFilesLines
2019-07-24memif: fix vector overflow when copying stringsBenoît Ganne1-19/+27
When memif sends back socket messages containing strings, we copy vectors into C-string. Unfortunately, most vectors are not null-terminated, causing strncpy() read overflow. Moreover, strncpy() does not null-terminate string in case of max length reached. This patch introduces helpers to safely copy strings from vectors. Type: fix Fixes: d6042d4f1ea0baf02bc87c72960a331a9e08dfab Change-Id: I38489ec8d2a5d4a42b9abde1aa3dfdbd06ebe024 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2018-10-23c11 safe string handling supportDave Barach1-2/+2
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
2018-10-03memif: include interface name in logsJuraj Sloboda1-6/+5
Change-Id: I67f58aa93c721dbd518cc2ddcea330006693662f Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
2018-07-11memif: fix max number of ringsDamjan Marion1-1/+1
Change-Id: Ie7621a38a44e7c692e23e58c43d27d8d2aab43e6 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-05-25memif: Add support for loggingJakub Grajciar1-14/+21
Change-Id: I0fe60a639c7589dc842d85db092c81c1a7441cb7 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2018-04-04memif: zero copy slaveDamjan Marion1-1/+4
Change-Id: I65306fb1f8e39221dd1d8c00737a7fb1c0129ba8 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-03-27memif: add private header size fieldDamjan Marion1-0/+4
private header size allows to reserve firs X bytes of payload to be considered as private metadata. For now we just support value 0 but adding this field to address future needs without changing protocol version. Change-Id: Id77336584c0194a303b20210aff584c7372cba01 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-02-09memif: fix crash caused by zero pkt len in memif and clear dirty cache while ↵Chun Li1-0/+5
interface reconnect. Change-Id: Ifc7eb2494a22c334d8899422545fca1a4bba4d05 Signed-off-by: Chun Li <chunl2@cisco.com>
2018-02-06vlib: epoll on worker threadsDamjan Marion1-0/+4
This patch teaches worer threads to sleep and to be waken up by kernel if there is activity on file desctiptors assigned to that thread. It also adds counters to epoll file descriptors and new debug cli 'show unix file'. Change-Id: Iaf67869f4aa88ff5b0a08982e1c08474013107c4 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-11-15memif: fix uninitialized pointer read coverity errorSteven1-0/+2
Set the content of tmp.sock prior to calling memif_msg_send_disconnect. Also fix the problem socket was not close in the same spot due to error encountered. Change-Id: I8f54ebad2250d1944afcc52e71d2a59da05362af Signed-off-by: Steven <sluong@cisco.com>
2017-11-09memif: use clib_socket_t for socket connectionsDamjan Marion1-128/+60
This reverts commit 590acf8fa7af6a8604edd72a32f9f087be52c767. new version includes minor fix for the crash when the interface is deleted. Change-Id: I8fc56eb9145e4d8e1d410206f84e705045898608 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-09-09move unix_file_* code to vppinfraDamjan Marion1-27/+29
This will allow us to use this code in client libraries without vlib. Change-Id: I8557b752496841ba588aa36b6082cbe2cd1867fe Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-09-08memif: fix coverity warnings as of 9/7Steven1-6/+7
1. coverity complains about "buffer not null terminated" for strncpy because we pass the size of the destination to the call which is equal to the true size of the destination. We subtract 1 for the size to accommodate the null like all other places are already doing it. 2. Add a check to tx_queues in memif_interface_tx_inline to avoid "divide by zero". 3. To avoid null pointer dereference in memif_create_if, change the goto done rather than goto error and spit a more meaningful error rather than silent about it. 4. Shuffle a line to avoid "check after use" in vl_api_memif_delete_t_handler. Change-Id: Icba7ecd5362c012a48ac35795d31aab356617420 Signed-off-by: Steven <sluong@cisco.com>
2017-06-19memif: add ip modeDamjan Marion1-0/+1
In IP mode memif interface is L3 point-to-point interfaces and we don't pass l2 header. There is no l2 header rewrite operation and received packets are sent straight to ip4-input / ip6-input nodes. Change-Id: I4177f3fce3004da7ecf14d235006ae053fcf3f09 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-06-12memif: complete refactor of socket handling codeDamjan Marion1-0/+736
Change-Id: I4d41def83a23f13701f1ddcea722d481e4c85cbc Signed-off-by: Damjan Marion <damarion@cisco.com>