Skip to content

Commit

Permalink
Support SPPPGETAUTHCFG and SPPPSETAUTHCFG.
Browse files Browse the repository at this point in the history
  • Loading branch information
roy committed May 31, 2015
1 parent 6ab21b7 commit d72a255
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 3 deletions.
61 changes: 59 additions & 2 deletions sys/compat/netbsd32/netbsd32_ioctl.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -65,6 +67,10 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.75 2015/05/31 15:08:14 roy Exp
#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>
Expand Down Expand Up @@ -159,6 +165,28 @@ netbsd32_to_ifmediareq(struct netbsd32_ifmediareq *s32p, struct ifmediareq *p, u
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)
{
Expand Down Expand Up @@ -501,6 +529,28 @@ netbsd32_from_ifmediareq(struct ifmediareq *p, struct netbsd32_ifmediareq *s32p,
#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)
{
Expand Down Expand Up @@ -1040,6 +1090,13 @@ netbsd32_ioctl(struct lwp *l, const struct netbsd32_ioctl_args *uap, register_t
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:
Expand Down
21 changes: 20 additions & 1 deletion sys/compat/netbsd32/netbsd32_ioctl.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -426,6 +426,25 @@ struct netbsd32_ifmediareq {
/* 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" */
Expand Down

0 comments on commit d72a255

Please sign in to comment.