diff --git a/src/log.c b/src/log.c index 2fcea660..823db9a1 100644 --- a/src/log.c +++ b/src/log.c @@ -68,7 +68,7 @@ const char *human_addr(const struct sockaddr *sa, socklen_t salen, void __attribute__ ((format(printf, 3, 4))) oclog(const worker_st * ws, int priority, const char *fmt, ...) { - char buf[1024]; + char buf[512]; char ipbuf[128]; const char* ip; va_list args; @@ -80,7 +80,7 @@ void __attribute__ ((format(printf, 3, 4))) ipbuf, sizeof(ipbuf)); va_start(args, fmt); - vsnprintf(buf, sizeof(buf)-1, fmt, args); + vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); if (ip) { @@ -97,7 +97,7 @@ void __attribute__ ((format(printf, 4, 5))) mslog(const main_server_st * s, const struct proc_st* proc, int priority, const char *fmt, ...) { - char buf[1024]; + char buf[512]; char ipbuf[128]; const char* ip = NULL; va_list args; @@ -111,7 +111,7 @@ void __attribute__ ((format(printf, 4, 5))) } va_start(args, fmt); - vsnprintf(buf, sizeof(buf)-1, fmt, args); + vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); if (ip) { diff --git a/src/tun.h b/src/tun.h index 69f52b27..5c225955 100644 --- a/src/tun.h +++ b/src/tun.h @@ -2,6 +2,7 @@ # define TUN_H #include +#include #include struct lease_st { diff --git a/src/worker-auth.c b/src/worker-auth.c index 37ecf1b8..c94f0901 100644 --- a/src/worker-auth.c +++ b/src/worker-auth.c @@ -393,7 +393,7 @@ struct cmd_auth_req_st areq; goto auth_fail; } - oclog(ws, LOG_INFO, "User '%s' logged in\n", ws->username); + oclog(ws, LOG_INFO, "User '%s' logged in", ws->username); p = str_cookie; for (i=0;icookie);i++) { @@ -509,7 +509,7 @@ struct cmd_auth_req_st areq; goto auth_fail; } - oclog(ws, LOG_INFO, "User '%s' logged in\n", ws->username); + oclog(ws, LOG_INFO, "User '%s' logged in", ws->username); p = str_cookie; for (i=0;icookie);i++) { diff --git a/src/worker-tun.c b/src/worker-tun.c index b2a8679d..757cb8cf 100644 --- a/src/worker-tun.c +++ b/src/worker-tun.c @@ -130,11 +130,11 @@ struct ifreq ifr; /* get the remote IPs */ ret = get_ip(ws, fd, AF_INET6, 0, vinfo, &buffer, &buffer_size); if (ret < 0) - oclog(ws, LOG_DEBUG, "Cannot obtain IPv6 remote IP for %s\n", vinfo->name); + oclog(ws, LOG_DEBUG, "cannot obtain IPv6 remote IP for %s", vinfo->name); ret = get_ip(ws, fd, AF_INET, 0, vinfo, &buffer, &buffer_size); if (ret < 0) - oclog(ws, LOG_DEBUG, "Cannot obtain IPv4 remote IP for %s\n", vinfo->name); + oclog(ws, LOG_DEBUG, "cannot obtain IPv4 remote IP for %s", vinfo->name); if (vinfo->ipv4 == NULL && vinfo->ipv6 == NULL) { ret = -1; @@ -144,11 +144,11 @@ struct ifreq ifr; /* get the local IPs */ ret = get_ip(ws, fd, AF_INET6, 1, vinfo, &buffer, &buffer_size); if (ret < 0) - oclog(ws, LOG_DEBUG, "Cannot obtain IPv6 local IP for %s\n", vinfo->name); + oclog(ws, LOG_DEBUG, "cannot obtain IPv6 local IP for %s", vinfo->name); ret = get_ip(ws, fd, AF_INET, 1, vinfo, &buffer, &buffer_size); if (ret < 0) - oclog(ws, LOG_DEBUG, "Cannot obtain IPv4 local IP for %s\n", vinfo->name); + oclog(ws, LOG_DEBUG, "cannot obtain IPv4 local IP for %s", vinfo->name); if (vinfo->ipv4_dns && strcmp(vinfo->ipv4_dns, "local") == 0) diff --git a/src/worker-vpn.c b/src/worker-vpn.c index 1caac3f2..e13bc372 100644 --- a/src/worker-vpn.c +++ b/src/worker-vpn.c @@ -807,7 +807,7 @@ unsigned mtu_overhead, dtls_mtu = 0, tls_mtu = 0; if (FD_ISSET(ws->conn_fd, &rfds) || tls_pending != 0) { ret = gnutls_record_recv(ws->session, buffer, sizeof(buffer)); - oclog(ws, LOG_DEBUG, "received %d byte(s) (TLS)\n", ret); + oclog(ws, LOG_DEBUG, "received %d byte(s) (TLS)", ret); GNUTLS_FATAL_ERR(ret); @@ -839,7 +839,7 @@ unsigned mtu_overhead, dtls_mtu = 0, tls_mtu = 0; case UP_ACTIVE: case UP_INACTIVE: ret = gnutls_record_recv(ws->dtls_session, buffer, sizeof(buffer)); - oclog(ws, LOG_DEBUG, "received %d byte(s) (DTLS)\n", ret); + oclog(ws, LOG_DEBUG, "received %d byte(s) (DTLS)", ret); GNUTLS_FATAL_ERR(ret); @@ -938,10 +938,10 @@ int ret, e; switch (head) { case AC_PKT_DPD_RESP: - oclog(ws, LOG_INFO, "received DPD response"); + oclog(ws, LOG_DEBUG, "received DPD response"); break; case AC_PKT_KEEPALIVE: - oclog(ws, LOG_INFO, "received keepalive"); + oclog(ws, LOG_DEBUG, "received keepalive"); break; case AC_PKT_DPD_OUT: oclog(ws, LOG_DEBUG, "received DPD; sending response"); @@ -956,7 +956,8 @@ int ret, e; ws->last_dpd = time(0); break; case AC_PKT_DISCONN: - oclog(ws, LOG_INFO, "received BYE packet"); + oclog(ws, LOG_INFO, "received BYE packet; exiting"); + exit(0); break; case AC_PKT_DATA: oclog(ws, LOG_DEBUG, "writing %d byte(s) to TUN", (int)buf_size);