diff options
Diffstat (limited to 'sysdep/bsd')
-rw-r--r-- | sysdep/bsd/Makefile | 1 | ||||
-rw-r--r-- | sysdep/bsd/krt-sock.c | 13 | ||||
-rw-r--r-- | sysdep/bsd/krt-sys.h | 1 | ||||
-rw-r--r-- | sysdep/bsd/sysio.h | 18 |
4 files changed, 23 insertions, 10 deletions
diff --git a/sysdep/bsd/Makefile b/sysdep/bsd/Makefile index ddc87239..dfa32747 100644 --- a/sysdep/bsd/Makefile +++ b/sysdep/bsd/Makefile @@ -3,3 +3,4 @@ obj := $(src-o-files) $(all-daemon) $(conf-y-targets): $(s)krt-sock.Y +tests_objs := $(tests_objs) $(src-o-files) diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index 56026bdd..d2372a3d 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -933,7 +933,7 @@ kif_do_scan(struct kif_proto *p) /* Kernel sockets */ static int -krt_sock_hook(sock *sk, int size UNUSED) +krt_sock_hook(sock *sk, uint size UNUSED) { struct ks_msg msg; int l = read(sk->fd, (char *)&msg, sizeof(msg)); @@ -946,8 +946,14 @@ krt_sock_hook(sock *sk, int size UNUSED) return 0; } +static void +krt_sock_err_hook(sock *sk, int e UNUSED) +{ + krt_sock_hook(sk, 0); +} + static sock * -krt_sock_open(pool *pool, void *data, int table_id) +krt_sock_open(pool *pool, void *data, int table_id UNUSED) { sock *sk; int fd; @@ -967,6 +973,7 @@ krt_sock_open(pool *pool, void *data, int table_id) sk = sk_new(pool); sk->type = SK_MAGIC; sk->rx_hook = krt_sock_hook; + sk->err_hook = krt_sock_err_hook; sk->fd = fd; sk->data = data; @@ -1113,7 +1120,7 @@ kif_sys_shutdown(struct kif_proto *p) struct ifa * -kif_get_primary_ip(struct iface *i) +kif_get_primary_ip(struct iface *i UNUSED) { #if 0 static int fd = -1; diff --git a/sysdep/bsd/krt-sys.h b/sysdep/bsd/krt-sys.h index 870cdf2c..ed667e80 100644 --- a/sysdep/bsd/krt-sys.h +++ b/sysdep/bsd/krt-sys.h @@ -48,4 +48,5 @@ static inline void krt_sys_postconfig(struct krt_config *x UNUSED) { } static inline int krt_sys_get_attr(eattr *a UNUSED, byte *buf UNUSED, int buflen UNUSED) { return GA_UNKNOWN; } + #endif diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h index 57c45bcf..0c5f8fbb 100644 --- a/sysdep/bsd/sysio.h +++ b/sysdep/bsd/sysio.h @@ -28,6 +28,7 @@ #endif +#undef SA_LEN #define SA_LEN(x) (x).sa.sa_len @@ -133,12 +134,12 @@ sk_process_cmsg4_ttl(sock *s, struct cmsghdr *cm) s->rcv_ttl = * (byte *) CMSG_DATA(cm); } +#ifdef IP_SENDSRCADDR static inline void sk_prepare_cmsgs4(sock *s, struct msghdr *msg, void *cbuf, size_t cbuflen) { /* Unfortunately, IP_SENDSRCADDR does not work for raw IP sockets on BSD kernels */ -#ifdef IP_SENDSRCADDR struct cmsghdr *cm; struct in_addr *sa; int controllen = 0; @@ -156,10 +157,13 @@ sk_prepare_cmsgs4(sock *s, struct msghdr *msg, void *cbuf, size_t cbuflen) *sa = ipa_to_in4(s->saddr); msg->msg_controllen = controllen; -#endif } +#else +static inline void +sk_prepare_cmsgs4(sock *s UNUSED, struct msghdr *msg UNUSED, void *cbuf UNUSED, size_t cbuflen UNUSED) { } +#endif -static void +static void UNUSED sk_prepare_ip_header(sock *s, void *hdr, int dlen) { struct ip *ip = hdr; @@ -200,7 +204,7 @@ sk_prepare_ip_header(sock *s, void *hdr, int dlen) #endif int -sk_set_md5_auth(sock *s, ip_addr local, ip_addr remote, struct iface *ifa, char *passwd, int setkey UNUSED) +sk_set_md5_auth(sock *s, ip_addr local UNUSED, ip_addr remote UNUSED, struct iface *ifa UNUSED, char *passwd, int setkey UNUSED) { #ifdef USE_MD5SIG_SETKEY if (setkey) @@ -235,20 +239,20 @@ sk_set_min_ttl4(sock *s, int ttl) } static inline int -sk_set_min_ttl6(sock *s, int ttl) +sk_set_min_ttl6(sock *s, int ttl UNUSED) { ERR_MSG("Kernel does not support IPv6 TTL security"); } static inline int -sk_disable_mtu_disc4(sock *s) +sk_disable_mtu_disc4(sock *s UNUSED) { /* TODO: Set IP_DONTFRAG to 0 ? */ return 0; } static inline int -sk_disable_mtu_disc6(sock *s) +sk_disable_mtu_disc6(sock *s UNUSED) { /* TODO: Set IPV6_DONTFRAG to 0 ? */ return 0; |