fix VPP-1312 Invalid UDP packet length in ipsec
[vpp.git] / src / vnet / ipsec / esp_encrypt.c
index 0ce5e54..5f63301 100644 (file)
@@ -393,7 +393,8 @@ esp_encrypt_node_fn (vlib_main_t * vm,
              if (sa0->udp_encap)
                {
                  ouh0->udp.length =
-                   clib_host_to_net_u16 (oh0->ip4.length -
+                   clib_host_to_net_u16 (clib_net_to_host_u16
+                                         (oh0->ip4.length) -
                                          ip4_header_bytes (&oh0->ip4));
                }
            }