Module Name:    src
Committed By:   jmcneill
Date:           Tue Apr 20 14:32:03 UTC 2010

Modified Files:
        src/sys/net: if_sppp.h if_spppsubr.c

Log Message:
COMPAT_50 support for SPPP[GS]ETIDLETO and SPPP[GS]ETKEEPALIVE, ok martin@


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/net/if_sppp.h
cvs rdiff -u -r1.119 -r1.120 src/sys/net/if_spppsubr.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/net/if_sppp.h
diff -u src/sys/net/if_sppp.h:1.26 src/sys/net/if_sppp.h:1.27
--- src/sys/net/if_sppp.h:1.26	Mon Apr 28 20:24:09 2008
+++ src/sys/net/if_sppp.h	Tue Apr 20 14:32:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sppp.h,v 1.26 2008/04/28 20:24:09 martin Exp $	*/
+/*	$NetBSD: if_sppp.h,v 1.27 2010/04/20 14:32:03 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -101,8 +101,16 @@
 					 * disconnect, 0 to disable idle-timeout */
 };
 
+struct spppidletimeout50 {
+	char	ifname[IFNAMSIZ];	/* pppoe interface name */
+	uint32_t idle_seconds;		/* number of seconds idle before
+					 * disconnect, 0 to disable idle-timeout */
+};
+
 #define	SPPPGETIDLETO	_IOWR('i', 125, struct spppidletimeout)
 #define	SPPPSETIDLETO	_IOW('i', 126, struct spppidletimeout)
+#define	__SPPPGETIDLETO50	_IOWR('i', 125, struct spppidletimeout50)
+#define	__SPPPSETIDLETO50	_IOW('i', 126, struct spppidletimeout50)
 
 struct spppauthfailurestats {
 	char	ifname[IFNAMSIZ];	/* pppoe interface name */
@@ -141,8 +149,16 @@
 	time_t	max_noreceive;		/* (sec.) grace period before we start
 					   sending LCP echo requests. */
 };
+struct spppkeepalivesettings50 {
+	char	ifname[IFNAMSIZ];	/* pppoe interface name */
+	u_int	maxalive;		/* number of LCP echo req. w/o reply */
+	uint32_t max_noreceive;		/* (sec.) grace period before we start
+					   sending LCP echo requests. */
+};
 #define	SPPPSETKEEPALIVE	_IOW('i', 132, struct spppkeepalivesettings)
 #define	SPPPGETKEEPALIVE	_IOWR('i', 133, struct spppkeepalivesettings)
+#define	__SPPPSETKEEPALIVE50	_IOW('i', 132, struct spppkeepalivesettings50)
+#define	__SPPPGETKEEPALIVE50	_IOWR('i', 133, struct spppkeepalivesettings50)
 
 /* 134 already used! */
 

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.119 src/sys/net/if_spppsubr.c:1.120
--- src/sys/net/if_spppsubr.c:1.119	Sun Feb 28 15:52:17 2010
+++ src/sys/net/if_spppsubr.c	Tue Apr 20 14:32:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.119 2010/02/28 15:52:17 snj Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.120 2010/04/20 14:32:03 jmcneill Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,12 +41,17 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.119 2010/02/28 15:52:17 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.120 2010/04/20 14:32:03 jmcneill Exp $");
 
+#if defined(_KERNEL_OPT)
 #include "opt_inet.h"
 #include "opt_ipx.h"
 #include "opt_iso.h"
 #include "opt_pfil_hooks.h"
+#include "opt_modular.h"
+#include "opt_compat_netbsd.h"
+#endif
+
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -1095,6 +1100,10 @@
 	case SPPPSETAUTHFAILURE:
 	case SPPPSETDNSOPTS:
 	case SPPPSETKEEPALIVE:
+#if defined(COMPAT_50) || defined(MODULAR)
+	case __SPPPSETIDLETO50:
+	case __SPPPSETKEEPALIVE50:
+#endif /* COMPAT_50 || MODULAR */
 		error = kauth_authorize_network(l->l_cred,
 		    KAUTH_NETWORK_INTERFACE,
 		    KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd,
@@ -1122,6 +1131,10 @@
 	case SPPPGETDNSOPTS:
 	case SPPPGETDNSADDRS:
 	case SPPPGETKEEPALIVE:
+#if defined(COMPAT_50) || defined(MODULAR)
+	case __SPPPGETIDLETO50:
+	case __SPPPGETKEEPALIVE50:
+#endif /* COMPAT_50 || MODULAR */
 		error = sppp_params(sp, cmd, data);
 		break;
 
@@ -5327,6 +5340,36 @@
 		sp->pp_max_noreceive = settings->max_noreceive;
 	    }
 	    break;
+#if defined(COMPAT_50) || defined(MODULAR)
+	case __SPPPGETIDLETO50:
+	    {
+	    	struct spppidletimeout50 *to = (struct spppidletimeout50 *)data;
+		to->idle_seconds = (uint32_t)sp->pp_idle_timeout;
+	    }
+	    break;
+	case __SPPPSETIDLETO50:
+	    {
+	    	struct spppidletimeout50 *to = (struct spppidletimeout50 *)data;
+	    	sp->pp_idle_timeout = (time_t)to->idle_seconds;
+	    }
+	    break;
+	case __SPPPGETKEEPALIVE50:
+	    {
+	    	struct spppkeepalivesettings50 *settings =
+		     (struct spppkeepalivesettings50*)data;
+		settings->maxalive = sp->pp_maxalive;
+		settings->max_noreceive = (uint32_t)sp->pp_max_noreceive;
+	    }
+	    break;
+	case __SPPPSETKEEPALIVE50:
+	    {
+	    	struct spppkeepalivesettings50 *settings =
+		     (struct spppkeepalivesettings50*)data;
+		sp->pp_maxalive = settings->maxalive;
+		sp->pp_max_noreceive = (time_t)settings->max_noreceive;
+	    }
+	    break;
+#endif /* COMPAT_50 || MODULAR */
 	default:
 		return (EINVAL);
 	}

Reply via email to