mirror of
https://github.com/bol-van/zapret.git
synced 2025-05-24 22:32:58 +03:00
source cosmetics
This commit is contained in:
@@ -18,7 +18,7 @@ static uint16_t do_csum(const uint8_t * buff, size_t len)
|
||||
uint64_t result,w,carry=0;
|
||||
uint16_t u16;
|
||||
|
||||
if (len <= 0) return 0;
|
||||
if (!len) return 0;
|
||||
odd = (uint8_t)(1 & (size_t)buff);
|
||||
if (odd)
|
||||
{
|
||||
|
@@ -276,7 +276,7 @@ void ConntrackPoolPurge(t_conntrack *p)
|
||||
HASH_ITER(hh, p, t, tmp) { \
|
||||
*sa1=0; inet_ntop(AF_INET##f, &t->conn.e1.adr, sa1, sizeof(sa1)); \
|
||||
*sa2=0; inet_ntop(AF_INET##f, &t->conn.e2.adr, sa2, sizeof(sa2)); \
|
||||
printf("[%s]:%u => [%s]:%u : %s : t0=%lld last=t0+%lld now=last+%lld packets_orig=%llu packets_reply=%llu seq0=%u rseq=%u ack0=%u rack=%u wsize_orig=%u:%d wsize_reply=%u:%d cutoff=%u wss_cutoff=%u d_cutoff=%u\n", \
|
||||
printf("[%s]:%u => [%s]:%u : %s : t0=%llu last=t0+%llu now=last+%llu packets_orig=%llu packets_reply=%llu seq0=%u rseq=%u ack0=%u rack=%u wsize_orig=%u:%d wsize_reply=%u:%d cutoff=%u wss_cutoff=%u d_cutoff=%u\n", \
|
||||
sa1, t->conn.e1.port, sa2, t->conn.e2.port, \
|
||||
connstate_s[t->track.state], \
|
||||
(unsigned long long)t->track.t_start, (unsigned long long)(t->track.t_last - t->track.t_start), (unsigned long long)(tnow - t->track.t_last), \
|
||||
|
@@ -103,7 +103,7 @@ static void fill_tcphdr(struct tcphdr *tcp, uint8_t fooling, uint8_t tcp_flags,
|
||||
while (t&3) tcpopt[t++]=1; // noop
|
||||
tcp->th_off += t>>2;
|
||||
}
|
||||
static uint16_t tcpopt_len(uint8_t fooling, uint32_t *timestamps, uint8_t scale_factor)
|
||||
static uint16_t tcpopt_len(uint8_t fooling, const uint32_t *timestamps, uint8_t scale_factor)
|
||||
{
|
||||
uint16_t t=0;
|
||||
if (fooling & TCP_FOOL_MD5SIG) t=18;
|
||||
@@ -586,7 +586,7 @@ void print_tcphdr(const struct tcphdr *tcphdr)
|
||||
|
||||
|
||||
|
||||
bool proto_check_ipv4(uint8_t *data, size_t len)
|
||||
bool proto_check_ipv4(const uint8_t *data, size_t len)
|
||||
{
|
||||
return len >= 20 && (data[0] & 0xF0) == 0x40 &&
|
||||
len >= ((data[0] & 0x0F) << 2);
|
||||
@@ -600,7 +600,7 @@ void proto_skip_ipv4(uint8_t **data, size_t *len)
|
||||
*data += l;
|
||||
*len -= l;
|
||||
}
|
||||
bool proto_check_tcp(uint8_t *data, size_t len)
|
||||
bool proto_check_tcp(const uint8_t *data, size_t len)
|
||||
{
|
||||
return len >= 20 && len >= ((data[12] & 0xF0) >> 2);
|
||||
}
|
||||
@@ -612,7 +612,7 @@ void proto_skip_tcp(uint8_t **data, size_t *len)
|
||||
*len -= l;
|
||||
}
|
||||
|
||||
bool proto_check_ipv6(uint8_t *data, size_t len)
|
||||
bool proto_check_ipv6(const uint8_t *data, size_t len)
|
||||
{
|
||||
return len >= 40 && (data[0] & 0xF0) == 0x60 &&
|
||||
(len - 40) >= htons(*(uint16_t*)(data + 4)); // payload length
|
||||
@@ -702,7 +702,6 @@ void tcp_rewrite_wscale(struct tcphdr *tcp, uint8_t scale_factor)
|
||||
void tcp_rewrite_winsize(struct tcphdr *tcp, uint16_t winsize, uint8_t scale_factor)
|
||||
{
|
||||
uint16_t winsize_old;
|
||||
uint8_t *scale,scale_factor_old;
|
||||
|
||||
winsize_old = htons(tcp->th_win); // << scale_factor;
|
||||
tcp->th_win = htons(winsize);
|
||||
|
@@ -73,11 +73,11 @@ void print_ip6hdr(const struct ip6_hdr *ip6hdr, uint8_t proto);
|
||||
void print_tcphdr(const struct tcphdr *tcphdr);
|
||||
|
||||
|
||||
bool proto_check_ipv4(uint8_t *data, size_t len);
|
||||
bool proto_check_ipv4(const uint8_t *data, size_t len);
|
||||
void proto_skip_ipv4(uint8_t **data, size_t *len);
|
||||
bool proto_check_tcp(uint8_t *data, size_t len);
|
||||
bool proto_check_tcp(const uint8_t *data, size_t len);
|
||||
void proto_skip_tcp(uint8_t **data, size_t *len);
|
||||
bool proto_check_ipv6(uint8_t *data, size_t len);
|
||||
bool proto_check_ipv6(const uint8_t *data, size_t len);
|
||||
void proto_skip_ipv6(uint8_t **data, size_t *len, uint8_t *proto_type);
|
||||
|
||||
bool tcp_synack_segment(const struct tcphdr *tcphdr);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include "gzip.h"
|
||||
|
||||
|
||||
static bool addpool(strpool **hostlist, char **s, char *end)
|
||||
static bool addpool(strpool **hostlist, char **s, const char *end)
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
@@ -166,7 +166,7 @@ static int nfq_cb(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg,
|
||||
struct nfq_data *nfa, void *cookie)
|
||||
{
|
||||
int id;
|
||||
size_t len;
|
||||
int len;
|
||||
struct nfqnl_msg_packet_hdr *ph;
|
||||
uint8_t *data;
|
||||
|
||||
|
Reference in New Issue
Block a user