summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAloys Augustin <aloaugus@cisco.com>2022-08-25 13:00:31 +0200
committerAloys Augustin <aloaugus@cisco.com>2022-08-25 13:01:58 +0200
commit9a6ad01c0d443f002eafa709813d021bf0c98eac (patch)
treee6c2f99dec2bb5e635403f2cb7c219d487c76c74
parentd3456b8d85160167c56b1fbc900b11ad67e033a8 (diff)
wireguard: fix ipv6 payload_length computation
The ipv6 header length should not be counted in the ipv6 payload length. This is similar to https://gerrit.fd.io/r/c/vpp/+/36945. Type: fix Change-Id: I22de0ff828175829102a85288513ee3f55709108 Signed-off-by: Aloys Augustin <aloaugus@cisco.com>
-rw-r--r--src/plugins/wireguard/wireguard_output_tun.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plugins/wireguard/wireguard_output_tun.c b/src/plugins/wireguard/wireguard_output_tun.c
index 5449c498db2..d1b1d6bb8f0 100644
--- a/src/plugins/wireguard/wireguard_output_tun.c
+++ b/src/plugins/wireguard/wireguard_output_tun.c
@@ -504,12 +504,11 @@ wg_output_tun_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
else
{
hdr6_out->wg.header.type = MESSAGE_DATA;
- hdr6_out->udp.length = clib_host_to_net_u16 (encrypted_packet_len +
- sizeof (udp_header_t));
+ hdr6_out->ip6.payload_length = hdr6_out->udp.length =
+ clib_host_to_net_u16 (encrypted_packet_len +
+ sizeof (udp_header_t));
b[0]->current_length =
(encrypted_packet_len + sizeof (ip6_udp_header_t));
- hdr6_out->ip6.payload_length =
- clib_host_to_net_u16 (b[0]->current_length);
}
out: