Browse Source

Fix #1843

pull/1851/merge
Max Lv 7 years ago
parent
commit
3ed6019e1f
4 changed files with 26 additions and 25 deletions
  1. 20
      src/local.c
  2. 13
      src/redir.c
  3. 14
      src/server.c
  4. 4
      src/tunnel.c

20
src/local.c

@ -1629,6 +1629,11 @@ main(int argc, char **argv)
ev_signal_init(&sigchld_watcher, signal_cb, SIGCHLD); ev_signal_init(&sigchld_watcher, signal_cb, SIGCHLD);
ev_signal_start(EV_DEFAULT, &sigchld_watcher); ev_signal_start(EV_DEFAULT, &sigchld_watcher);
if (strcmp(local_addr, ":") > 0)
LOGI("listening at [%s]:%s", local_addr, local_port);
else
LOGI("listening at %s:%s", local_addr, local_port);
struct ev_loop *loop = EV_DEFAULT; struct ev_loop *loop = EV_DEFAULT;
if (mode != UDP_ONLY) { if (mode != UDP_ONLY) {
@ -1674,11 +1679,6 @@ main(int argc, char **argv)
else else
#endif #endif
if (strcmp(local_addr, ":") > 0)
LOGI("listening at [%s]:%s", local_addr, local_port);
else
LOGI("listening at %s:%s", local_addr, local_port);
// setuid // setuid
if (user != NULL && !run_as(user)) { if (user != NULL && !run_as(user)) {
FATAL("failed to switch user"); FATAL("failed to switch user");
@ -1795,6 +1795,11 @@ _start_ss_local_server(profile_t profile, ss_local_callback callback, void *udat
listen_ctx.iface = NULL; listen_ctx.iface = NULL;
listen_ctx.mptcp = mptcp; listen_ctx.mptcp = mptcp;
if (strcmp(local_addr, ":") > 0)
LOGI("listening at [%s]:%s", local_addr, local_port_str);
else
LOGI("listening at %s:%s", local_addr, local_port_str);
if (mode != UDP_ONLY) { if (mode != UDP_ONLY) {
// Setup socket // Setup socket
int listenfd; int listenfd;
@ -1823,11 +1828,6 @@ _start_ss_local_server(profile_t profile, ss_local_callback callback, void *udat
get_sockaddr_len(addr), mtu, crypto, timeout, NULL); get_sockaddr_len(addr), mtu, crypto, timeout, NULL);
} }
if (strcmp(local_addr, ":") > 0)
LOGI("listening at [%s]:%s", local_addr, local_port_str);
else
LOGI("listening at %s:%s", local_addr, local_port_str);
// Init connections // Init connections
cork_dllist_init(&connections); cork_dllist_init(&connections);

13
src/redir.c

@ -1236,6 +1236,13 @@ main(int argc, char **argv)
listen_ctx_t *listen_ctx_current = &listen_ctx; listen_ctx_t *listen_ctx_current = &listen_ctx;
do { do {
if (listen_ctx_current->tos) {
LOGI("listening at %s:%s (TOS 0x%x)", local_addr, local_port, listen_ctx_current->tos);
} else {
LOGI("listening at %s:%s", local_addr, local_port);
}
if (mode != UDP_ONLY) { if (mode != UDP_ONLY) {
// Setup socket // Setup socket
int listenfd; int listenfd;
@ -1273,12 +1280,6 @@ main(int argc, char **argv)
LOGI("TCP relay disabled"); LOGI("TCP relay disabled");
} }
if (listen_ctx_current->tos) {
LOGI("listening at %s:%s (TOS 0x%x)", local_addr, local_port, listen_ctx_current->tos);
} else {
LOGI("listening at %s:%s", local_addr, local_port);
}
// Handle additionals TOS/DSCP listening ports // Handle additionals TOS/DSCP listening ports
if (dscp_num > 0) { if (dscp_num > 0) {
listen_ctx_current = (listen_ctx_t *)ss_malloc(sizeof(listen_ctx_t)); listen_ctx_current = (listen_ctx_t *)ss_malloc(sizeof(listen_ctx_t));

14
src/server.c

@ -1845,6 +1845,11 @@ main(int argc, char **argv)
host = "127.0.0.1"; host = "127.0.0.1";
} }
if (host && strcmp(host, ":") > 0)
LOGI("tcp server listening at [%s]:%s", host, server_port);
else
LOGI("tcp server listening at %s:%s", host ? host : "0.0.0.0", server_port);
// Bind to port // Bind to port
int listenfd; int listenfd;
listenfd = create_and_bind(host, server_port, mptcp); listenfd = create_and_bind(host, server_port, mptcp);
@ -1867,11 +1872,6 @@ main(int argc, char **argv)
ev_io_init(&listen_ctx->io, accept_cb, listenfd, EV_READ); ev_io_init(&listen_ctx->io, accept_cb, listenfd, EV_READ);
ev_io_start(loop, &listen_ctx->io); ev_io_start(loop, &listen_ctx->io);
if (host && strcmp(host, ":") > 0)
LOGI("tcp server listening at [%s]:%s", host, server_port);
else
LOGI("tcp server listening at %s:%s", host ? host : "0.0.0.0", server_port);
if (plugin != NULL) if (plugin != NULL)
break; break;
} }
@ -1884,12 +1884,12 @@ main(int argc, char **argv)
if (plugin != NULL) { if (plugin != NULL) {
port = plugin_port; port = plugin_port;
} }
// Setup UDP
init_udprelay(host, port, mtu, crypto, atoi(timeout), iface);
if (host && strcmp(host, ":") > 0) if (host && strcmp(host, ":") > 0)
LOGI("udp server listening at [%s]:%s", host, port); LOGI("udp server listening at [%s]:%s", host, port);
else else
LOGI("udp server listening at %s:%s", host ? host : "0.0.0.0", port); LOGI("udp server listening at %s:%s", host ? host : "0.0.0.0", port);
// Setup UDP
init_udprelay(host, port, mtu, crypto, atoi(timeout), iface);
} }
} }

4
src/tunnel.c

@ -1108,6 +1108,8 @@ main(int argc, char **argv)
listen_ctx.iface = iface; listen_ctx.iface = iface;
listen_ctx.mptcp = mptcp; listen_ctx.mptcp = mptcp;
LOGI("listening at %s:%s", local_addr, local_port);
struct ev_loop *loop = EV_DEFAULT; struct ev_loop *loop = EV_DEFAULT;
if (mode != UDP_ONLY) { if (mode != UDP_ONLY) {
@ -1147,8 +1149,6 @@ main(int argc, char **argv)
LOGI("TCP relay disabled"); LOGI("TCP relay disabled");
} }
LOGI("listening at %s:%s", local_addr, local_port);
// setuid // setuid
if (user != NULL && !run_as(user)) { if (user != NULL && !run_as(user)) {
FATAL("failed to switch user"); FATAL("failed to switch user");

Loading…
Cancel
Save