Skip to content

Commit

Permalink
Add support for PPPOEGETPARMS and PPPOESETPARMS.
Browse files Browse the repository at this point in the history
  • Loading branch information
roy committed May 31, 2015
1 parent d72a255 commit 3947ce0
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
44 changes: 42 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.76 2015/05/31 22:16:16 roy Exp $ */
/* $NetBSD: netbsd32_ioctl.c,v 1.77 2015/05/31 22:19:41 roy Exp $ */

/*
* Copyright (c) 1998, 2001 Matthew R. Green
Expand Down Expand Up @@ -31,8 +31,9 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.76 2015/05/31 22:16:16 roy Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.77 2015/05/31 22:19:41 roy Exp $");

#include "pppoe.h"
#include "sppp.h"

#include <sys/param.h>
Expand Down Expand Up @@ -67,6 +68,9 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.76 2015/05/31 22:16:16 roy Exp
#include <net/if.h>
#include <net/route.h>

#if NPPPOE > 0
#include <net/if_pppoe.h>
#endif
#if NSPPP > 0
#include <net/if_sppp.h>
#endif
Expand Down Expand Up @@ -165,6 +169,21 @@ netbsd32_to_ifmediareq(struct netbsd32_ifmediareq *s32p, struct ifmediareq *p, u
p->ifm_ulist = (int *)NETBSD32PTR64(s32p->ifm_ulist);
}

#if NPPPOE > 0
static inline void
netbsd32_to_pppoediscparms(struct netbsd32_pppoediscparms *s32p,
struct pppoediscparms *p, u_long cmd)
{

memcpy(p->ifname, s32p->ifname, sizeof p->ifname);
memcpy(p->eth_ifname, s32p->eth_ifname, sizeof p->eth_ifname);
p->ac_name = (char *)NETBSD32PTR64(s32p->ac_name);
p->ac_name_len = s32p->ac_name_len;
p->service_name = (char *)NETBSD32PTR64(s32p->service_name);
p->service_name_len = s32p->service_name_len;
}
#endif

#if NSPPP > 0
static inline void
netbsd32_to_spppauthcfg(struct netbsd32_spppauthcfg *s32p,
Expand Down Expand Up @@ -529,6 +548,21 @@ netbsd32_from_ifmediareq(struct ifmediareq *p, struct netbsd32_ifmediareq *s32p,
#endif
}

#if NPPPOE > 0
static inline void
netbsd32_from_pppoediscparms(struct pppoediscparms *p,
struct netbsd32_pppoediscparms *s32p, u_long cmd)
{

memcpy(s32p->ifname, p->ifname, sizeof s32p->ifname);
memcpy(s32p->eth_ifname, p->eth_ifname, sizeof s32p->eth_ifname);
NETBSD32PTR32(s32p->ac_name, p->ac_name);
s32p->ac_name_len = p->ac_name_len;
NETBSD32PTR32(s32p->service_name, p->service_name);
s32p->service_name_len = p->service_name_len;
}
#endif

#if NSPPP > 0
static inline void
netbsd32_from_spppauthcfg(struct spppauthcfg *p,
Expand Down Expand Up @@ -1090,6 +1124,12 @@ netbsd32_ioctl(struct lwp *l, const struct netbsd32_ioctl_args *uap, register_t
case SIOCGIFMEDIA32:
IOCTL_STRUCT_CONV_TO(SIOCGIFMEDIA, ifmediareq);

#if NPPPOE > 0
case PPPOESETPARMS32:
IOCTL_STRUCT_CONV_TO(PPPOESETPARMS, pppoediscparms);
case PPPOEGETPARMS32:
IOCTL_STRUCT_CONV_TO(PPPOEGETPARMS, pppoediscparms);
#endif
#if NSPPP > 0
case SPPPGETAUTHCFG32:
IOCTL_STRUCT_CONV_TO(SPPPGETAUTHCFG, spppauthcfg);
Expand Down
14 changes: 13 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.50 2015/05/31 22:16:16 roy Exp $ */
/* $NetBSD: netbsd32_ioctl.h,v 1.51 2015/05/31 22:19:41 roy Exp $ */

/*
* Copyright (c) 1998, 2001 Matthew R. Green
Expand Down Expand Up @@ -426,6 +426,18 @@ struct netbsd32_ifmediareq {
/* from <sys/sockio.h> */
#define SIOCGIFMEDIA32 _IOWR('i', 54, struct netbsd32_ifmediareq) /* get net media */

/* from net/if_pppoe.h */
struct netbsd32_pppoediscparms {
char ifname[IFNAMSIZ]; /* pppoe interface name */
char eth_ifname[IFNAMSIZ]; /* external ethernet interface name */
netbsd32_charp ac_name; /* access concentrator name (or NULL) */
netbsd32_size_t ac_name_len; /* on write: length of buffer for ac_name */
netbsd32_charp service_name; /* service name (or NULL) */
netbsd32_size_t service_name_len; /* on write: length of buffer for service name */
};
#define PPPOESETPARMS32 _IOW('i', 110, struct netbsd32_pppoediscparms)
#define PPPOEGETPARMS32 _IOWR('i', 111, struct netbsd32_pppoediscparms)

/* from net/if_sppp.h */
struct netbsd32_spppauthcfg {
char ifname[IFNAMSIZ]; /* pppoe interface name */
Expand Down

0 comments on commit 3947ce0

Please sign in to comment.