summaryrefslogtreecommitdiff
path: root/trafgen_l3.c
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2016-08-13 02:11:19 +0300
committerTobias Klauser <tklauser@distanz.ch>2016-09-21 09:57:35 +0200
commit34e4f0deb66f823092fb4fa251e885503e96273f (patch)
treef9df73cd4bdcaedc378fceae1c7aa88d92161cf1 /trafgen_l3.c
parent553a9c65beeb77072f08e4d8cd876b062dcdb193 (diff)
trafgen: tcp: Update csum at runtime if it needed
Update TCP checksum field if any TCP of fields was changed. Use same checksum update function on 'packet_finish' and 'header update'. Set 'is_csum_valid = false' if lower IPv4/IPv6 pseudo header was changed. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_l3.c')
-rw-r--r--trafgen_l3.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/trafgen_l3.c b/trafgen_l3.c
index 91052a0..e6aa516 100644
--- a/trafgen_l3.c
+++ b/trafgen_l3.c
@@ -50,7 +50,7 @@ static void ipv4_field_changed(struct proto_field *field)
if (field->id == IP4_SADDR || field->id == IP4_DADDR) {
struct proto_hdr *upper = proto_upper_header(field->hdr);
- if (upper && upper->ops->id == PROTO_UDP)
+ if (upper && (upper->ops->id == PROTO_UDP || upper->ops->id == PROTO_TCP))
upper->is_csum_valid = false;
}
}
@@ -148,7 +148,7 @@ static void ipv6_field_changed(struct proto_field *field)
if (field->id == IP6_SADDR || field->id == IP6_DADDR) {
struct proto_hdr *upper = proto_upper_header(field->hdr);
- if (upper && upper->ops->id == PROTO_UDP)
+ if (upper && (upper->ops->id == PROTO_UDP || upper->ops->id == PROTO_TCP))
upper->is_csum_valid = false;
}
}