diff --git a/nfq2/checksum.c b/nfq2/checksum.c index 3d8c620..5e6c3fc 100644 --- a/nfq2/checksum.c +++ b/nfq2/checksum.c @@ -72,13 +72,13 @@ static uint16_t do_csum(const uint8_t *buff, size_t len) } if (len & 4) { - result += *(uint32_t *)buff; + result += *(const uint32_t *)buff; buff += 4; } } if (len & 2) { - result += *(uint16_t *)buff; + result += *(const uint16_t *)buff; buff += 2; } } @@ -115,8 +115,8 @@ void ip4_fix_checksum(struct ip *ip) uint16_t csum_ipv6_magic(const void *saddr, const void *daddr, size_t len, uint8_t proto, uint16_t sum) { uint64_t a = (uint64_t)sum + htonl(len + proto) + - *(uint32_t *)saddr + *((uint32_t *)saddr + 1) + *((uint32_t *)saddr + 2) + *((uint32_t *)saddr + 3) + - *(uint32_t *)daddr + *((uint32_t *)daddr + 1) + *((uint32_t *)daddr + 2) + *((uint32_t *)daddr + 3); + *(const uint32_t *)saddr + *((const uint32_t *)saddr + 1) + *((const uint32_t *)saddr + 2) + *((const uint32_t *)saddr + 3) + + *(const uint32_t *)daddr + *((const uint32_t *)daddr + 1) + *((const uint32_t *)daddr + 2) + *((const uint32_t *)daddr + 3); return ~from64to16(a); } diff --git a/nfq2/desync.c b/nfq2/desync.c index 4bd8a7a..0892241 100644 --- a/nfq2/desync.c +++ b/nfq2/desync.c @@ -614,8 +614,8 @@ static uint8_t ct_new_postnat_fix(const t_ctrack *ctrack, const struct dissect * // if used in postnat chain, dropping initial packet will cause conntrack connection teardown // so we need to workaround this. // SYN and SYN,ACK checks are for conntrack-less mode - if (ctrack && (params.server ? ctrack->pos.server.pcounter : ctrack->pos.client.pcounter) == 1 || - !ctrack && dis->tcp && (tcp_syn_segment(dis->tcp) || tcp_synack_segment(dis->tcp))) + if ((ctrack && (params.server ? ctrack->pos.server.pcounter : ctrack->pos.client.pcounter) == 1) || + (!ctrack && dis->tcp && (tcp_syn_segment(dis->tcp) || tcp_synack_segment(dis->tcp)))) { if (dis->len_pkt > *len_mod_pkt) DLOG_ERR("linux postnat conntrack workaround cannot be applied\n"); @@ -687,7 +687,7 @@ static bool check_pos_to(const t_ctrack_position *pos, const struct packet_range if (pos) { ps = pos_get(pos, range->to.mode); - return (ps < range->to.pos) || !range->upper_cutoff && (ps == range->to.pos); + return (ps < range->to.pos) || (!range->upper_cutoff && (ps == range->to.pos)); } else return false; diff --git a/nfq2/helpers.c b/nfq2/helpers.c index 2b7adb7..ada33a5 100644 --- a/nfq2/helpers.c +++ b/nfq2/helpers.c @@ -35,7 +35,7 @@ int unique_ssize_t(ssize_t *pu, int ct) UNIQ_SORT static int cmp_size_t(const void * a, const void * b) { - return *(size_t*)a < *(size_t*)b ? -1 : *(size_t*)a > *(size_t*)b; + return *(const size_t*)a < *(const size_t*)b ? -1 : *(const size_t*)a > *(const size_t*)b; } void qsort_size_t(size_t *array, int ct) { @@ -43,7 +43,7 @@ void qsort_size_t(size_t *array, int ct) } static int cmp_ssize_t(const void * a, const void * b) { - return *(ssize_t*)a < *(ssize_t*)b ? -1 : *(ssize_t*)a > *(ssize_t*)b; + return *(const ssize_t*)a < *(const ssize_t*)b ? -1 : *(const ssize_t*)a > *(const ssize_t*)b; } void qsort_ssize_t(ssize_t *array, int ct) { diff --git a/nfq2/protocol.c b/nfq2/protocol.c index eabe5e9..ab71b0c 100644 --- a/nfq2/protocol.c +++ b/nfq2/protocol.c @@ -47,7 +47,7 @@ t_l7proto l7proto_from_name(const char *name) } bool l7_proto_match(t_l7proto l7proto, uint64_t filter_l7) { - return filter_l7==L7_ALL || (filter_l7 & (1ULL<L7_KNOWN && l7protoL7_KNOWN) && (l7protoL7P_KNOWN && l7payloadL7P_KNOWN) && (l7payload