aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKingwel Xie <kingwel.xie@ericsson.com>2018-10-10 20:51:59 -0400
committerDamjan Marion <dmarion@me.com>2018-10-23 13:20:48 +0000
commitfc3b8b8ad08d2d4cc375149ecdc10c37d4a80940 (patch)
tree7ddb14c5dce315c6f726c857e7a9c2a0368e280c /src
parent0a554c773bc287721d1100db4725c373b7640c67 (diff)
pg: udp length & checsum issue
if udp length is specified, then use this length to calculate udp checksum otherwise, use length from vlib_buffer Change-Id: I5304a60d5d429993d0524b864b65ec503775412d Signed-off-by: Kingwel Xie <kingwel.xie@ericsson.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/udp/udp_pg.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vnet/udp/udp_pg.c b/src/vnet/udp/udp_pg.c
index c9d8d38ca4a..a81a9d2ed40 100644
--- a/src/vnet/udp/udp_pg.c
+++ b/src/vnet/udp/udp_pg.c
@@ -68,12 +68,12 @@ udp_pg_edit_function_inline (pg_main_t * pg,
ip0 = (void *) (p0->data + ip_offset);
udp0 = (void *) (p0->data + udp_offset);
- udp_len0 = clib_net_to_host_u16 (ip0->length) - sizeof (ip0[0]);
+ udp_len0 = vlib_buffer_length_in_chain (vm, p0) - udp_offset;
if (flags & UDP_PG_EDIT_LENGTH)
- udp0->length =
- clib_net_to_host_u16 (vlib_buffer_length_in_chain (vm, p0)
- - ip_offset);
+ udp0->length = clib_host_to_net_u16 (udp_len0);
+ else
+ udp_len0 = clib_host_to_net_u16 (udp0->length);
/* Initialize checksum with header. */
if (flags & UDP_PG_EDIT_CHECKSUM)