summaryrefslogtreecommitdiffstats
path: root/dump.c
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-02-20 14:28:43 +0900
committerLorenzo Colitti <lorenzo@google.com>2014-02-22 12:46:06 +0900
commit07f0265830fcae2632159e9993b93a161d7ea23b (patch)
tree04699deb1961d1ca61261da7af83d1be29755a14 /dump.c
parentfbef82d10366495bbd0dbb30cea015cb67c8105a (diff)
downloadandroid_external_android-clat-07f0265830fcae2632159e9993b93a161d7ea23b.tar.gz
android_external_android-clat-07f0265830fcae2632159e9993b93a161d7ea23b.tar.bz2
android_external_android-clat-07f0265830fcae2632159e9993b93a161d7ea23b.zip
Modify the pseudo-header checksum functions.
- Remove the initial checksum, which we don't use anywhere. - Add the upper-layer protocol to the IPv6 function. Currently this is always the same as the next header field in the IPv6 header, but technically it's the upper-layer header after all the extension headers. This is required to support fragments. Bug: 11542311 Change-Id: Ie1a20fa74ee5bc933c1014bab74ae2957979b2b8
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/dump.c b/dump.c
index 8567655..94e4796 100644
--- a/dump.c
+++ b/dump.c
@@ -147,14 +147,14 @@ void dump_udp_generic(const struct udphdr *udp, uint32_t temp_checksum, const ch
/* print ipv4/udp header */
void dump_udp(const struct udphdr *udp, const struct iphdr *ip, const char *payload, size_t payload_size) {
uint32_t temp_checksum;
- temp_checksum = ipv4_pseudo_header_checksum(0, ip, sizeof(*udp) + payload_size);
+ temp_checksum = ipv4_pseudo_header_checksum(ip, sizeof(*udp) + payload_size);
dump_udp_generic(udp, temp_checksum, payload, payload_size);
}
/* print ipv6/udp header */
void dump_udp6(const struct udphdr *udp, const struct ip6_hdr *ip6, const char *payload, size_t payload_size) {
uint32_t temp_checksum;
- temp_checksum = ipv6_pseudo_header_checksum(0, ip6, sizeof(*udp) + payload_size);
+ temp_checksum = ipv6_pseudo_header_checksum(ip6, sizeof(*udp) + payload_size, IPPROTO_UDP);
dump_udp_generic(udp, temp_checksum, payload, payload_size);
}
@@ -203,7 +203,7 @@ void dump_tcp_generic(const struct tcphdr *tcp, const char *options, size_t opti
void dump_tcp(const struct tcphdr *tcp, const struct iphdr *ip, const char *payload, size_t payload_size, const char *options, size_t options_size) {
uint32_t temp_checksum;
- temp_checksum = ipv4_pseudo_header_checksum(0, ip, sizeof(*tcp) + options_size + payload_size);
+ temp_checksum = ipv4_pseudo_header_checksum(ip, sizeof(*tcp) + options_size + payload_size);
dump_tcp_generic(tcp, options, options_size, temp_checksum, payload, payload_size);
}
@@ -211,7 +211,7 @@ void dump_tcp(const struct tcphdr *tcp, const struct iphdr *ip, const char *payl
void dump_tcp6(const struct tcphdr *tcp, const struct ip6_hdr *ip6, const char *payload, size_t payload_size, const char *options, size_t options_size) {
uint32_t temp_checksum;
- temp_checksum = ipv6_pseudo_header_checksum(0, ip6, sizeof(*tcp) + options_size + payload_size);
+ temp_checksum = ipv6_pseudo_header_checksum(ip6, sizeof(*tcp) + options_size + payload_size, IPPROTO_TCP);
dump_tcp_generic(tcp, options, options_size, temp_checksum, payload, payload_size);
}