BSD patches for ocserv

Hi Nikos, here are patches for a couple of issues which are stopping ocserv
from building on OpenBSD (and might be causing problems on other OS too).
There's a bit more to do for OpenBSD, it does need the iteration as done
in openconnect's tun.c:405-410, I might have another diff for that later.

Signed-off-by: Stuart Henderson <stu@spacehopper.org>
This commit is contained in:
Stuart Henderson
2015-02-13 20:34:13 +01:00
committed by Nikos Mavrogiannopoulos
parent d1c3e05b92
commit a2b947de6f
3 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -479,7 +479,7 @@ struct msghdr mh = {
return -1; return -1;
a->sin_family = AF_INET; a->sin_family = AF_INET;
memcpy(&a->sin_addr, &pi->ipi_addr, sizeof(struct in_addr)); memcpy(&a->sin_addr, &pi->s_addr, sizeof(struct in_addr));
a->sin_port = htons(def_port); a->sin_port = htons(def_port);
*our_addrlen = sizeof(struct sockaddr_in); *our_addrlen = sizeof(struct sockaddr_in);
break; break;
+1 -1
View File
@@ -29,9 +29,9 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <sys/errno.h>
#include <sys/syslog.h> #include <sys/syslog.h>
#include <errno.h>
#include <signal.h> #include <signal.h>
void kill_on_parent_kill(int sig) void kill_on_parent_kill(int sig)
+6 -3
View File
@@ -45,10 +45,13 @@
#include <main.h> #include <main.h>
#include <ccan/list/list.h> #include <ccan/list/list.h>
#ifdef __FreeBSD__ #if defined(__FreeBSD__) || defined(__OpenBSD__)
# include <net/if_var.h> # include <net/if_var.h>
# include <netinet/in_var.h> # include <netinet/in_var.h>
#endif #endif
#if defined(__OpenBSD__)
# include <netinet6/in6_var.h>
#endif
#ifdef __linux__ #ifdef __linux__
@@ -177,7 +180,7 @@ int set_ipv6_addr(main_server_st * s, struct proc_st *proc)
memset(&ifr, 0, sizeof(ifr)); memset(&ifr, 0, sizeof(ifr));
ifr.ifr_addr.sa_family = AF_INET6; ifr.ifr_addr.sa_family = AF_INET6;
ifr.ifr_flags |= IFF_UP | IFF_RUNNING; ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
strlcpy(ifr.ifr_name, oroc->tun_lease.name, IFNAMSIZ); strlcpy(ifr.ifr_name, proc->tun_lease.name, IFNAMSIZ);
ret = ioctl(fd, SIOCSIFFLAGS, &ifr); ret = ioctl(fd, SIOCSIFFLAGS, &ifr);
if (ret != 0) { if (ret != 0) {
@@ -445,7 +448,7 @@ void close_tun(main_server_st * s, struct proc_st *proc)
} }
#ifdef SIOCIFDESTROY #ifdef SIOCIFDESTROY
int e; int e, ret;
struct ifreq ifr; struct ifreq ifr;
if (proc->tun_lease.name[0] != 0) { if (proc->tun_lease.name[0] != 0) {