Module Name: src Committed By: pgoyette Date: Thu Apr 12 22:33:41 UTC 2018
Modified Files: src/sys/compat/common [pgoyette-compat]: Makefile.inc uipc_syscalls_40.c uipc_syscalls_50.c src/sys/compat/sys [pgoyette-compat]: sockio.h src/sys/kern [pgoyette-compat]: kern_stub.c src/sys/net [pgoyette-compat]: if.c src/sys/rump/librump/rumpnet [pgoyette-compat]: net_stub.c Log Message: Merge christos's recent changes on HEAD To generate a diff of this commit: cvs rdiff -u -r1.23.2.1 -r1.23.2.2 src/sys/compat/common/Makefile.inc cvs rdiff -u -r1.15.2.5 -r1.15.2.6 src/sys/compat/common/uipc_syscalls_40.c cvs rdiff -u -r1.3.56.3 -r1.3.56.4 src/sys/compat/common/uipc_syscalls_50.c cvs rdiff -u -r1.10.58.1 -r1.10.58.2 src/sys/compat/sys/sockio.h cvs rdiff -u -r1.44.2.1 -r1.44.2.2 src/sys/kern/kern_stub.c cvs rdiff -u -r1.419.2.4 -r1.419.2.5 src/sys/net/if.c cvs rdiff -u -r1.31 -r1.31.2.1 src/sys/rump/librump/rumpnet/net_stub.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/common/Makefile.inc diff -u src/sys/compat/common/Makefile.inc:1.23.2.1 src/sys/compat/common/Makefile.inc:1.23.2.2 --- src/sys/compat/common/Makefile.inc:1.23.2.1 Tue Mar 13 08:53:06 2018 +++ src/sys/compat/common/Makefile.inc Thu Apr 12 22:33:41 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.23.2.1 2018/03/13 08:53:06 pgoyette Exp $ +# $NetBSD: Makefile.inc,v 1.23.2.2 2018/04/12 22:33:41 pgoyette Exp $ # # Configuration variables (default values are below): # @@ -17,7 +17,11 @@ # Default values: COMPATDST?= ${.OBJDIR}/lib/compat +.if !empty(OPT_MODULAR) +COMPAT_AS?= library +.else COMPAT_AS?= obj +.endif COMPATDOTDIR?= ../../. COMPATDIR= ${S:S@^.@${COMPATDOTDIR}@:Q}/compat/common Index: src/sys/compat/common/uipc_syscalls_40.c diff -u src/sys/compat/common/uipc_syscalls_40.c:1.15.2.5 src/sys/compat/common/uipc_syscalls_40.c:1.15.2.6 --- src/sys/compat/common/uipc_syscalls_40.c:1.15.2.5 Thu Mar 8 09:56:05 2018 +++ src/sys/compat/common/uipc_syscalls_40.c Thu Apr 12 22:33:41 2018 @@ -1,9 +1,9 @@ -/* $NetBSD: uipc_syscalls_40.c,v 1.15.2.5 2018/03/08 09:56:05 pgoyette Exp $ */ +/* $NetBSD: uipc_syscalls_40.c,v 1.15.2.6 2018/04/12 22:33:41 pgoyette Exp $ */ /* written by Pavel Cahyna, 2006. Public domain. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.15.2.5 2018/03/08 09:56:05 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.15.2.6 2018/04/12 22:33:41 pgoyette Exp $"); /* * System call interface to the socket abstraction. @@ -44,6 +44,14 @@ compat_ifconf(u_long cmd, void *data) int bound; struct psref psref; + switch (cmd) { + case OSIOCGIFCONF: + case OOSIOCGIFCONF: + break; + default: + return ENOSYS; + } + if (docopy) { space = ifc->ifc_len; ifrp = ifc->ifc_req; @@ -153,14 +161,10 @@ release_exit: return error; } -static int (*orig_compat_ifconf)(u_long, void *); -static int (*orig_compat_ifconf)(u_long, void *); - void if_40_init(void) { - orig_compat_ifconf = vec_compat_ifconf; vec_compat_ifconf = compat_ifconf; } @@ -168,5 +172,5 @@ void if_40_fini(void) { - vec_compat_ifconf = orig_compat_ifconf; + vec_compat_ifconf = (void *)enosys; } Index: src/sys/compat/common/uipc_syscalls_50.c diff -u src/sys/compat/common/uipc_syscalls_50.c:1.3.56.3 src/sys/compat/common/uipc_syscalls_50.c:1.3.56.4 --- src/sys/compat/common/uipc_syscalls_50.c:1.3.56.3 Thu Mar 8 09:56:05 2018 +++ src/sys/compat/common/uipc_syscalls_50.c Thu Apr 12 22:33:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_syscalls_50.c,v 1.3.56.3 2018/03/08 09:56:05 pgoyette Exp $ */ +/* $NetBSD: uipc_syscalls_50.c,v 1.3.56.4 2018/04/12 22:33:41 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.3.56.3 2018/03/08 09:56:05 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.3.56.4 2018/04/12 22:33:41 pgoyette Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -57,7 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscall #include <compat/sys/if.h> /*ARGSUSED*/ -int +static int compat_ifdatareq(struct lwp *l, u_long cmd, void *data) { struct oifdatareq *ifdr = data; @@ -92,19 +92,16 @@ compat_ifdatareq(struct lwp *l, u_long c return 0; default: - return EINVAL; + return ENOSYS; } } /* Save and restore compat vector as needed */ -int (*orig_compat_ifdatareq)(struct lwp *, u_long, void *); - void if_50_init(void) { - orig_compat_ifdatareq = vec_compat_ifdatareq; vec_compat_ifdatareq = compat_ifdatareq; } @@ -112,5 +109,5 @@ void if_50_fini(void) { - vec_compat_ifdatareq = orig_compat_ifdatareq; + vec_compat_ifdatareq = (void *)enosys; } Index: src/sys/compat/sys/sockio.h diff -u src/sys/compat/sys/sockio.h:1.10.58.1 src/sys/compat/sys/sockio.h:1.10.58.2 --- src/sys/compat/sys/sockio.h:1.10.58.1 Thu Mar 8 01:37:46 2018 +++ src/sys/compat/sys/sockio.h Thu Apr 12 22:33:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: sockio.h,v 1.10.58.1 2018/03/08 01:37:46 pgoyette Exp $ */ +/* $NetBSD: sockio.h,v 1.10.58.2 2018/04/12 22:33:41 pgoyette Exp $ */ /*- * Copyright (c) 1982, 1986, 1990, 1993, 1994 @@ -56,8 +56,10 @@ #endif /* _KERNEL_OPT */ +#define OIFNAMSIZ 16 + struct oifreq { - char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + char ifr_name[OIFNAMSIZ]; /* if name, e.g. "en0" */ union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; @@ -114,7 +116,7 @@ struct oif_data { }; struct oifdatareq { - char ifdr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + char ifdr_name[OIFNAMSIZ]; /* if name, e.g. "en0" */ struct oif_data ifdr_data; }; @@ -178,7 +180,9 @@ struct oifdatareq { (ni)->ifi_lastchange.tv_nsec = \ (oi)->ifi_lastchange.tv_usec * 1000; \ } while (/*CONSTCOND*/0) + #ifdef _KERNEL + void if_50_init(void); void if_50_fini(void); @@ -186,5 +190,7 @@ __BEGIN_DECLS int compat_ifconf(u_long, void *); int compat_ifdatareq(struct lwp *, u_long, void *); __END_DECLS + #endif + #endif /* _COMPAT_SYS_SOCKIO_H_ */ Index: src/sys/kern/kern_stub.c diff -u src/sys/kern/kern_stub.c:1.44.2.1 src/sys/kern/kern_stub.c:1.44.2.2 --- src/sys/kern/kern_stub.c:1.44.2.1 Sat Mar 10 03:33:27 2018 +++ src/sys/kern/kern_stub.c Thu Apr 12 22:33:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_stub.c,v 1.44.2.1 2018/03/10 03:33:27 pgoyette Exp $ */ +/* $NetBSD: kern_stub.c,v 1.44.2.2 2018/04/12 22:33:41 pgoyette Exp $ */ /*- * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. @@ -62,11 +62,12 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.44.2.1 2018/03/10 03:33:27 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.44.2.2 2018/04/12 22:33:41 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_ktrace.h" #include "opt_sysv.h" +#include "opt_modular.h" #endif #include <sys/param.h> @@ -87,6 +88,21 @@ bool default_bus_space_handle_is_equal(b bus_space_handle_t); /* + * SYSV Semaphores, Shared Memory, Message Queues + */ +#ifndef MODULAR +#ifndef SYSVMSG +__strong_alias(msgctl1,enosys); +#endif +#ifndef SYSVSHM +__strong_alias(shmctl1,enosys); +#endif + #ifndef SYSVSEM + __strong_alias(semctl1,enosys); + #endif +#endif + +/* * ktrace stubs. ktruser() goes to enosys as we want to fail the syscall, * but not kill the process: utrace() is a debugging feature. */ Index: src/sys/net/if.c diff -u src/sys/net/if.c:1.419.2.4 src/sys/net/if.c:1.419.2.5 --- src/sys/net/if.c:1.419.2.4 Thu Mar 8 00:25:30 2018 +++ src/sys/net/if.c Thu Apr 12 22:33:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.419.2.4 2018/03/08 00:25:30 pgoyette Exp $ */ +/* $NetBSD: if.c,v 1.419.2.5 2018/04/12 22:33:41 pgoyette Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.419.2.4 2018/03/08 00:25:30 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.419.2.5 2018/04/12 22:33:41 pgoyette Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -157,7 +157,6 @@ __KERNEL_RCSID(0, "$NetBSD: if.c,v 1.419 #include <compat/sys/sockio.h> #include <compat/sys/socket.h> -#include <compat/sys/if.h> MALLOC_DEFINE(M_IFADDR, "ifaddr", "interface address"); MALLOC_DEFINE(M_IFMADDR, "ether_multi", "link-level multicast address"); @@ -243,58 +242,12 @@ static void sysctl_net_pktq_setup(struct static void if_sysctl_setup(struct sysctllog **); -/* - * Pointer to stub or real compat_cvtcmd() depending on presence of - * the compat module - */ -u_long stub_compat_cvtcmd(u_long); -u_long (*vec_compat_cvtcmd)(u_long) = stub_compat_cvtcmd; - -/* Similarly, pointer to compat_ifioctl() if it is present */ - +/* Compatability vector functions */ +u_long (*vec_compat_cvtcmd)(u_long) = NULL; int (*vec_compat_ifioctl)(struct socket *, u_long, u_long, void *, struct lwp *) = NULL; - -/* - * And a few more - */ -int stub_compat_ifdatareq(struct lwp *, u_long, void *); -int (*vec_compat_ifdatareq)(struct lwp *, u_long, void *) = - stub_compat_ifdatareq; - -void stub_compat_ifreqo2n(struct oifreq *, struct ifreq *); -void (*vec_compat_ifreqo2n)(struct oifreq *, struct ifreq *) = - stub_compat_ifreqo2n; - -int stub_compat_ifconf(u_long, void *); -int (*vec_compat_ifconf)(u_long, void *) = stub_compat_ifconf; - -/* The stub version of compat_cvtcmd() */ -u_long stub_compat_cvtcmd(u_long cmd) -{ - - return cmd; -} - -/* The stub version of compat_ifdatareq() */ -int stub_compat_ifdatareq(struct lwp *l, u_long cmd, void *data) -{ - - return EINVAL; -} - -/* The stub version of compat_ifreqo2n() */ -void stub_compat_ifreqo2n(struct oifreq *old, struct ifreq *new) -{ - -} - -/* The stub version of compat_ifconf() */ -int stub_compat_ifconf(u_long cmd, void *data) -{ - - return EINVAL; -} +int (*vec_compat_ifconf)(struct lwp *, u_long, void *) = (void *)enosys; +int (*vec_compat_ifdatareq)(struct lwp *, u_long, void *) = (void *)enosys; static int if_listener_cb(kauth_cred_t cred, kauth_action_t action, void *cookie, @@ -3149,31 +3102,31 @@ doifioctl(struct socket *so, u_long cmd, int bound; switch (cmd) { -#ifdef COMPAT_OIFREQ - case OSIOCGIFCONF: - case OOSIOCGIFCONF: - return (*vec_compat_ifconf)(cmd, data); -#endif -#ifdef COMPAT_OIFDATA - case OSIOCGIFDATA: - case OSIOCZIFDATA: - return (*vec_compat_ifdatareq)(l, cmd, data); -#endif case SIOCGIFCONF: return ifconf(cmd, data); case SIOCINITIFADDR: return EPERM; + default: + error = (*vec_compat_ifconf)(l, cmd, data); + if (error != ENOSYS) + return error; + error = (*vec_compat_ifdatareq)(l, cmd, data); + if (error != ENOSYS) + return error; + break; } + ifr = data; #ifdef COMPAT_OIFREQ - cmd = (*vec_compat_cvtcmd)(cmd); - if (cmd != ocmd) { - oifr = data; - data = ifr = &ifrb; - (*vec_compat_ifreqo2n)(oifr, ifr); - } else + if (vec_compat_cvtcmd) { + cmd = (*vec_compat_cvtcmd)(cmd); + if (cmd != ocmd) { + oifr = data; + data = ifr = &ifrb; + ifreqo2n(oifr, ifr); + } + } #endif - ifr = data; switch (cmd) { case SIOCIFCREATE: @@ -3420,21 +3373,23 @@ release_exit: int ifreq_setaddr(u_long cmd, struct ifreq *ifr, const struct sockaddr *sa) { - uint8_t len; + uint8_t len = sizeof(ifr->ifr_ifru.ifru_space); #ifdef COMPAT_OIFREQ struct ifreq ifrb; struct oifreq *oifr = NULL; u_long ocmd = cmd; - cmd = (*vec_compat_cvtcmd)(cmd); - if (cmd != ocmd) { - oifr = (struct oifreq *)(void *)ifr; - ifr = &ifrb; - (*vec_compat_ifreqo2n)(oifr, ifr); - len = sizeof(oifr->ifr_addr); - } else -#endif - len = sizeof(ifr->ifr_ifru.ifru_space); + if (vec_compat_cvtcmd) { + cmd = (*vec_compat_cvtcmd)(cmd); + if (cmd != ocmd) { + oifr = (struct oifreq *)(void *)ifr; + ifr = &ifrb; + ifreqo2n(oifr, ifr); + len = sizeof(oifr->ifr_addr); + } + } + +#endif if (len < sa->sa_len) return EFBIG; Index: src/sys/rump/librump/rumpnet/net_stub.c diff -u src/sys/rump/librump/rumpnet/net_stub.c:1.31 src/sys/rump/librump/rumpnet/net_stub.c:1.31.2.1 --- src/sys/rump/librump/rumpnet/net_stub.c:1.31 Tue Feb 27 15:01:30 2018 +++ src/sys/rump/librump/rumpnet/net_stub.c Thu Apr 12 22:33:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: net_stub.c,v 1.31 2018/02/27 15:01:30 maxv Exp $ */ +/* $NetBSD: net_stub.c,v 1.31.2.1 2018/04/12 22:33:41 pgoyette Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.31 2018/02/27 15:01:30 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.31.2.1 2018/04/12 22:33:41 pgoyette Exp $"); #include <sys/mutex.h> #include <sys/param.h> @@ -109,10 +109,3 @@ __weak_alias(key_sp_unref,rumpnet_stub); struct ifnet_head ifnet_list; struct pslist_head ifnet_pslist; kmutex_t ifnet_mtx; - -int -compat_ifconf(u_long cmd, void *data) -{ - - return EOPNOTSUPP; -}