warp-vpn

point to point VPN implementation
git clone git://git.2f30.org/warp-vpn
Log | Files | Refs | README

commit 0ec79d3e398536b449fca3bda7cd0d6279f39f76
parent ffe19b0b3e2279d09c50fd994ff9b17180c71cfe
Author: sin <sin@2f30.org>
Date:   Sat,  2 Apr 2016 09:02:03 +0100

fix style

Diffstat:
Mstun.c | 26+++++++++-----------------
1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/stun.c b/stun.c @@ -561,15 +561,14 @@ tunnel(int netfd, int devfd) { unsigned char buf[MAXPAYLOADLEN]; struct pollfd pfd[2]; - int ret, n; + int n; pfd[0].fd = netfd; pfd[0].events = POLLIN; pfd[1].fd = devfd; pfd[1].events = POLLIN; for (;;) { - ret = poll(pfd, 2, -1); - if (ret < 0) + if (poll(pfd, 2, -1) < 0) logerr("poll failed"); if (pfd[0].revents & (POLLERR | POLLNVAL) || @@ -621,8 +620,7 @@ serversetup(int devfd) continue; setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (int []){1}, sizeof(int)); - ret = bind(listenfd, p->ai_addr, p->ai_addrlen); - if (ret < 0) { + if (bind(listenfd, p->ai_addr, p->ai_addrlen) < 0) { close(listenfd); continue; } @@ -632,8 +630,7 @@ serversetup(int devfd) logerr("failed to bind socket"); freeaddrinfo(ai); - ret = listen(listenfd, 5); - if (ret < 0) + if (listen(listenfd, 5) < 0) logerr("listen failed"); revokeprivs(); @@ -650,14 +647,12 @@ serversetup(int devfd) setsockopt(netfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); setsockopt(netfd, IPPROTO_TCP, TCP_NODELAY, (int []){1}, sizeof(int)); - ret = challenge(netfd); - if (ret < 0) { + if (challenge(netfd) < 0) { logwarn("server -> client challenge failed"); goto err; } - ret = response(netfd); - if (ret < 0) { + if (response(netfd) < 0) { logwarn("server -> client response failed"); goto err; } @@ -689,8 +684,7 @@ clientsetup(int devfd) netfd = socket(AF_INET, SOCK_STREAM, 0); if (netfd < 0) continue; - ret = connect(netfd, p->ai_addr, p->ai_addrlen); - if (ret < 0) { + if (connect(netfd, p->ai_addr, p->ai_addrlen) < 0) { close(netfd); continue; } @@ -710,14 +704,12 @@ clientsetup(int devfd) if (debug) logdbg("connected to %s:%s", host, port); - ret = response(netfd); - if (ret < 0) { + if (response(netfd) < 0) { logwarn("client -> server response failed"); goto err; } - ret = challenge(netfd); - if (ret < 0) { + if (challenge(netfd) < 0) { logwarn("client -> server challenge failed"); goto err; }