diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2019-08-22 18:40:28 +0200 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-08-26 19:13:47 +0000 |
commit | 3f1964d2d2847c5307694fe8daea0a7eef1e2733 (patch) | |
tree | 38a2df4b683da5b5c9b98fc8898eb9cd2d38a032 /src/vnet | |
parent | 61b28ba69df829e1e8aa9f8dd1983493cd26b927 (diff) |
gso: fix segmentation when gso_size greater than vlib buffer size
Type: fix
Ticket: VPP-1751
Change-Id: I5ffb078492adc97374290de404f2ec0102b75184
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/interface_output.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c index c863d444f5a..92cbaac4810 100644 --- a/src/vnet/interface_output.c +++ b/src/vnet/interface_output.c @@ -235,8 +235,11 @@ tso_alloc_tx_bufs (vlib_main_t * vm, vlib_buffer_t * b0, u32 n_bytes_b0, u16 l234_sz, u16 gso_size) { + u16 size = + clib_min (gso_size, vlib_buffer_get_default_data_size (vm) - l234_sz); + /* rounded-up division */ - u16 n_bufs = (n_bytes_b0 - l234_sz + (gso_size - 1)) / gso_size; + u16 n_bufs = (n_bytes_b0 - l234_sz + (size - 1)) / size; u16 n_alloc; ASSERT (n_bufs > 0); |