OpenBSD diffs.
I have made some diffs to make it compile under OpenBSD 3.0.
This does not mean that I have tested it remotely yet, since I'm still at the "more README" stage on openvpn, but I know my way around makefiles and includes. =)
In short, the diff fixes these things:
* NULL is already defined on my openbsd, #ifndef'ed it away.
* linux-specific include-files changed to fit obsd. These will need #ifdef's of course. I added and changed until it compiled, nothing more.
* the functions encrypt() and decrypt() are already defined by obsd-libc so they were renamed to openvpn_{en|de}crypt().
On the "I haven't tested" part, it does start and run if given --dev tun0, and gives me 4 lines of output that says "ok so far", so I guess it's at least close to working.
Signature · 5 lines
Janne Johansson [email protected]... BioMat Systems AB Klarabergsg 37 3tr 111 21 Stockholm
basic.h +2 -0
@@ -37,6 +37,8 @@/* clear an object */ #define CLEAR (x) memset(&(x), 0, sizeof(x)) +#ifndef NULL #define NULL ((void *)0) +#endif /* NULL */ #endif
crypto.c +2 -2
@@ -79,7 +79,7 @@ do { msg (D_CRYPT_ERRORS, "%s: " format, error_prefix, args); goto error_exit; } while (false)void -encrypt (struct buffer *buf,struct buffer work, +openvpn_encrypt (struct buffer *buf,struct buffer work,const struct crypto_options *opt,const struct frame * frame,const time_t current)
@@ -186,7 +186,7 @@ }void -decrypt (struct buffer *buf,struct buffer work, +openvpn_decrypt (struct buffer *buf,struct buffer work,const struct crypto_options *opt,const struct frame * frame,const time_t current)
crypto.h +2 -2
@@ -97,12 +97,12 @@void init_key_ctx (struct key_ctx *key_ctx,struct key *key,const struct key_type *kt,const char *prefix); -void encrypt (struct buffer *buf,struct buffer work, +void openvpn_encrypt (struct buffer *buf,struct buffer work,const struct crypto_options *opt,const struct frame * frame,const time_t current); -void decrypt (struct buffer *buf,struct buffer work, +void openvpn_decrypt (struct buffer *buf,struct buffer work,const struct crypto_options *opt,const struct frame * frame,const time_t current);
openvpn.c +3 -2
@@ -30,6 +30,7 @@#include <unistd.h> #include <signal.h> #include <stdio.h> +#include <sys/socket.h> #include "openvpn.h" #include "common.h"
@@ -845,7 +846,7 @@interval_trigger (&tmp_int, current); }#endif -decrypt (&buf, decrypt_buf, &crypto_options, &frame, current); +openvpn_decrypt (&buf, decrypt_buf, &crypto_options, &frame, current);#endif #ifdef USE_LZO if (options->comp_lzo)
@@ -882,7 +883,7 @@tls_pre_encrypt (tls_multi, &buf, &crypto_options);#endif -encrypt (&buf, encrypt_buf, &crypto_options, &frame, current); +openvpn_encrypt (&buf, encrypt_buf, &crypto_options, &frame, current);#endif udp_socket_get_outgoing_addr (&buf, &udp_socket, &to_udp_addr);
socket.c +2 -1
@@ -27,9 +27,10 @@#include <netdb.h> /* gethostbyname */ #include <netinet/in.h> /* struct sockaddr_in */ -#include <linux/if.h> /* inet stuff */ +#include <net/if_tun.h> /* inet stuff */ #include <stdlib.h> /* system() */ +#include <sys/socket.h> #include "socket.h" #include "fdmisc.h" #include "error.h"
socket.h +3 -1
@@ -26,7 +26,9 @@#ifndef SOCKET_H #define SOCKET_H -#include <arpa/inet.h> +#include <netinet/in.h> +#include <sys/socket.h> +#include "buffer.h" #include "common.h"
ssl.c +2 -2
@@ -943,7 +943,7 @@ *header = ks->key_id | (opcode <<P_OPCODE_SHIFT );if (session->tls_auth.key_ctx_bi->encrypt.hmac_defined) { -encrypt (buf, null, &session->tls_auth,NULL , current);/* no encryption, only write hmac */ +openvpn_encrypt (buf, null, &session->tls_auth,NULL , current);/* no encryption, only write hmac */ ASSERT (swap_hmac (buf, &session->tls_auth, false)); } *to_udp_addr = ks->remote_addr;
@@ -970,7 +970,7 @@/* authenticate only (no decrypt) and remove the hmac record from the head of the buffer */ -decrypt (buf, null, co,NULL , current); +openvpn_decrypt (buf, null, co,NULL , current);if (!buf->len) { msg (D_TLS_ERRORS,
ssl.h +1 -0
@@ -28,6 +28,7 @@#include <openssl/ssl.h> #include <openssl/bio.h> #include <openssl/rand.h> +#include <netinet/in.h> #include "basic.h" #include "crypto.h" #include "packet_id.h"
tun.c +0 -2
@@ -25,9 +25,7 @@#include "config.h" -#include <sys/socket.h> #include <sys/ioctl.h> -#include <linux/if.h> #include <fcntl.h> #ifndef OLD_TUN_TAP