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 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);
}
@ -205,7 +205,7 @@ static struct params_s
} params;
static void exithelp()
static void exithelp(void)
{
printf(
" -4\t\t\t\t; ipv4 list (default)\n"

View File

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

View File

@ -884,7 +884,7 @@ static void rawsend_clean_sock(int *sock)
*sock=-1;
}
}
void rawsend_cleanup()
void rawsend_cleanup(void)
{
rawsend_clean_sock(&rawsend_sock4);
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
bool rawsend_preinit(bool bind_fix4, bool bind_fix6);
// cleans up socket autocreated by rawsend
void rawsend_cleanup();
void rawsend_cleanup(void);
const char *proto_name(uint8_t proto);
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];
void desync_init()
void desync_init(void)
{
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_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_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;
}
// should be called in normal execution
static void dohup()
static void dohup(void)
{
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);
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_q_handle *qh = NULL;
@ -328,7 +328,7 @@ exiterr:
#elif defined(BSD)
static int dvt_main()
static int dvt_main(void)
{
uint8_t buf[16384] __attribute__((aligned));
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(
" --debug=0|1\n"
@ -567,7 +567,7 @@ static void exithelp()
exit(1);
}
static void cleanup_params()
static void cleanup_params(void)
{
ConntrackPoolDestroy(&params.conntrack);
@ -584,7 +584,7 @@ static void cleanup_params()
params.hostlist = NULL;
}
}
static void exithelp_clean()
static void exithelp_clean(void)
{
cleanup_params();
exithelp();

View File

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

View File

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

View File

@ -25,7 +25,7 @@
static int redirector_fd=-1;
void redir_close()
void redir_close(void)
{
if (redirector_fd!=-1)
{
@ -46,7 +46,7 @@ static bool redir_open_private(const char *fname, int flags)
DBGPRINT("opened redirector %s",fname);
return true;
}
bool redir_init()
bool redir_init(void)
{
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
bool redir_init() {return true;}
void redir_close() {};
bool redir_init(void) {return true;}
void redir_close(void) {};
#endif

View File

@ -5,5 +5,5 @@
#include <sys/socket.h>
bool get_dest_addr(int sockfd, const struct sockaddr *accept_sa, struct sockaddr_storage *orig_dst);
bool redir_init();
void redir_close();
bool redir_init(void);
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;
}
// deny all blocked syscalls
static bool set_seccomp()
static bool set_seccomp(void)
{
#ifdef __X32_SYSCALL_BIT
#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;
}
bool sec_harden()
bool sec_harden(void)
{
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0))
{
@ -234,7 +234,7 @@ bool setpcap(uint64_t caps)
return !capset(&ch,cd);
}
int getmaxcap()
int getmaxcap(void)
{
int maxcap = CAP_LAST_CAP;
FILE *F = fopen("/proc/sys/kernel/cap_last_cap", "r");
@ -246,7 +246,7 @@ int getmaxcap()
return maxcap;
}
bool dropcaps()
bool dropcaps(void)
{
uint64_t caps = 0;
int maxcap = getmaxcap();
@ -272,7 +272,7 @@ bool dropcaps()
}
#else // __linux__
bool sec_harden()
bool sec_harden(void)
{
// noop
return true;
@ -282,7 +282,7 @@ bool sec_harden()
bool can_drop_root()
bool can_drop_root(void)
{
#ifdef __linux__
// has some caps
@ -325,7 +325,7 @@ bool droproot(uid_t uid, gid_t gid)
#endif
}
void print_id()
void print_id(void)
{
int i,N;
gid_t g[128];
@ -341,7 +341,7 @@ void print_id()
printf("%u\n",getgid());
}
void daemonize()
void daemonize(void)
{
int pid;

View File

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

View File

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

View File

@ -6,4 +6,4 @@
#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)
}