summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-11-09 15:40:47 +0100
committerTobias Klauser <tklauser@distanz.ch>2015-11-09 15:40:47 +0100
commitb2eaec6671ff7ff44bb2f93881ad30e6d6ba0d24 (patch)
tree0c4ddb694da06af1ded2fcd26acf29529c714477
parent66e558ed51ff7d3d7bebb5f5d56114df5eb77e96 (diff)
csum: Remove unused parameter from calc_csum()
The `ccsum' parameter to calc_csum() is never used and is set to 0 by all callers. There's no reason to keep it, so remove it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--csum.h3
-rw-r--r--proto_icmpv4.c2
-rw-r--r--proto_ipv4.c2
-rw-r--r--trafgen.c2
-rw-r--r--trafgen_parser.y2
5 files changed, 5 insertions, 6 deletions
diff --git a/csum.h b/csum.h
index 0d92c30..6047c6f 100644
--- a/csum.h
+++ b/csum.h
@@ -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));
diff --git a/trafgen.c b/trafgen.c
index 0ee74ec..ba2393c 100644
--- a/trafgen.c
+++ b/trafgen.c
@@ -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 *) &sum;
set_byte(psum[0]);