function without args () -> (void)

This commit is contained in:
bol-van 2023-10-13 20:10:46 +03:00
parent c2075ba941
commit 3e8d7676fc
16 changed files with 59 additions and 59 deletions

View File

@ -142,7 +142,7 @@ static void mask_from_bitcount6_make(uint32_t zct, struct in6_addr *a)
} }
} }
static struct in6_addr ip6_mask[129]; static struct in6_addr ip6_mask[129];
static void mask_from_bitcount6_prepare() static void mask_from_bitcount6_prepare(void)
{ {
for (int zct=0;zct<=128;zct++) mask_from_bitcount6_make(zct, ip6_mask+zct); for (int zct=0;zct<=128;zct++) mask_from_bitcount6_make(zct, ip6_mask+zct);
} }
@ -205,7 +205,7 @@ static struct params_s
} params; } params;
static void exithelp() static void exithelp(void)
{ {
printf( printf(
" -4\t\t\t\t; ipv4 list (default)\n" " -4\t\t\t\t; ipv4 list (default)\n"

View File

@ -272,7 +272,7 @@ static void *t_resolver(void *arg)
return NULL; return NULL;
} }
static int run_threads() static int run_threads(void)
{ {
int i, thread; int i, thread;
pthread_t *t; pthread_t *t;
@ -317,7 +317,7 @@ static int run_threads()
return thread ? 0 : 12; return thread ? 0 : 12;
} }
static void exithelp() static void exithelp(void)
{ {
printf( printf(
" --threads=<threads_number>\n" " --threads=<threads_number>\n"

View File

@ -884,7 +884,7 @@ static void rawsend_clean_sock(int *sock)
*sock=-1; *sock=-1;
} }
} }
void rawsend_cleanup() void rawsend_cleanup(void)
{ {
rawsend_clean_sock(&rawsend_sock4); rawsend_clean_sock(&rawsend_sock4);
rawsend_clean_sock(&rawsend_sock6); rawsend_clean_sock(&rawsend_sock6);

View File

@ -125,7 +125,7 @@ bool rawsend(const struct sockaddr* dst,uint32_t fwmark,const char *ifout,const
// should pre-do it if dropping privileges. otherwise its not necessary // should pre-do it if dropping privileges. otherwise its not necessary
bool rawsend_preinit(bool bind_fix4, bool bind_fix6); bool rawsend_preinit(bool bind_fix4, bool bind_fix6);
// cleans up socket autocreated by rawsend // cleans up socket autocreated by rawsend
void rawsend_cleanup(); void rawsend_cleanup(void);
const char *proto_name(uint8_t proto); const char *proto_name(uint8_t proto);
uint16_t family_from_proto(uint8_t l3proto); uint16_t family_from_proto(uint8_t l3proto);

View File

@ -55,7 +55,7 @@ const uint8_t fake_tls_clienthello_default[517] = {
static uint8_t zeropkt[DPI_DESYNC_MAX_FAKE_LEN]; static uint8_t zeropkt[DPI_DESYNC_MAX_FAKE_LEN];
void desync_init() void desync_init(void)
{ {
memset(zeropkt, 0, sizeof(zeropkt)); memset(zeropkt, 0, sizeof(zeropkt));
} }

View File

@ -49,6 +49,6 @@ bool desync_valid_second_stage(enum dpi_desync_mode mode);
bool desync_valid_second_stage_tcp(enum dpi_desync_mode mode); bool desync_valid_second_stage_tcp(enum dpi_desync_mode mode);
bool desync_valid_second_stage_udp(enum dpi_desync_mode mode); bool desync_valid_second_stage_udp(enum dpi_desync_mode mode);
void desync_init(); void desync_init(void);
packet_process_result dpi_desync_tcp_packet(uint32_t fwmark, const char *ifout, uint8_t *data_pkt, size_t len_pkt, struct ip *ip, struct ip6_hdr *ip6hdr, struct tcphdr *tcphdr, size_t len_tcp, uint8_t *data_payload, size_t len_payload); packet_process_result dpi_desync_tcp_packet(uint32_t fwmark, const char *ifout, uint8_t *data_pkt, size_t len_pkt, struct ip *ip, struct ip6_hdr *ip6hdr, struct tcphdr *tcphdr, size_t len_tcp, uint8_t *data_payload, size_t len_payload);
packet_process_result dpi_desync_udp_packet(uint32_t fwmark, const char *ifout, uint8_t *data_pkt, size_t len_pkt, struct ip *ip, struct ip6_hdr *ip6hdr, struct udphdr *udphdr, uint8_t *data_payload, size_t len_payload); packet_process_result dpi_desync_udp_packet(uint32_t fwmark, const char *ifout, uint8_t *data_pkt, size_t len_pkt, struct ip *ip, struct ip6_hdr *ip6hdr, struct udphdr *udphdr, uint8_t *data_payload, size_t len_payload);

View File

@ -53,7 +53,7 @@ static void onhup(int sig)
bHup = true; bHup = true;
} }
// should be called in normal execution // should be called in normal execution
static void dohup() static void dohup(void)
{ {
if (bHup) if (bHup)
{ {
@ -223,7 +223,7 @@ static int nfq_cb(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg, struct nfq_da
DLOG("packet: id=%d pass unmodified\n", id); DLOG("packet: id=%d pass unmodified\n", id);
return nfq_set_verdict2(qh, id, NF_ACCEPT, mark, 0, NULL); return nfq_set_verdict2(qh, id, NF_ACCEPT, mark, 0, NULL);
} }
static int nfq_main() static int nfq_main(void)
{ {
struct nfq_handle *h = NULL; struct nfq_handle *h = NULL;
struct nfq_q_handle *qh = NULL; struct nfq_q_handle *qh = NULL;
@ -328,7 +328,7 @@ exiterr:
#elif defined(BSD) #elif defined(BSD)
static int dvt_main() static int dvt_main(void)
{ {
uint8_t buf[16384] __attribute__((aligned)); uint8_t buf[16384] __attribute__((aligned));
struct sockaddr_storage sa_from; struct sockaddr_storage sa_from;
@ -497,7 +497,7 @@ static bool parse_ws_scale_factor(char *s, uint16_t *wsize, uint8_t *wscale)
} }
static void exithelp() static void exithelp(void)
{ {
printf( printf(
" --debug=0|1\n" " --debug=0|1\n"
@ -567,7 +567,7 @@ static void exithelp()
exit(1); exit(1);
} }
static void cleanup_params() static void cleanup_params(void)
{ {
ConntrackPoolDestroy(&params.conntrack); ConntrackPoolDestroy(&params.conntrack);
@ -584,7 +584,7 @@ static void cleanup_params()
params.hostlist = NULL; params.hostlist = NULL;
} }
} }
static void exithelp_clean() static void exithelp_clean(void)
{ {
cleanup_params(); cleanup_params();
exithelp(); exithelp();

View File

@ -152,7 +152,7 @@ static void set_filter(struct sock_filter *filter, __u16 code, __u8 jt, __u8 jf,
filter->k = k; filter->k = k;
} }
// deny all blocked syscalls // deny all blocked syscalls
static bool set_seccomp() static bool set_seccomp(void)
{ {
#ifdef __X32_SYSCALL_BIT #ifdef __X32_SYSCALL_BIT
#define SECCOMP_PROG_SIZE (6 + BLOCKED_SYSCALL_COUNT) #define SECCOMP_PROG_SIZE (6 + BLOCKED_SYSCALL_COUNT)
@ -190,7 +190,7 @@ static bool set_seccomp()
return prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog) >= 0; return prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog) >= 0;
} }
bool sec_harden() bool sec_harden(void)
{ {
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0))
{ {
@ -234,7 +234,7 @@ bool setpcap(uint64_t caps)
return !capset(&ch,cd); return !capset(&ch,cd);
} }
int getmaxcap() int getmaxcap(void)
{ {
int maxcap = CAP_LAST_CAP; int maxcap = CAP_LAST_CAP;
FILE *F = fopen("/proc/sys/kernel/cap_last_cap", "r"); FILE *F = fopen("/proc/sys/kernel/cap_last_cap", "r");
@ -246,7 +246,7 @@ int getmaxcap()
return maxcap; return maxcap;
} }
bool dropcaps() bool dropcaps(void)
{ {
uint64_t caps = (1<<CAP_NET_ADMIN)|(1<<CAP_NET_RAW); uint64_t caps = (1<<CAP_NET_ADMIN)|(1<<CAP_NET_RAW);
int maxcap = getmaxcap(); int maxcap = getmaxcap();
@ -272,7 +272,7 @@ bool dropcaps()
} }
#else // __linux__ #else // __linux__
bool sec_harden() bool sec_harden(void)
{ {
// noop // noop
return true; return true;
@ -282,7 +282,7 @@ bool sec_harden()
bool can_drop_root() bool can_drop_root(void)
{ {
#ifdef __linux__ #ifdef __linux__
// has some caps // has some caps
@ -325,7 +325,7 @@ bool droproot(uid_t uid, gid_t gid)
#endif #endif
} }
void print_id() void print_id(void)
{ {
int i,N; int i,N;
gid_t g[128]; gid_t g[128];
@ -341,7 +341,7 @@ void print_id()
printf("%u\n",getgid()); printf("%u\n",getgid());
} }
void daemonize() void daemonize(void)
{ {
int pid; int pid;

View File

@ -11,8 +11,8 @@
bool checkpcap(uint64_t caps); bool checkpcap(uint64_t caps);
bool setpcap(uint64_t caps); bool setpcap(uint64_t caps);
int getmaxcap(); int getmaxcap(void);
bool dropcaps(); bool dropcaps(void);
#define syscall_nr (offsetof(struct seccomp_data, nr)) #define syscall_nr (offsetof(struct seccomp_data, nr))
#define arch_nr (offsetof(struct seccomp_data, arch)) #define arch_nr (offsetof(struct seccomp_data, arch))
@ -52,9 +52,9 @@ bool dropcaps();
#endif #endif
bool sec_harden(); bool sec_harden(void);
bool can_drop_root(); bool can_drop_root(void);
bool droproot(uid_t uid, gid_t gid); bool droproot(uid_t uid, gid_t gid);
void print_id(); void print_id(void);
void daemonize(); void daemonize(void);
bool writepid(const char *filename); bool writepid(const char *filename);

View File

@ -25,7 +25,7 @@
static int redirector_fd=-1; static int redirector_fd=-1;
void redir_close() void redir_close(void)
{ {
if (redirector_fd!=-1) if (redirector_fd!=-1)
{ {
@ -46,7 +46,7 @@ static bool redir_open_private(const char *fname, int flags)
DBGPRINT("opened redirector %s",fname); DBGPRINT("opened redirector %s",fname);
return true; return true;
} }
bool redir_init() bool redir_init(void)
{ {
return params.pf_enable ? redir_open_private("/dev/pf", O_RDONLY) : true; return params.pf_enable ? redir_open_private("/dev/pf", O_RDONLY) : true;
} }
@ -165,8 +165,8 @@ static bool destination_from_pf(const struct sockaddr *accept_sa, struct sockadd
#else #else
bool redir_init() {return true;} bool redir_init(void) {return true;}
void redir_close() {}; void redir_close(void) {};
#endif #endif

View File

@ -5,5 +5,5 @@
#include <sys/socket.h> #include <sys/socket.h>
bool get_dest_addr(int sockfd, const struct sockaddr *accept_sa, struct sockaddr_storage *orig_dst); bool get_dest_addr(int sockfd, const struct sockaddr *accept_sa, struct sockaddr_storage *orig_dst);
bool redir_init(); bool redir_init(void);
void redir_close(); void redir_close(void);

View File

@ -152,7 +152,7 @@ static void set_filter(struct sock_filter *filter, __u16 code, __u8 jt, __u8 jf,
filter->k = k; filter->k = k;
} }
// deny all blocked syscalls // deny all blocked syscalls
static bool set_seccomp() static bool set_seccomp(void)
{ {
#ifdef __X32_SYSCALL_BIT #ifdef __X32_SYSCALL_BIT
#define SECCOMP_PROG_SIZE (6 + BLOCKED_SYSCALL_COUNT) #define SECCOMP_PROG_SIZE (6 + BLOCKED_SYSCALL_COUNT)
@ -190,7 +190,7 @@ static bool set_seccomp()
return prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog) >= 0; return prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog) >= 0;
} }
bool sec_harden() bool sec_harden(void)
{ {
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0))
{ {
@ -234,7 +234,7 @@ bool setpcap(uint64_t caps)
return !capset(&ch,cd); return !capset(&ch,cd);
} }
int getmaxcap() int getmaxcap(void)
{ {
int maxcap = CAP_LAST_CAP; int maxcap = CAP_LAST_CAP;
FILE *F = fopen("/proc/sys/kernel/cap_last_cap", "r"); FILE *F = fopen("/proc/sys/kernel/cap_last_cap", "r");
@ -246,7 +246,7 @@ int getmaxcap()
return maxcap; return maxcap;
} }
bool dropcaps() bool dropcaps(void)
{ {
uint64_t caps = 0; uint64_t caps = 0;
int maxcap = getmaxcap(); int maxcap = getmaxcap();
@ -272,7 +272,7 @@ bool dropcaps()
} }
#else // __linux__ #else // __linux__
bool sec_harden() bool sec_harden(void)
{ {
// noop // noop
return true; return true;
@ -282,7 +282,7 @@ bool sec_harden()
bool can_drop_root() bool can_drop_root(void)
{ {
#ifdef __linux__ #ifdef __linux__
// has some caps // has some caps
@ -325,7 +325,7 @@ bool droproot(uid_t uid, gid_t gid)
#endif #endif
} }
void print_id() void print_id(void)
{ {
int i,N; int i,N;
gid_t g[128]; gid_t g[128];
@ -341,7 +341,7 @@ void print_id()
printf("%u\n",getgid()); printf("%u\n",getgid());
} }
void daemonize() void daemonize(void)
{ {
int pid; int pid;

View File

@ -11,8 +11,8 @@
bool checkpcap(uint64_t caps); bool checkpcap(uint64_t caps);
bool setpcap(uint64_t caps); bool setpcap(uint64_t caps);
int getmaxcap(); int getmaxcap(void);
bool dropcaps(); bool dropcaps(void);
#define syscall_nr (offsetof(struct seccomp_data, nr)) #define syscall_nr (offsetof(struct seccomp_data, nr))
#define arch_nr (offsetof(struct seccomp_data, arch)) #define arch_nr (offsetof(struct seccomp_data, arch))
@ -52,9 +52,9 @@ bool dropcaps();
#endif #endif
bool sec_harden(); bool sec_harden(void);
bool can_drop_root(); bool can_drop_root();
bool droproot(uid_t uid, gid_t gid); bool droproot(uid_t uid, gid_t gid);
void print_id(); void print_id(void);
void daemonize(); void daemonize(void);
bool writepid(const char *filename); bool writepid(const char *filename);

View File

@ -48,7 +48,7 @@ static void onhup(int sig)
bHup = true; bHup = true;
} }
// should be called in normal execution // should be called in normal execution
void dohup() void dohup(void)
{ {
if (bHup) if (bHup)
{ {
@ -64,7 +64,7 @@ void dohup()
static int8_t block_sigpipe() static int8_t block_sigpipe(void)
{ {
sigset_t sigset; sigset_t sigset;
memset(&sigset, 0, sizeof(sigset)); memset(&sigset, 0, sizeof(sigset));
@ -103,7 +103,7 @@ static bool is_interface_online(const char *ifname)
close(sock); close(sock);
return !!(ifr.ifr_flags & IFF_UP); return !!(ifr.ifr_flags & IFF_UP);
} }
static int get_default_ttl() static int get_default_ttl(void)
{ {
int sock,ttl=0; int sock,ttl=0;
socklen_t optlen=sizeof(ttl); socklen_t optlen=sizeof(ttl);
@ -117,7 +117,7 @@ static int get_default_ttl()
} }
static void exithelp() static void exithelp(void)
{ {
printf( printf(
" --bind-addr=<v4_addr>|<v6_addr>; for v6 link locals append %%interface_name\n" " --bind-addr=<v4_addr>|<v6_addr>; for v6 link locals append %%interface_name\n"
@ -179,7 +179,7 @@ static void exithelp()
); );
exit(1); exit(1);
} }
static void cleanup_params() static void cleanup_params(void)
{ {
strlist_destroy(&params.hostlist_files); strlist_destroy(&params.hostlist_files);
strlist_destroy(&params.hostlist_exclude_files); strlist_destroy(&params.hostlist_exclude_files);
@ -194,7 +194,7 @@ static void cleanup_params()
params.hostlist = NULL; params.hostlist = NULL;
} }
} }
static void exithelp_clean() static void exithelp_clean(void)
{ {
cleanup_params(); cleanup_params();
exithelp(); exithelp();
@ -204,7 +204,7 @@ static void exit_clean(int code)
cleanup_params(); cleanup_params();
exit(code); exit(code);
} }
static void nextbind_clean() static void nextbind_clean(void)
{ {
params.binds_last++; params.binds_last++;
if (params.binds_last>=MAX_BINDS) if (params.binds_last>=MAX_BINDS)
@ -213,7 +213,7 @@ static void nextbind_clean()
exit_clean(1); exit_clean(1);
} }
} }
static void checkbind_clean() static void checkbind_clean(void)
{ {
if (params.binds_last<0) if (params.binds_last<0)
{ {
@ -223,7 +223,7 @@ static void checkbind_clean()
} }
void save_default_ttl() void save_default_ttl(void)
{ {
if (!params.ttl_default) if (!params.ttl_default)
{ {
@ -705,7 +705,7 @@ static bool write_system_maxfiles(rlim_t maxfile)
#endif #endif
} }
static bool set_ulimit() static bool set_ulimit(void)
{ {
rlim_t fdmax,fdmin_system,cur_lim=0; rlim_t fdmax,fdmin_system,cur_lim=0;
int n; int n;

View File

@ -6,4 +6,4 @@
#include <sys/param.h> #include <sys/param.h>
void dohup(); void dohup(void);

View File

@ -37,7 +37,7 @@ static void count_legs(struct tailhead *conn_list)
} }
*/ */
static void print_legs() static void print_legs(void)
{ {
VPRINT("Legs : local:%d remote:%d", legs_local, legs_remote) VPRINT("Legs : local:%d remote:%d", legs_local, legs_remote)
} }