From 3e8d7676fca3d644cd53a04a697db3a0f6d2db1e Mon Sep 17 00:00:00 2001 From: bol-van Date: Fri, 13 Oct 2023 20:10:46 +0300 Subject: [PATCH] function without args () -> (void) --- ip2net/ip2net.c | 4 ++-- mdig/mdig.c | 4 ++-- nfq/darkmagic.c | 2 +- nfq/darkmagic.h | 2 +- nfq/desync.c | 2 +- nfq/desync.h | 2 +- nfq/nfqws.c | 12 ++++++------ nfq/sec.c | 16 ++++++++-------- nfq/sec.h | 12 ++++++------ tpws/redirect.c | 8 ++++---- tpws/redirect.h | 4 ++-- tpws/sec.c | 16 ++++++++-------- tpws/sec.h | 10 +++++----- tpws/tpws.c | 20 ++++++++++---------- tpws/tpws.h | 2 +- tpws/tpws_conn.c | 2 +- 16 files changed, 59 insertions(+), 59 deletions(-) diff --git a/ip2net/ip2net.c b/ip2net/ip2net.c index b589939..9e936e8 100644 --- a/ip2net/ip2net.c +++ b/ip2net/ip2net.c @@ -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" diff --git a/mdig/mdig.c b/mdig/mdig.c index 754c63c..aa7abc5 100644 --- a/mdig/mdig.c +++ b/mdig/mdig.c @@ -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=\n" diff --git a/nfq/darkmagic.c b/nfq/darkmagic.c index 5a0975a..d17892a 100644 --- a/nfq/darkmagic.c +++ b/nfq/darkmagic.c @@ -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); diff --git a/nfq/darkmagic.h b/nfq/darkmagic.h index dc953c0..5518d20 100644 --- a/nfq/darkmagic.h +++ b/nfq/darkmagic.h @@ -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); diff --git a/nfq/desync.c b/nfq/desync.c index 4cde6a7..0efc908 100644 --- a/nfq/desync.c +++ b/nfq/desync.c @@ -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)); } diff --git a/nfq/desync.h b/nfq/desync.h index 798c418..4e8ca33 100644 --- a/nfq/desync.h +++ b/nfq/desync.h @@ -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); diff --git a/nfq/nfqws.c b/nfq/nfqws.c index 8da6397..ed8b7eb 100644 --- a/nfq/nfqws.c +++ b/nfq/nfqws.c @@ -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(¶ms.conntrack); @@ -584,7 +584,7 @@ static void cleanup_params() params.hostlist = NULL; } } -static void exithelp_clean() +static void exithelp_clean(void) { cleanup_params(); exithelp(); diff --git a/nfq/sec.c b/nfq/sec.c index ac17bea..cf7656d 100644 --- a/nfq/sec.c +++ b/nfq/sec.c @@ -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< 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); diff --git a/tpws/sec.c b/tpws/sec.c index 3f4e156..61d3a54 100644 --- a/tpws/sec.c +++ b/tpws/sec.c @@ -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; diff --git a/tpws/sec.h b/tpws/sec.h index 80e5394..81a8228 100644 --- a/tpws/sec.h +++ b/tpws/sec.h @@ -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); diff --git a/tpws/tpws.c b/tpws/tpws.c index 7d6e813..d7db1e7 100644 --- a/tpws/tpws.c +++ b/tpws/tpws.c @@ -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=|; 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(¶ms.hostlist_files); strlist_destroy(¶ms.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; diff --git a/tpws/tpws.h b/tpws/tpws.h index 0753ec5..fa4eb30 100644 --- a/tpws/tpws.h +++ b/tpws/tpws.h @@ -6,4 +6,4 @@ #include -void dohup(); +void dohup(void); diff --git a/tpws/tpws_conn.c b/tpws/tpws_conn.c index d42abc7..d119d05 100644 --- a/tpws/tpws_conn.c +++ b/tpws/tpws_conn.c @@ -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) }