warp-vpn

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

commit e062a5479f020a21d8a8b81dab1d1266a4d07e7e
parent 7c5844fe1eb3588419959b5713fc49e936f442e0
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu, 17 Mar 2016 20:05:00 +0100

fix socklen_t cast and some signedness warnings

Diffstat:
Mstun.c | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/stun.c b/stun.c @@ -99,7 +99,7 @@ opentun(char *tundev) } ssize_t -writetun(int fd, char *buf, size_t len) +writetun(int fd, unsigned char *buf, size_t len) { struct iovec iov[2]; uint32_t type = htonl(AF_INET); @@ -118,7 +118,7 @@ writetun(int fd, char *buf, size_t len) } ssize_t -readtun(int fd, char *buf, size_t len) +readtun(int fd, unsigned char *buf, size_t len) { struct iovec iov[2]; uint32_t type; @@ -237,7 +237,8 @@ loop(int netfd, int tunfd) { unsigned char buf[MTU + AES_BLOCK_SIZE + HDRLEN]; struct pollfd pfd[2]; - int ret, n; + ssize_t n; + int ret; pfd[0].fd = netfd; pfd[0].events = POLLIN; @@ -305,7 +306,7 @@ main(int argc, char *argv[]) pw = getenv("STUNPW"); if (!pw) errx(1, "STUNPW is not set"); - if (aesinit(pw, strlen(pw), NULL, &enc, &dec) < 0) + if (aesinit((unsigned char *)pw, strlen(pw), NULL, &enc, &dec) < 0) errx(1, "couldn't initialize AES cipher"); explicit_bzero(pw, strlen(pw)); @@ -346,7 +347,7 @@ again: if (netfd != -1) close(netfd); netfd = accept(listenfd, (struct sockaddr *)&remote, - (int []){sizeof(remote)}); + (socklen_t []){sizeof(remote)}); if (ret < 0) err(1, "accept"); if (debug)