diff options
author | Neale Ranns <nranns@cisco.com> | 2019-07-10 01:47:15 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-07-11 17:21:14 +0000 |
commit | 39040a619af4e8750349edba2e93eecb8ce4538b (patch) | |
tree | 0886e63d659fcdb39ebfad8deed5bec6058f2892 /src/vnet/ip/punt_node.c | |
parent | a4d2431594e492c3243f97881fb3ba66e3b4fd76 (diff) |
ip: Punt node does not free iovecs
Type: fix
Fixes: f7a55ad74c
Change-Id: Ic3474e746887f880a8f6246bebc399715bac8e80
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/ip/punt_node.c')
-rw-r--r-- | src/vnet/ip/punt_node.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/vnet/ip/punt_node.c b/src/vnet/ip/punt_node.c index 32a0884d86b..65237aaaa0e 100644 --- a/src/vnet/ip/punt_node.c +++ b/src/vnet/ip/punt_node.c @@ -248,13 +248,15 @@ punt_socket_inline (vlib_main_t * vm, punt_type_t pt, ip_address_family_t af) { u32 *buffers = vlib_frame_vector_args (frame); + u32 thread_index = vm->thread_index; uword n_packets = frame->n_vectors; - struct iovec *iovecs = 0; punt_main_t *pm = &punt_main; int i; - u32 node_index = AF_IP4 == af ? udp4_punt_socket_node.index : - udp6_punt_socket_node.index; + punt_thread_data_t *ptd = &pm->thread_data[thread_index]; + u32 node_index = (AF_IP4 == af ? + udp4_punt_socket_node.index : + udp6_punt_socket_node.index); for (i = 0; i < n_packets; i++) { @@ -332,20 +334,19 @@ punt_socket_inline (vlib_main_t * vm, clib_memcpy_fast (&t->client, c, sizeof (t->client)); } - /* Re-set iovecs if present. */ - if (iovecs) - _vec_len (iovecs) = 0; + /* Re-set iovecs */ + vec_reset_length (ptd->iovecs); /* Add packet descriptor */ packetdesc.sw_if_index = vnet_buffer (b)->sw_if_index[VLIB_RX]; packetdesc.action = 0; - vec_add2 (iovecs, iov, 1); + vec_add2 (ptd->iovecs, iov, 1); iov->iov_base = &packetdesc; iov->iov_len = sizeof (packetdesc); /** VLIB buffer chain -> Unix iovec(s). */ vlib_buffer_advance (b, -(sizeof (ethernet_header_t))); - vec_add2 (iovecs, iov, 1); + vec_add2 (ptd->iovecs, iov, 1); iov->iov_base = b->data + b->current_data; iov->iov_len = l = b->current_length; @@ -362,7 +363,7 @@ punt_socket_inline (vlib_main_t * vm, t->is_midchain = 1; } - vec_add2 (iovecs, iov, 1); + vec_add2 (ptd->iovecs, iov, 1); iov->iov_base = b->data + b->current_data; iov->iov_len = b->current_length; @@ -374,8 +375,8 @@ punt_socket_inline (vlib_main_t * vm, struct msghdr msg = { .msg_name = caddr, .msg_namelen = sizeof (*caddr), - .msg_iov = iovecs, - .msg_iovlen = vec_len (iovecs), + .msg_iov = ptd->iovecs, + .msg_iovlen = vec_len (ptd->iovecs), }; if (sendmsg (pm->socket_fd, &msg, 0) < (ssize_t) l) |