Browse Source

Remove prefix option

pull/1119/head
Mygod 8 years ago
committed by Max Lv
parent
commit
da6a6884a9
3 changed files with 7 additions and 23 deletions
  1. 20
      src/android.c
  2. 6
      src/local.c
  3. 4
      src/tunnel.c

20
src/android.c

@ -45,8 +45,6 @@
#include "netutils.h"
#include "utils.h"
extern char *prefix;
int
protect_socket(int fd)
{
@ -65,16 +63,13 @@ protect_socket(int fd)
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval));
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval));
char path[257];
sprintf(path, "%s/protect_path", prefix);
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
strncpy(addr.sun_path, "protect_path", sizeof(addr.sun_path) - 1);
if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
LOGE("[android] connect() failed: %s (socket fd = %d), path: %s\n",
strerror(errno), sock, path);
LOGE("[android] connect() failed for protect_path: %s (socket fd = %d)\n",
strerror(errno), sock);
close(sock);
return -1;
}
@ -115,16 +110,13 @@ send_traffic_stat(uint64_t tx, uint64_t rx)
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval));
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval));
char path[257];
sprintf(path, "%s/stat_path", prefix);
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1);
strncpy(addr.sun_path, "stat_path", sizeof(addr.sun_path) - 1);
if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
LOGE("[android] connect() failed: %s (socket fd = %d), path: %s\n",
strerror(errno), sock, path);
LOGE("[android] connect() failed for stat_path: %s (socket fd = %d): %s\n",
strerror(errno), sock);
close(sock);
return -1;
}

6
src/local.c

@ -99,7 +99,6 @@ int vpn = 0;
uint64_t tx = 0;
uint64_t rx = 0;
ev_tstamp last = 0;
char *prefix;
#endif
static int acl = 0;
@ -1221,7 +1220,7 @@ main(int argc, char **argv)
USE_TTY();
#ifdef ANDROID
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:P:huUvVA6",
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:huUvVA6",
long_options, &option_index)) != -1) {
#else
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:i:c:b:a:n:huUvA6",
@ -1313,9 +1312,6 @@ main(int argc, char **argv)
case 'V':
vpn = 1;
break;
case 'P':
prefix = optarg;
break;
#endif
case '?':
// The option character is not recognized.

4
src/tunnel.c

@ -88,7 +88,6 @@ static void close_and_free_server(EV_P_ server_t *server);
#ifdef ANDROID
int vpn = 0;
char *prefix;
#endif
int verbose = 0;
@ -876,9 +875,6 @@ main(int argc, char **argv)
case 'V':
vpn = 1;
break;
case 'P':
prefix = optarg;
break;
#endif
case '?':
// The option character is not recognized.

Loading…
Cancel
Save