mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-02-07 23:59:36 +08:00
change assert to log fatal
This commit is contained in:
parent
0a53d256b6
commit
4ce3661b01
10
common.cpp
10
common.cpp
@ -317,7 +317,9 @@ int set_buf_size(int fd,int socket_buf_size,int force_socket_buf)
|
||||
{
|
||||
if(force_socket_buf)
|
||||
{
|
||||
assert(0==1);
|
||||
mylog(log_fatal,"force_socket_buf not supported in this verion\n");
|
||||
myexit(-1);
|
||||
//assert(0==1);
|
||||
#if 0
|
||||
if(setsockopt(fd, SOL_SOCKET, SO_SNDBUFFORCE, &socket_buf_size, sizeof(socket_buf_size))<0)
|
||||
{
|
||||
@ -555,7 +557,8 @@ int read_file(const char * file,string &output)
|
||||
}
|
||||
|
||||
int run_command(string command0,char * &output,int flag) {
|
||||
assert(0==1 && "not implemented\n");
|
||||
mylog(log_fatal,"run_command not supported in this version\n");
|
||||
myexit(-1);
|
||||
#if 0
|
||||
FILE *in;
|
||||
|
||||
@ -766,7 +769,8 @@ int create_fifo(char * file)
|
||||
setnonblocking(fifo_fd);
|
||||
return fifo_fd;
|
||||
#else
|
||||
assert(0==1&&"not implemented");
|
||||
mylog(log_fatal,"--fifo not supported in this version\n");
|
||||
myexit(-1);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
@ -725,7 +725,8 @@ int reserved_parse_safer(conn_info_t &conn_info,const char * input,int input_len
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(0==1);
|
||||
mylog(log_fatal,"unknow hb_mode\n");
|
||||
myexit(-1);
|
||||
}
|
||||
|
||||
|
||||
|
2
main.cpp
2
main.cpp
@ -1126,7 +1126,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
mylog(log_fatal,"server mode not supported in portable version\n");
|
||||
mylog(log_fatal,"server mode not supported in multi-platform version\n");
|
||||
myexit(-1);
|
||||
//server_event_loop();
|
||||
}
|
||||
|
26
misc.cpp
26
misc.cpp
@ -449,7 +449,8 @@ void process_arg(int argc, char *argv[]) //process all options
|
||||
case 'h':
|
||||
break;
|
||||
case 'a':
|
||||
assert(0==1&&"-a not implemented");
|
||||
mylog(log_fatal,"-a not supported in this version, check -g or --mode easyfaketcp\n")
|
||||
myexit(-1);
|
||||
auto_add_iptables_rule=1;
|
||||
break;
|
||||
case 'g':
|
||||
@ -463,7 +464,9 @@ void process_arg(int argc, char *argv[]) //process all options
|
||||
mylog(log_debug,"option_index: %d\n",option_index);
|
||||
if(strcmp(long_options[option_index].name,"clear")==0)
|
||||
{
|
||||
assert(0==1&&"--clear not implemented");
|
||||
mylog(log_fatal,"--clear not supported in this version\n")
|
||||
myexit(-1);
|
||||
|
||||
clear_iptables=1;
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"source-ip")==0)
|
||||
@ -546,24 +549,29 @@ void process_arg(int argc, char *argv[]) //process all options
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"lower-level")==0)
|
||||
{
|
||||
assert(0==1);
|
||||
mylog(log_fatal,"--lower-level not supported in this version\n")
|
||||
myexit(-1);
|
||||
//process_lower_level_arg();
|
||||
//lower_level=1;
|
||||
//strcpy(lower_level_arg,optarg);
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"simple-rule")==0)
|
||||
{
|
||||
assert(0==1&&"--simple-rule not implemented");
|
||||
mylog(log_fatal,"--simple-rule not supported in this version\n")
|
||||
myexit(-1);
|
||||
|
||||
simple_rule=1;
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"keep-rule")==0)
|
||||
{
|
||||
assert(0==1&&"--keep-rule not implemented");
|
||||
mylog(log_fatal,"--keep-rule not supported in this version\n")
|
||||
myexit(-1);
|
||||
keep_rule=1;
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"gen-add")==0)
|
||||
{
|
||||
assert(0==1&&"--gen-add not implemented");
|
||||
mylog(log_fatal,"--gen-add not supported in this version\n")
|
||||
myexit(-1);
|
||||
generate_iptables_rule_add=1;
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"disable-color")==0)
|
||||
@ -590,7 +598,8 @@ void process_arg(int argc, char *argv[]) //process all options
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"force-sock-buf")==0)
|
||||
{
|
||||
assert(0==1&&"--force-sock-buf not implemented");
|
||||
mylog(log_fatal,"--force-sock-buf not supported in this version\n")
|
||||
myexit(-1);
|
||||
force_socket_buf=1;
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"retry-on-error")==0)
|
||||
@ -647,7 +656,8 @@ void process_arg(int argc, char *argv[]) //process all options
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"fifo")==0)
|
||||
{
|
||||
assert(0==1&&"--fifo not implemented");
|
||||
mylog(log_fatal,"--fifo not supported in this version\n")
|
||||
myexit(-1);
|
||||
sscanf(optarg,"%s",fifo_file);
|
||||
|
||||
mylog(log_info,"fifo_file =%s \n",fifo_file);
|
||||
|
17
network.cpp
17
network.cpp
@ -276,10 +276,10 @@ void *pcap_recv_thread_entry(void *none)
|
||||
myexit(-1);
|
||||
break;
|
||||
case -2:
|
||||
assert(0==1);
|
||||
assert(0==1);//
|
||||
break;
|
||||
default:
|
||||
assert(0==1);
|
||||
assert(0==1);//
|
||||
}
|
||||
}
|
||||
myexit(-1);*/
|
||||
@ -332,7 +332,7 @@ int init_raw_socket()
|
||||
if( ret < 0 )
|
||||
{
|
||||
printf("pcap_activate failed %s\n", pcap_geterr(pcap_handle));
|
||||
assert(0==1);
|
||||
myexit(-1);
|
||||
}
|
||||
|
||||
|
||||
@ -360,13 +360,13 @@ int init_raw_socket()
|
||||
|
||||
if (pcap_compile(pcap_handle, &g_filter, filter_exp, 0, PCAP_NETMASK_UNKNOWN ) == -1) {
|
||||
printf("Bad filter - %s\n", pcap_geterr(pcap_handle));
|
||||
assert(0==1);
|
||||
myexit(-1);
|
||||
}
|
||||
|
||||
|
||||
if (pcap_setfilter(pcap_handle, &g_filter) == -1) {
|
||||
printf("Error setting filter - %s\n", pcap_geterr(pcap_handle));
|
||||
assert(0==1);
|
||||
myexit(-1);
|
||||
}
|
||||
|
||||
|
||||
@ -496,7 +496,8 @@ void init_filter(int port)
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(0==1);
|
||||
mylog(log_fatal,"unknow raw mode\n");
|
||||
myexit(-1);
|
||||
}
|
||||
|
||||
mylog(log_info,"filter expression is [%s]\n",filter_exp);
|
||||
@ -507,13 +508,13 @@ void init_filter(int port)
|
||||
|
||||
if (pcap_compile(pcap_handle, &g_filter, filter_exp, 0, PCAP_NETMASK_UNKNOWN ) == -1) {
|
||||
mylog(log_fatal,"Bad filter - %s\n", pcap_geterr(pcap_handle));
|
||||
assert(0==1);
|
||||
myexit(-1);
|
||||
}
|
||||
|
||||
if (pcap_setfilter(pcap_handle, &g_filter) == -1)
|
||||
{
|
||||
mylog(log_fatal,"Error setting filter - %s\n", pcap_geterr(pcap_handle));
|
||||
assert(0==1);
|
||||
myexit(-1);
|
||||
}
|
||||
|
||||
//pthread_mutex_unlock(&filter_mutex);
|
||||
|
Loading…
x
Reference in New Issue
Block a user