Module Name: src
Committed By: pgoyette
Date: Wed Mar 21 10:12:49 UTC 2018
Modified Files:
src/sys/compat/common [pgoyette-compat]: Makefile.sysio compat_80_mod.c
files.common
src/sys/kern [pgoyette-compat]: compat_stub.c
src/sys/modules/compat_50 [pgoyette-compat]: Makefile
src/sys/net [pgoyette-compat]: if_spppsubr.c
src/sys/sys [pgoyette-compat]: compat_stub.h
Added Files:
src/sys/compat/common [pgoyette-compat]: if_spppsubr50.c
if_spppsubr50.h
src/sys/modules/compat_80 [pgoyette-compat]: Makefile
Log Message:
Move if_spppsubr compat code into the compat50 module.
More prep work for compat80 module (for raidframe)
To generate a diff of this commit:
cvs rdiff -u -r1.7.18.6 -r1.7.18.7 src/sys/compat/common/Makefile.sysio
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/compat/common/compat_80_mod.c
cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/sys/compat/common/files.common
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/if_spppsubr50.c \
src/sys/compat/common/if_spppsubr50.h
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/modules/compat_50/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_80/Makefile
cvs rdiff -u -r1.179 -r1.179.2.1 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/sys/compat_stub.h
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.sysio
diff -u src/sys/compat/common/Makefile.sysio:1.7.18.6 src/sys/compat/common/Makefile.sysio:1.7.18.7
--- src/sys/compat/common/Makefile.sysio:1.7.18.6 Wed Mar 21 04:48:31 2018
+++ src/sys/compat/common/Makefile.sysio Wed Mar 21 10:12:48 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.sysio,v 1.7.18.6 2018/03/21 04:48:31 pgoyette Exp $
+# $NetBSD: Makefile.sysio,v 1.7.18.7 2018/03/21 10:12:48 pgoyette Exp $
# Sources for syscall and ioctl compatibility across the versions.
@@ -35,10 +35,14 @@ SRCS+= vfs_syscalls_40.c uipc_syscalls_4
# Compatibility code for NetBSD 5.0
SRCS+= kern_50.c kern_time_50.c kern_select_50.c rndpseudo_50.c rtsock_50.c \
- vfs_syscalls_50.c uipc_syscalls_50.c uvm_50.c clockctl_50.c
+ vfs_syscalls_50.c uipc_syscalls_50.c uvm_50.c clockctl_50.c \
+ if_spppsubr50.c
# Compatibility code for NetBSD 6.0
SRCS+= kern_sa_60.c tty_60.c kern_time_60.c kern_cpu_60.c ccd_60.c
# Compatibility code for NetBSD 7.0
SRCS+= rtsock_70.c uipc_usrreq_70.c
+
+# Compatability code for NetBSD 8.0
+SRCS+= raidframe80.c
Index: src/sys/compat/common/compat_80_mod.c
diff -u src/sys/compat/common/compat_80_mod.c:1.1.2.1 src/sys/compat/common/compat_80_mod.c:1.1.2.2
--- src/sys/compat/common/compat_80_mod.c:1.1.2.1 Wed Mar 21 10:01:04 2018
+++ src/sys/compat/common/compat_80_mod.c Wed Mar 21 10:12:48 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_80_mod.c,v 1.1.2.1 2018/03/21 10:01:04 pgoyette Exp $ */
+/* $NetBSD: compat_80_mod.c,v 1.1.2.2 2018/03/21 10:12:48 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.1.2.1 2018/03/21 10:01:04 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.1.2.2 2018/03/21 10:12:48 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -54,20 +54,24 @@ __KERNEL_RCSID(0, "$NetBSD: compat_80_mo
#include <compat/net/route.h>
#include <compat/net/route_70.h>
-int compat_70_init(void)
+int compat_80_init(void)
{
+ int error;
- vec_ocreds_valid = true;
- rtsock_70_init();
+ error = raidframe_80_init();
+ if (error != 0)
+ return error;
return 0;
}
-int compat_70_fini(void)
+int compat_80_fini(void)
{
+ int error;
- rtsock_70_fini();
- vec_ocreds_valid = false;
+ error = raidframe_80_fini();
+ if (error != 0)
+ return error;
return 0;
}
@@ -83,10 +87,10 @@ compat_70_modcmd(modcmd_t cmd, void *arg
switch (cmd) {
case MODULE_CMD_INIT:
- return compat_70_init();
+ return compat_80_init();
case MODULE_CMD_FINI:
- return compat_70_fini();
+ return compat_80_fini();
default:
return ENOTTY;
Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.1.2.15 src/sys/compat/common/files.common:1.1.2.16
--- src/sys/compat/common/files.common:1.1.2.15 Wed Mar 21 04:48:31 2018
+++ src/sys/compat/common/files.common Wed Mar 21 10:12:48 2018
@@ -1,4 +1,4 @@
-# $NetBSD: files.common,v 1.1.2.15 2018/03/21 04:48:31 pgoyette Exp $
+# $NetBSD: files.common,v 1.1.2.16 2018/03/21 10:12:48 pgoyette Exp $
#
# Generic files, used by all compat options.
@@ -65,6 +65,7 @@ file compat/common/rtsock_50.c compat_5
file compat/common/vfs_syscalls_50.c compat_50
file compat/common/uipc_syscalls_50.c compat_50
file compat/common/clockctl_50.c compat_50 & clockctl
+file compat/common/if_spppsubr50.c compat_50 & sppp
file compat/common/uvm_50.c compat_50
# Compatibility code for NetBSD 6.0
@@ -80,6 +81,10 @@ file compat/common/compat_70_mod.c comp
file compat/common/rtsock_70.c compat_70
file compat/common/uipc_usrreq_70.c compat_70
+# Compatability code for NetBSD 8.0
+file compat/common/compat_80_mod.c compat_80
+file compat/common/raidframe80.c compat_80 & raid
+
#
# Sources for sysv ipc compatibility across the versions.
#
Index: src/sys/kern/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.2 src/sys/kern/compat_stub.c:1.1.2.3
--- src/sys/kern/compat_stub.c:1.1.2.2 Wed Mar 21 04:48:32 2018
+++ src/sys/kern/compat_stub.c Wed Mar 21 10:12:49 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.2 2018/03/21 04:48:32 pgoyette Exp $ */
+/* $NetBSD: compat_stub.c,v 1.1.2.3 2018/03/21 10:12:49 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -63,3 +63,7 @@ int (*compat_ccd_ioctl_60)(dev_t dev, u_
int (*compat_clockctl_ioctl_50)(dev_t dev, u_long cmd, void *data, int flag,
struct lwp *l) = (void *)enosys;
+/*
+ * if_sppp device compatability ioctl subroutine
+ */
+int (*sppp_params50)(struct sppp *sp, u_long cmd, void *data) = (void *)enosys;
Index: src/sys/modules/compat_50/Makefile
diff -u src/sys/modules/compat_50/Makefile:1.1.2.2 src/sys/modules/compat_50/Makefile:1.1.2.3
--- src/sys/modules/compat_50/Makefile:1.1.2.2 Wed Mar 21 04:48:32 2018
+++ src/sys/modules/compat_50/Makefile Wed Mar 21 10:12:49 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.2.2 2018/03/21 04:48:32 pgoyette Exp $
+# $NetBSD: Makefile,v 1.1.2.3 2018/03/21 10:12:49 pgoyette Exp $
.include "../Makefile.inc"
@@ -11,7 +11,7 @@ CPPFLAGS+= -DCOMPAT_50 -DCOMPAT_60 -DCOM
SRCS+= compat_50_mod.c
SRCS+= kern_50.c kern_time_50.c kern_select_50.c
SRCS+= vfs_syscalls_50.c uipc_syscalls_50.c uvm_50.c
-SRCS+= rndpseudo_50.c clockctl_50.c
+SRCS+= rndpseudo_50.c clockctl_50.c if_spppsubr50.c
#SRCS+= rtsock_50.c
.include <bsd.kmodule.mk>
Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.179 src/sys/net/if_spppsubr.c:1.179.2.1
--- src/sys/net/if_spppsubr.c:1.179 Tue Feb 6 03:15:15 2018
+++ src/sys/net/if_spppsubr.c Wed Mar 21 10:12:49 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_spppsubr.c,v 1.179 2018/02/06 03:15:15 knakahara Exp $ */
+/* $NetBSD: if_spppsubr.c,v 1.179.2.1 2018/03/21 10:12:49 pgoyette Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.179 2018/02/06 03:15:15 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.179.2.1 2018/03/21 10:12:49 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -68,6 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_spppsubr.
#include <sys/module.h>
#include <sys/workqueue.h>
#include <sys/atomic.h>
+#include <sys/compat_stub.h>
#include <net/if.h>
#include <net/netisr.h>
@@ -5910,52 +5911,16 @@ sppp_params(struct sppp *sp, u_long cmd,
SPPP_UNLOCK(sp);
}
break;
-#if defined(COMPAT_50) || defined(MODULAR)
- case __SPPPGETIDLETO50:
- {
- struct spppidletimeout50 *to = (struct spppidletimeout50 *)data;
-
- SPPP_LOCK(sp, RW_READER);
- to->idle_seconds = (uint32_t)sp->pp_idle_timeout;
- SPPP_UNLOCK(sp);
- }
- break;
- case __SPPPSETIDLETO50:
- {
- struct spppidletimeout50 *to = (struct spppidletimeout50 *)data;
-
- SPPP_LOCK(sp, RW_WRITER);
- sp->pp_idle_timeout = (time_t)to->idle_seconds;
- SPPP_UNLOCK(sp);
- }
- break;
- case __SPPPGETKEEPALIVE50:
- {
- struct spppkeepalivesettings50 *settings =
- (struct spppkeepalivesettings50*)data;
-
- SPPP_LOCK(sp, RW_READER);
- settings->maxalive = sp->pp_maxalive;
- settings->max_noreceive = (uint32_t)sp->pp_max_noreceive;
- SPPP_UNLOCK(sp);
- }
- break;
- case __SPPPSETKEEPALIVE50:
+ default:
{
- struct spppkeepalivesettings50 *settings =
- (struct spppkeepalivesettings50*)data;
+ int ret;
- SPPP_LOCK(sp, RW_WRITER);
- sp->pp_maxalive = settings->maxalive;
- sp->pp_max_noreceive = (time_t)settings->max_noreceive;
- SPPP_UNLOCK(sp);
- }
- break;
-#endif /* COMPAT_50 || MODULAR */
- default:
+ ret = (*sppp_params50)(sp, cmd, data);
+ if (ret != ENOSYS)
+ return ret;
return (EINVAL);
+ }
}
-
return (0);
}
Index: src/sys/sys/compat_stub.h
diff -u src/sys/sys/compat_stub.h:1.1.2.2 src/sys/sys/compat_stub.h:1.1.2.3
--- src/sys/sys/compat_stub.h:1.1.2.2 Wed Mar 21 04:48:32 2018
+++ src/sys/sys/compat_stub.h Wed Mar 21 10:12:49 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.h,v 1.1.2.2 2018/03/21 04:48:32 pgoyette Exp $ */
+/* $NetBSD: compat_stub.h,v 1.1.2.3 2018/03/21 10:12:49 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -55,4 +55,11 @@ extern int (*compat_ccd_ioctl_60)(dev_t,
extern int (*compat_clockctl_ioctl_50)(dev_t, u_long, void *, int,
struct lwp *);
+
+/*
+ * if_sppp device compatability ioctl subroutine
+ */
+struct sppp;
+extern int (*sppp_params50)(struct sppp *, u_long, void *);
+
#endif /* _SYS_COMPAT_STUB_H */
Added files:
Index: src/sys/compat/common/if_spppsubr50.c
diff -u /dev/null src/sys/compat/common/if_spppsubr50.c:1.1.2.1
--- /dev/null Wed Mar 21 10:12:49 2018
+++ src/sys/compat/common/if_spppsubr50.c Wed Mar 21 10:12:48 2018
@@ -0,0 +1,169 @@
+/* $NetBSD: if_spppsubr50.c,v 1.1.2.1 2018/03/21 10:12:48 pgoyette Exp $ */
+
+/*
+ * Synchronous PPP/Cisco link level subroutines.
+ * Keepalive protocol implemented in both Cisco and PPP modes.
+ *
+ * Copyright (C) 1994-1996 Cronyx Engineering Ltd.
+ * Author: Serge Vakulenko, <[email protected]>
+ *
+ * Heavily revamped to conform to RFC 1661.
+ * Copyright (C) 1997, Joerg Wunsch.
+ *
+ * RFC2472 IPv6CP support.
+ * Copyright (C) 2000, Jun-ichiro itojun Hagino <[email protected]>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE FREEBSD PROJECT ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997
+ *
+ * From: if_spppsubr.c,v 1.39 1998/04/04 13:26:03 phk Exp
+ *
+ * From: Id: if_spppsubr.c,v 1.23 1999/02/23 14:47:50 hm Exp
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr50.c,v 1.1.2.1 2018/03/21 10:12:48 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_inet.h"
+#include "opt_modular.h"
+#include "opt_compat_netbsd.h"
+#include "opt_net_mpsafe.h"
+#endif
+
+
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/sockio.h>
+#include <sys/socket.h>
+#include <sys/syslog.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/callout.h>
+#include <sys/md5.h>
+#include <sys/inttypes.h>
+#include <sys/kauth.h>
+#include <sys/cprng.h>
+#include <sys/module.h>
+#include <sys/workqueue.h>
+#include <sys/atomic.h>
+#include <sys/compat_stub.h>
+
+#include <net/if.h>
+#include <net/netisr.h>
+#include <net/if_types.h>
+#include <net/route.h>
+#include <net/ppp_defs.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/in_var.h>
+#ifdef INET
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+#endif
+#include <net/ethertypes.h>
+
+#ifdef INET6
+#include <netinet6/scope6_var.h>
+#endif
+
+#include <net/if_sppp.h>
+#include <net/if_spppvar.h>
+
+#include <compat/common/if_spppsubr50.h>
+
+#ifdef NET_MPSAFE
+#define SPPPSUBR_MPSAFE 1
+#endif
+
+#define SPPP_LOCK(_sp, _op) rw_enter(&(_sp)->pp_lock, (_op))
+#define SPPP_UNLOCK(_sp) rw_exit(&(_sp)->pp_lock)
+
+int sppp_compat50_params(struct sppp *, u_long, void *);
+
+int
+sppp_compat50_params(struct sppp *sp, u_long cmd, void *data)
+{
+ switch (cmd) {
+ case __SPPPGETIDLETO50:
+ {
+ struct spppidletimeout50 *to = (struct spppidletimeout50 *)data;
+
+ SPPP_LOCK(sp, RW_READER);
+ to->idle_seconds = (uint32_t)sp->pp_idle_timeout;
+ SPPP_UNLOCK(sp);
+ }
+ break;
+ case __SPPPSETIDLETO50:
+ {
+ struct spppidletimeout50 *to = (struct spppidletimeout50 *)data;
+
+ SPPP_LOCK(sp, RW_WRITER);
+ sp->pp_idle_timeout = (time_t)to->idle_seconds;
+ SPPP_UNLOCK(sp);
+ }
+ break;
+ case __SPPPGETKEEPALIVE50:
+ {
+ struct spppkeepalivesettings50 *settings =
+ (struct spppkeepalivesettings50*)data;
+
+ SPPP_LOCK(sp, RW_READER);
+ settings->maxalive = sp->pp_maxalive;
+ settings->max_noreceive = (uint32_t)sp->pp_max_noreceive;
+ SPPP_UNLOCK(sp);
+ }
+ break;
+ case __SPPPSETKEEPALIVE50:
+ {
+ struct spppkeepalivesettings50 *settings =
+ (struct spppkeepalivesettings50*)data;
+
+ SPPP_LOCK(sp, RW_WRITER);
+ sp->pp_maxalive = settings->maxalive;
+ sp->pp_max_noreceive = (time_t)settings->max_noreceive;
+ SPPP_UNLOCK(sp);
+ }
+ break;
+ default:
+ return EINVAL;
+ }
+
+ return 0;
+}
+
+void
+if_spppsubr_50_init(void)
+{
+
+ sppp_params50 = sppp_compat50_params;
+}
+
+void
+if_spppsubr_50_fini(void)
+{
+
+ sppp_params50 = (void *)enosys;
+}
Index: src/sys/compat/common/if_spppsubr50.h
diff -u /dev/null src/sys/compat/common/if_spppsubr50.h:1.1.2.1
--- /dev/null Wed Mar 21 10:12:49 2018
+++ src/sys/compat/common/if_spppsubr50.h Wed Mar 21 10:12:48 2018
@@ -0,0 +1,38 @@
+/* $NetBSD: if_spppsubr50.h,v 1.1.2.1 2018/03/21 10:12:48 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Goyette
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _COMPAT_IF_SPPPSUBR40_H_
+#define _COMPAT_IF_SPPPSUBR40_H_
+
+void if_spppsubr_50_init(void);
+void if_spppsubr_50_fini(void);
+
+#endif /* _COMPAT_IF_SPPPSUBR40_H_ */
Index: src/sys/modules/compat_80/Makefile
diff -u /dev/null src/sys/modules/compat_80/Makefile:1.1.2.1
--- /dev/null Wed Mar 21 10:12:49 2018
+++ src/sys/modules/compat_80/Makefile Wed Mar 21 10:12:49 2018
@@ -0,0 +1,13 @@
+# $NetBSD: Makefile,v 1.1.2.1 2018/03/21 10:12:49 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/compat/common
+
+KMOD= compat_80
+
+CPPFLAGS+= -DCOMPAT_80
+
+SRCS+= compat_80_mod.c raidframe80.c
+
+.include <bsd.kmodule.mk>