Commit 24f1eeda by Michael Pastushkov

fix

parent 51806ad9
#!/bin/sh
make clean && make && ./bytevia temp/1984-proxy2-tcp.ovpn --local-port=1984 --remote-host=p4pn.net --remote-port=1948
make clean && make && ./bytevia temp/1984-proxy2-tcp.ovpn --local-port=1948 --remote-host=p4pn.net --remote-port=1984 --proto=tcp
#!/bin/sh
make clean && make && ./bytevia --local-port=1948 --remote-host=p4pn.net --remote-port=1984 --proto=udp --secret=52341
\ No newline at end of file
make clean && make && ./bytevia --local-port=1948 --remote-host=p4pn.net --remote-port=1984 --proto=udp --secret=52341 --encrypt=0 --log=2
\ No newline at end of file
......@@ -276,7 +276,9 @@ int wait_connection(void) {
return 0;
}
int build(void) {
int build() {
printf("build\n");
rc.remote_host = gethostbyname(options.remote_host);
if (rc.remote_host == NULL) {
......@@ -296,10 +298,13 @@ int build(void) {
}
if (options.proto == SOCK_STREAM) {
printf("waiting for connect\n");
if (connect(rc.remote_socket, (struct sockaddr *)&rc.remote_addr, sizeof(rc.remote_addr)) < 0) {
perror("build: connect()");
return 1;
}
printf("connect\n");
}
return 0;
}
......@@ -383,6 +388,7 @@ int use(void)
close(rc.remote_socket);
return 0;
}
(options.mode == MODE_SERVER) ?
decode(buffer, count_recv) :
encode(buffer, count_recv);
......@@ -430,6 +436,8 @@ int use(void)
}
void run(void) {
printf("run\n");
if (build() == 0)
use();
}
......@@ -440,7 +448,7 @@ int fork_udp() {
if (client_index == -1) {
if ((child_pid = fork()) == 0) {
if (options.log)
printf("request from %s, forking %d:%d ...\n", inet_ntoa(rc.client_addr.sin_addr), rc.client_addr.sin_port, getpid());
printf("request from %s, forking %d ...\n", inet_ntoa(rc.client_addr.sin_addr), getpid());
run();
exit(0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment