aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorJuraj Sloboda <jsloboda@cisco.com>2018-09-26 14:25:32 +0200
committerJuraj Sloboda <jsloboda@cisco.com>2018-10-02 09:00:09 +0000
commit8f39d55a298e08ac808da6988032f14d542627c6 (patch)
tree4079d1187ee9fe5428388ec88b5e61b9af6b4db7 /src/plugins
parentef91534e665cf343af2389df11d46559a1f83d78 (diff)
Update code to compute checksum for buffer chains
Compute ICMP checksum for buffer chains Fix checksum function for buffer chains Change-Id: I39b845b94a63c3ab5fc9f6f9ab36cadbc67c104f Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
Diffstat (limited to 'src/plugins')
-rwxr-xr-xsrc/plugins/nat/in2out.c8
-rwxr-xr-xsrc/plugins/nat/out2in.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/src/plugins/nat/in2out.c b/src/plugins/nat/in2out.c
index 53aca8b5773..b6106505331 100755
--- a/src/plugins/nat/in2out.c
+++ b/src/plugins/nat/in2out.c
@@ -632,9 +632,11 @@ icmp_in2out (snat_main_t * sm,
if (PREDICT_TRUE (!ip4_is_fragment (ip0)))
{
- sum0 = ip_incremental_checksum (0, icmp0,
- ntohs (ip0->length) -
- ip4_header_bytes (ip0));
+ sum0 = ip_incremental_checksum_buffer (sm->vlib_main, b0, (u8 *) icmp0 -
+ (u8 *)
+ vlib_buffer_get_current (b0),
+ ntohs (ip0->length) -
+ ip4_header_bytes (ip0), 0);
checksum0 = ~ip_csum_fold (sum0);
if (PREDICT_FALSE (checksum0 != 0 && checksum0 != 0xffff))
{
diff --git a/src/plugins/nat/out2in.c b/src/plugins/nat/out2in.c
index 985333fc765..67d831a850c 100755
--- a/src/plugins/nat/out2in.c
+++ b/src/plugins/nat/out2in.c
@@ -508,9 +508,11 @@ icmp_out2in (snat_main_t * sm,
if (PREDICT_TRUE (!ip4_is_fragment (ip0)))
{
- sum0 = ip_incremental_checksum (0, icmp0,
- ntohs (ip0->length) -
- ip4_header_bytes (ip0));
+ sum0 = ip_incremental_checksum_buffer (sm->vlib_main, b0, (u8 *) icmp0 -
+ (u8 *)
+ vlib_buffer_get_current (b0),
+ ntohs (ip0->length) -
+ ip4_header_bytes (ip0), 0);
checksum0 = ~ip_csum_fold (sum0);
if (checksum0 != 0 && checksum0 != 0xffff)
{