mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-29 21:40:52 +03:00
nfqws,tpws: remove @<config_file> function from OpenBSD
This commit is contained in:
parent
74b6281770
commit
31d4eaaa14
12
nfq/nfqws.c
12
nfq/nfqws.c
@ -552,14 +552,18 @@ static bool parse_ws_scale_factor(char *s, uint16_t *wsize, uint8_t *wscale)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __OpenBSD__
|
||||||
static void cleanup_args()
|
static void cleanup_args()
|
||||||
{
|
{
|
||||||
wordfree(¶ms.wexp);
|
wordfree(¶ms.wexp);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void cleanup_params(void)
|
static void cleanup_params(void)
|
||||||
{
|
{
|
||||||
|
#ifndef __OpenBSD__
|
||||||
cleanup_args();
|
cleanup_args();
|
||||||
|
#endif
|
||||||
|
|
||||||
ConntrackPoolDestroy(¶ms.conntrack);
|
ConntrackPoolDestroy(¶ms.conntrack);
|
||||||
|
|
||||||
@ -851,7 +855,9 @@ static unsigned int hash_jen(const void *data,unsigned int len)
|
|||||||
static void exithelp(void)
|
static void exithelp(void)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
|
#ifndef __OpenBSD__
|
||||||
" @<config_file>|$<config_file>\t\t\t; read file for options. must be the only argument. other options are ignored.\n\n"
|
" @<config_file>|$<config_file>\t\t\t; read file for options. must be the only argument. other options are ignored.\n\n"
|
||||||
|
#endif
|
||||||
" --debug=0|1|syslog|@<filename>\n"
|
" --debug=0|1|syslog|@<filename>\n"
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
" --qnum=<nfqueue_number>\n"
|
" --qnum=<nfqueue_number>\n"
|
||||||
@ -982,6 +988,7 @@ bool parse_tlspos(const char *s, enum tlspos *pos)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __OpenBSD__
|
||||||
// no static to not allow optimizer to inline this func (save stack)
|
// no static to not allow optimizer to inline this func (save stack)
|
||||||
void config_from_file(const char *filename)
|
void config_from_file(const char *filename)
|
||||||
{
|
{
|
||||||
@ -1006,6 +1013,7 @@ void config_from_file(const char *filename)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -1071,12 +1079,14 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __OpenBSD__
|
||||||
if (argc>=2 && (argv[1][0]=='@' || argv[1][0]=='$'))
|
if (argc>=2 && (argv[1][0]=='@' || argv[1][0]=='$'))
|
||||||
{
|
{
|
||||||
config_from_file(argv[1]+1);
|
config_from_file(argv[1]+1);
|
||||||
argv=params.wexp.we_wordv;
|
argv=params.wexp.we_wordv;
|
||||||
argc=params.wexp.we_wordc;
|
argc=params.wexp.we_wordc;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const struct option long_options[] = {
|
const struct option long_options[] = {
|
||||||
{"debug",optional_argument,0,0}, // optidx=0
|
{"debug",optional_argument,0,0}, // optidx=0
|
||||||
@ -1826,7 +1836,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do not need args from file anymore
|
// do not need args from file anymore
|
||||||
|
#ifndef __OpenBSD__
|
||||||
cleanup_args();
|
cleanup_args();
|
||||||
|
#endif
|
||||||
argv=NULL; argc=0;
|
argv=NULL; argc=0;
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
|
#ifndef __OpenBSD__
|
||||||
#include <wordexp.h>
|
#include <wordexp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TLS_PARTIALS_ENABLE true
|
#define TLS_PARTIALS_ENABLE true
|
||||||
|
|
||||||
@ -96,7 +98,9 @@ bool dp_list_have_autohostlist(struct desync_profile_list_head *head);
|
|||||||
|
|
||||||
struct params_s
|
struct params_s
|
||||||
{
|
{
|
||||||
|
#ifndef __OpenBSD__
|
||||||
wordexp_t wexp; // for file based config
|
wordexp_t wexp; // for file based config
|
||||||
|
#endif
|
||||||
|
|
||||||
enum log_target debug_target;
|
enum log_target debug_target;
|
||||||
char debug_logfile[PATH_MAX];
|
char debug_logfile[PATH_MAX];
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#ifndef __OpenBSD__
|
||||||
#include <wordexp.h>
|
#include <wordexp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "tpws.h"
|
#include "tpws.h"
|
||||||
#include "pools.h"
|
#include "pools.h"
|
||||||
@ -81,7 +83,9 @@ void dp_list_destroy(struct desync_profile_list_head *head);
|
|||||||
|
|
||||||
struct params_s
|
struct params_s
|
||||||
{
|
{
|
||||||
|
#ifndef __OpenBSD__
|
||||||
wordexp_t wexp; // for file based config
|
wordexp_t wexp; // for file based config
|
||||||
|
#endif
|
||||||
|
|
||||||
int debug;
|
int debug;
|
||||||
enum log_target debug_target;
|
enum log_target debug_target;
|
||||||
|
12
tpws/tpws.c
12
tpws/tpws.c
@ -122,7 +122,9 @@ static int get_default_ttl(void)
|
|||||||
static void exithelp(void)
|
static void exithelp(void)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
|
#ifndef __OpenBSD__
|
||||||
" @<config_file>|$<config_file>\t\t; read file for options. must be the only argument. other options are ignored.\n\n"
|
" @<config_file>|$<config_file>\t\t; read file for options. must be the only argument. other options are ignored.\n\n"
|
||||||
|
#endif
|
||||||
" --bind-addr=<v4_addr>|<v6_addr>\t; for v6 link locals append %%interface_name\n"
|
" --bind-addr=<v4_addr>|<v6_addr>\t; for v6 link locals append %%interface_name\n"
|
||||||
" --bind-iface4=<interface_name>\t\t; bind to the first ipv4 addr of interface\n"
|
" --bind-iface4=<interface_name>\t\t; bind to the first ipv4 addr of interface\n"
|
||||||
" --bind-iface6=<interface_name>\t\t; bind to the first ipv6 addr of interface\n"
|
" --bind-iface6=<interface_name>\t\t; bind to the first ipv6 addr of interface\n"
|
||||||
@ -215,13 +217,17 @@ static void exithelp(void)
|
|||||||
);
|
);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
#ifndef __OpenBSD__
|
||||||
static void cleanup_args()
|
static void cleanup_args()
|
||||||
{
|
{
|
||||||
wordfree(¶ms.wexp);
|
wordfree(¶ms.wexp);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static void cleanup_params(void)
|
static void cleanup_params(void)
|
||||||
{
|
{
|
||||||
|
#ifndef __OpenBSD__
|
||||||
cleanup_args();
|
cleanup_args();
|
||||||
|
#endif
|
||||||
|
|
||||||
dp_list_destroy(¶ms.desync_profiles);
|
dp_list_destroy(¶ms.desync_profiles);
|
||||||
|
|
||||||
@ -364,6 +370,7 @@ static bool parse_pf_list(char *opt, struct port_filters_head *pfl)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __OpenBSD__
|
||||||
// no static to not allow optimizer to inline this func (save stack)
|
// no static to not allow optimizer to inline this func (save stack)
|
||||||
void config_from_file(const char *filename)
|
void config_from_file(const char *filename)
|
||||||
{
|
{
|
||||||
@ -388,6 +395,7 @@ void config_from_file(const char *filename)
|
|||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void parse_params(int argc, char *argv[])
|
void parse_params(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -427,12 +435,14 @@ void parse_params(int argc, char *argv[])
|
|||||||
dp = &dpl->dp;
|
dp = &dpl->dp;
|
||||||
dp->n = ++desync_profile_count;
|
dp->n = ++desync_profile_count;
|
||||||
|
|
||||||
|
#ifndef __OpenBSD__
|
||||||
if (argc>=2 && (argv[1][0]=='@' || argv[1][0]=='$'))
|
if (argc>=2 && (argv[1][0]=='@' || argv[1][0]=='$'))
|
||||||
{
|
{
|
||||||
config_from_file(argv[1]+1);
|
config_from_file(argv[1]+1);
|
||||||
argv=params.wexp.we_wordv;
|
argv=params.wexp.we_wordv;
|
||||||
argc=params.wexp.we_wordc;
|
argc=params.wexp.we_wordc;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const struct option long_options[] = {
|
const struct option long_options[] = {
|
||||||
{ "help",no_argument,0,0 },// optidx=0
|
{ "help",no_argument,0,0 },// optidx=0
|
||||||
@ -1133,8 +1143,10 @@ void parse_params(int argc, char *argv[])
|
|||||||
IpsetsDebug();
|
IpsetsDebug();
|
||||||
VPRINT("\n");
|
VPRINT("\n");
|
||||||
|
|
||||||
|
#ifndef __OpenBSD__
|
||||||
// do not need args from file anymore
|
// do not need args from file anymore
|
||||||
cleanup_args();
|
cleanup_args();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user