Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 Support SPPPGETAUTHCFG and SPPPSETAUTHCFG.



details:   https://anonhg.NetBSD.org/src/rev/b58b46450b23
branches:  trunk
changeset: 338606:b58b46450b23
user:      roy <roy%NetBSD.org@localhost>
date:      Sun May 31 22:16:16 2015 +0000

description:
Support SPPPGETAUTHCFG and SPPPSETAUTHCFG.

diffstat:

 sys/compat/netbsd32/netbsd32_ioctl.c |  61 ++++++++++++++++++++++++++++++++++-
 sys/compat/netbsd32/netbsd32_ioctl.h |  21 +++++++++++-
 2 files changed, 79 insertions(+), 3 deletions(-)

diffs (138 lines):

diff -r 4827be55e7ec -r b58b46450b23 sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c      Sun May 31 22:15:52 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c      Sun May 31 22:16:16 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.c,v 1.75 2015/05/31 15:08:14 roy Exp $  */
+/*     $NetBSD: netbsd32_ioctl.c,v 1.76 2015/05/31 22:16:16 roy Exp $  */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.75 2015/05/31 15:08:14 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.76 2015/05/31 22:16:16 roy Exp $");
+
+#include "sppp.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -65,6 +67,10 @@
 #include <net/if.h>
 #include <net/route.h>
 
+#if NSPPP > 0
+#include <net/if_sppp.h>
+#endif
+
 #include <net/bpf.h>
 #include <netinet/in.h>
 #include <netinet/in_var.h>
@@ -159,6 +165,28 @@
        p->ifm_ulist = (int *)NETBSD32PTR64(s32p->ifm_ulist);
 }
 
+#if NSPPP > 0
+static inline void
+netbsd32_to_spppauthcfg(struct netbsd32_spppauthcfg *s32p,
+    struct spppauthcfg *p, u_long cmd)
+{
+
+       memcpy(p->ifname, s32p->ifname, sizeof p->ifname);
+       p->hisauth = s32p->hisauth;
+       p->myauth = s32p->myauth;
+       p->myname_length = s32p->myname_length;
+       p->mysecret_length = s32p->mysecret_length;
+       p->hisname_length = s32p->hisname_length;
+       p->hissecret_length = s32p->hissecret_length;
+       p->myauthflags = s32p->myauthflags;
+       p->hisauthflags = s32p->hisauthflags;
+       p->myname = (char *)NETBSD32PTR64(s32p->myname);
+       p->mysecret = (char *)NETBSD32PTR64(s32p->mysecret);
+       p->hisname = (char *)NETBSD32PTR64(s32p->hisname);
+       p->hissecret = (char *)NETBSD32PTR64(s32p->hissecret);
+}
+#endif
+
 static inline void
 netbsd32_to_ifdrv(struct netbsd32_ifdrv *s32p, struct ifdrv *p, u_long cmd)
 {
@@ -501,6 +529,28 @@
 #endif
 }
 
+#if NSPPP > 0
+static inline void
+netbsd32_from_spppauthcfg(struct spppauthcfg *p,
+    struct netbsd32_spppauthcfg *s32p, u_long cmd)
+{
+
+       memcpy(s32p->ifname, p->ifname, sizeof s32p->ifname);
+       s32p->hisauth = p->hisauth;
+       s32p->myauth = p->myauth;
+       s32p->myname_length = p->myname_length;
+       s32p->mysecret_length = p->mysecret_length;
+       s32p->hisname_length = p->hisname_length;
+       s32p->hissecret_length = p->hissecret_length;
+       s32p->myauthflags = p->myauthflags;
+       s32p->hisauthflags = p->hisauthflags;
+       NETBSD32PTR32(s32p->myname, p->myname);
+       NETBSD32PTR32(s32p->mysecret, p->mysecret);
+       NETBSD32PTR32(s32p->hisname, p->hisname);
+       NETBSD32PTR32(s32p->hissecret, p->hissecret);
+}
+#endif
+
 static inline void
 netbsd32_from_ifdrv(struct ifdrv *p, struct netbsd32_ifdrv *s32p, u_long cmd)
 {
@@ -1040,6 +1090,13 @@
        case SIOCGIFMEDIA32:
                IOCTL_STRUCT_CONV_TO(SIOCGIFMEDIA, ifmediareq);
 
+#if NSPPP > 0
+       case SPPPGETAUTHCFG32:
+               IOCTL_STRUCT_CONV_TO(SPPPGETAUTHCFG, spppauthcfg);
+       case SPPPSETAUTHCFG32:
+               IOCTL_STRUCT_CONV_TO(SPPPSETAUTHCFG, spppauthcfg);
+#endif
+
        case SIOCSDRVSPEC32:
                IOCTL_STRUCT_CONV_TO(SIOCSDRVSPEC, ifdrv);
        case SIOCGDRVSPEC32:
diff -r 4827be55e7ec -r b58b46450b23 sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h      Sun May 31 22:15:52 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h      Sun May 31 22:16:16 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.h,v 1.49 2015/05/27 21:42:43 matt Exp $ */
+/*     $NetBSD: netbsd32_ioctl.h,v 1.50 2015/05/31 22:16:16 roy Exp $  */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -426,6 +426,25 @@
 /* from <sys/sockio.h> */
 #define        SIOCGIFMEDIA32  _IOWR('i', 54, struct netbsd32_ifmediareq) /* get net media */
 
+/* from net/if_sppp.h */
+struct netbsd32_spppauthcfg {
+       char    ifname[IFNAMSIZ];       /* pppoe interface name */
+       u_int   hisauth;                /* one of SPPP_AUTHPROTO_* above */
+       u_int   myauth;                 /* one of SPPP_AUTHPROTO_* above */
+       u_int   myname_length;          /* includes terminating 0 */
+       u_int   mysecret_length;        /* includes terminating 0 */
+       u_int   hisname_length;         /* includes terminating 0 */
+       u_int   hissecret_length;       /* includes terminating 0 */
+       u_int   myauthflags;
+       u_int   hisauthflags;
+       netbsd32_charp  myname;
+       netbsd32_charp  mysecret;
+       netbsd32_charp  hisname;
+       netbsd32_charp  hissecret;
+};
+#define SPPPGETAUTHCFG32 _IOWR('i', 120, struct netbsd32_spppauthcfg)
+#define SPPPSETAUTHCFG32 _IOW('i', 121, struct netbsd32_spppauthcfg)
+
 /* from <net/if.h> */
 struct  netbsd32_ifdrv {
        char            ifd_name[IFNAMSIZ];     /* if name, e.g. "en0" */



Home | Main Index | Thread Index | Old Index