diff options
-rw-r--r-- | csum.h | 3 | ||||
-rw-r--r-- | proto_icmpv4.c | 2 | ||||
-rw-r--r-- | proto_ipv4.c | 2 | ||||
-rw-r--r-- | trafgen.c | 2 | ||||
-rw-r--r-- | trafgen_parser.y | 2 |
5 files changed, 5 insertions, 6 deletions
@@ -19,8 +19,7 @@ static inline unsigned short csum(unsigned short *buf, int nwords) return ~sum; } -static inline uint16_t calc_csum(void *addr, size_t len, - int ccsum __maybe_unused) +static inline uint16_t calc_csum(void *addr, size_t len) { return csum(addr, len >> 1); } diff --git a/proto_icmpv4.c b/proto_icmpv4.c index 55dd1b7..e6ebd43 100644 --- a/proto_icmpv4.c +++ b/proto_icmpv4.c @@ -39,7 +39,7 @@ static void icmp(struct pkt_buff *pkt) if (icmp == NULL) return; - csum = calc_csum(icmp, pkt_len(pkt) + sizeof(*icmp), 0); + csum = calc_csum(icmp, pkt_len(pkt) + sizeof(*icmp)); tprintf(" [ ICMP "); tprintf("Type (%u), ", icmp->type); diff --git a/proto_ipv4.c b/proto_ipv4.c index cefc6ba..9b9e915 100644 --- a/proto_ipv4.c +++ b/proto_ipv4.c @@ -48,7 +48,7 @@ static void ipv4(struct pkt_buff *pkt) frag_off = ntohs(ip->h_frag_off); h_tot_len = ntohs(ip->h_tot_len); - csum = calc_csum(ip, ip->h_ihl * 4, 0); + csum = calc_csum(ip, ip->h_ihl * 4); inet_ntop(AF_INET, &ip->h_saddr, src_ip, sizeof(src_ip)); inet_ntop(AF_INET, &ip->h_daddr, dst_ip, sizeof(dst_ip)); @@ -333,7 +333,7 @@ static void apply_csum16(int id) switch (csum->which) { case CSUM_IP: sum = calc_csum(packets[id].payload + csum->from, - csum->to - csum->from + 1, 0); + csum->to - csum->from + 1); break; case CSUM_UDP: sum = p4_csum((void *) packets[id].payload + csum->from, diff --git a/trafgen_parser.y b/trafgen_parser.y index 1718f3d..21c3454 100644 --- a/trafgen_parser.y +++ b/trafgen_parser.y @@ -190,7 +190,7 @@ static void __set_csum16_static(size_t from, size_t to, enum csum which __maybe_ uint16_t sum; uint8_t *psum; - sum = htons(calc_csum(pkt->payload + from, to - from, 0)); + sum = htons(calc_csum(pkt->payload + from, to - from)); psum = (uint8_t *) ∑ set_byte(psum[0]); |