Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net COMPAT_50 support for SPPP[GS]ETIDLETO and SPPP[GS]E...



details:   https://anonhg.NetBSD.org/src/rev/7d3151d2a368
branches:  trunk
changeset: 754106:7d3151d2a368
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Apr 20 14:32:03 2010 +0000

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

diffstat:

 sys/net/if_sppp.h     |  18 +++++++++++++++++-
 sys/net/if_spppsubr.c |  49 ++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 63 insertions(+), 4 deletions(-)

diffs (131 lines):

diff -r 37edd8263a94 -r 7d3151d2a368 sys/net/if_sppp.h
--- a/sys/net/if_sppp.h Tue Apr 20 13:03:33 2010 +0000
+++ b/sys/net/if_sppp.h Tue Apr 20 14:32:03 2010 +0000
@@ -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! */
 
diff -r 37edd8263a94 -r 7d3151d2a368 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Tue Apr 20 13:03:33 2010 +0000
+++ b/sys/net/if_spppsubr.c     Tue Apr 20 14:32:03 2010 +0000
@@ -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);
        }



Home | Main Index | Thread Index | Old Index