summaryrefslogtreecommitdiffstats
path: root/src/plugins/gtpu/gtpu_encap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/gtpu/gtpu_encap.c')
-rw-r--r--src/plugins/gtpu/gtpu_encap.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/plugins/gtpu/gtpu_encap.c b/src/plugins/gtpu/gtpu_encap.c
index 4442c42ad66..5f52d5a1543 100644
--- a/src/plugins/gtpu/gtpu_encap.c
+++ b/src/plugins/gtpu/gtpu_encap.c
@@ -380,24 +380,6 @@ gtpu_encap_inline (vlib_main_t * vm,
udp3->length = new_l3;
udp3->src_port = flow_hash3;
- /* IPv6 UDP checksum is mandatory */
- udp0->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b0,
- ip6_0, &bogus);
- if (udp0->checksum == 0)
- udp0->checksum = 0xffff;
- udp1->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b1,
- ip6_1, &bogus);
- if (udp1->checksum == 0)
- udp1->checksum = 0xffff;
- udp2->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b2,
- ip6_2, &bogus);
- if (udp2->checksum == 0)
- udp2->checksum = 0xffff;
- udp3->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b3,
- ip6_3, &bogus);
- if (udp3->checksum == 0)
- udp3->checksum = 0xffff;
-
/* Fix GTPU length */
gtpu0 = (gtpu_header_t *)(udp0+1);
new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
@@ -419,6 +401,25 @@ gtpu_encap_inline (vlib_main_t * vm,
- sizeof (*ip6_3) - sizeof(*udp3)
- GTPU_V1_HDR_LEN);
gtpu3->length = new_l3;
+
+ /* IPv6 UDP checksum is mandatory */
+ udp0->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b0,
+ ip6_0, &bogus);
+ if (udp0->checksum == 0)
+ udp0->checksum = 0xffff;
+ udp1->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b1,
+ ip6_1, &bogus);
+ if (udp1->checksum == 0)
+ udp1->checksum = 0xffff;
+ udp2->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b2,
+ ip6_2, &bogus);
+ if (udp2->checksum == 0)
+ udp2->checksum = 0xffff;
+ udp3->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b3,
+ ip6_3, &bogus);
+ if (udp3->checksum == 0)
+ udp3->checksum = 0xffff;
+
}
pkts_encapsulated += 4;
@@ -592,18 +593,18 @@ gtpu_encap_inline (vlib_main_t * vm,
udp0->length = new_l0;
udp0->src_port = flow_hash0;
- /* IPv6 UDP checksum is mandatory */
- udp0->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b0,
- ip6_0, &bogus);
- if (udp0->checksum == 0)
- udp0->checksum = 0xffff;
-
/* Fix GTPU length */
gtpu0 = (gtpu_header_t *)(udp0+1);
new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
- sizeof (*ip4_0) - sizeof(*udp0)
- GTPU_V1_HDR_LEN);
gtpu0->length = new_l0;
+
+ /* IPv6 UDP checksum is mandatory */
+ udp0->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b0,
+ ip6_0, &bogus);
+ if (udp0->checksum == 0)
+ udp0->checksum = 0xffff;
}
pkts_encapsulated ++;