- switch the lifetime struct to time_t and provide compatibility for the

old ioctl.
This commit is contained in:
christos 2009-01-15 18:20:48 +00:00
parent ff90a0090a
commit ba8b020023
3 changed files with 29 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6.c,v 1.143 2008/12/19 18:49:39 cegger Exp $ */
/* $NetBSD: in6.c,v 1.144 2009/01/15 18:20:48 christos Exp $ */
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/*
@ -62,10 +62,11 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.143 2008/12/19 18:49:39 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.144 2009/01/15 18:20:48 christos Exp $");
#include "opt_inet.h"
#include "opt_pfil_hooks.h"
#include "opt_compat_netbsd.h"
#include <sys/param.h>
#include <sys/ioctl.h>
@ -103,6 +104,9 @@ __KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.143 2008/12/19 18:49:39 cegger Exp $");
#ifdef PFIL_HOOKS
#include <net/pfil.h>
#endif
#ifdef COMPAT_50
#include <compat/netinet6/in6_var.h>
#endif
MALLOC_DEFINE(M_IP6OPT, "ip6_options", "IPv6 options");
@ -443,6 +447,9 @@ in6_control1(struct socket *so, u_long cmd, void *data, struct ifnet *ifp,
case SIOCSPFXFLUSH_IN6:
case SIOCSRTRFLUSH_IN6:
case SIOCGIFALIFETIME_IN6:
#ifdef OSIOCGIFALIFETIME_IN6
case OSIOCGIFALIFETIME_IN6:
#endif
case SIOCGIFSTAT_IN6:
case SIOCGIFSTAT_ICMP6:
sa6 = &ifr->ifr_addr;
@ -503,6 +510,9 @@ in6_control1(struct socket *so, u_long cmd, void *data, struct ifnet *ifp,
case SIOCGIFNETMASK_IN6:
case SIOCGIFDSTADDR_IN6:
case SIOCGIFALIFETIME_IN6:
#ifdef OSIOCGIFALIFETIME_IN6
case OSIOCGIFALIFETIME_IN6:
#endif
/* must think again about its semantics */
if (ia == NULL)
return EADDRNOTAVAIL;
@ -555,6 +565,9 @@ in6_control1(struct socket *so, u_long cmd, void *data, struct ifnet *ifp,
*((struct in6_ifextra *)ifp->if_afdata[AF_INET6])->icmp6_ifstat;
break;
#ifdef OSIOCGIFALIFETIME_IN6
case OSIOCGIFALIFETIME_IN6:
#endif
case SIOCGIFALIFETIME_IN6:
ifr->ifr_ifru.ifru_lifetime = ia->ia6_lifetime;
if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) {
@ -593,6 +606,11 @@ in6_control1(struct socket *so, u_long cmd, void *data, struct ifnet *ifp,
} else
retlt->ia6t_preferred = maxexpire;
}
#ifdef OSIOCFIFALIFETIME_IN6
if (cmd == OSIOCFIFALIFETIME_IN6)
in6_addrlifetime_to_in6_addrlifetime50(
&ifr->ifru.ifru_lifetime);
#endif
break;
case SIOCAIFADDR_IN6:

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6_var.h,v 1.61 2009/01/14 18:06:52 christos Exp $ */
/* $NetBSD: in6_var.h,v 1.62 2009/01/15 18:20:48 christos Exp $ */
/* $KAME: in6_var.h,v 1.81 2002/06/08 11:16:51 itojun Exp $ */
/*
@ -82,8 +82,8 @@
* in kernel: modify preferred/expire only
*/
struct in6_addrlifetime {
int32_t ia6t_expire; /* valid lifetime expiration time */
int32_t ia6t_preferred; /* preferred lifetime expiration time */
time_t ia6t_expire; /* valid lifetime expiration time */
time_t ia6t_preferred; /* preferred lifetime expiration time */
u_int32_t ia6t_vltime; /* valid lifetime */
u_int32_t ia6t_pltime; /* prefix lifetime */
};
@ -419,8 +419,7 @@ struct in6_rrenumreq {
#define SIOCGNBRINFO_IN6 _IOWR('i', 78, struct in6_nbrinfo)
#define SIOCSPFXFLUSH_IN6 _IOWR('i', 79, struct in6_ifreq)
#define SIOCSRTRFLUSH_IN6 _IOWR('i', 80, struct in6_ifreq)
#define SIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq)
/* 81 was old SIOCGIFALIFETIME_IN6 */
#if 0
/* withdrawn - do not reuse number 82 */
#define SIOCSIFALIFETIME_IN6 _IOWR('i', 82, struct in6_ifreq)
@ -441,7 +440,10 @@ struct in6_rrenumreq {
struct in6_rrenumreq) /* change */
#define SIOCSGIFPREFIX_IN6 _IOW('i', 105, \
struct in6_rrenumreq) /* set global */
#define SIOCGIFALIFETIME_IN6 _IOWR('i', 106, struct in6_ifreq)
/* XXX: Someone decided to switch to 'u' here for unknown reasons! */
#define SIOCGETSGCNT_IN6 _IOWR('u', 106, \
struct sioc_sg_req6) /* get s,g pkt cnt */
#define SIOCGETMIFCNT_IN6 _IOWR('u', 107, \

View File

@ -1,4 +1,4 @@
/* $NetBSD: nd6.h,v 1.51 2008/10/24 17:07:33 dyoung Exp $ */
/* $NetBSD: nd6.h,v 1.52 2009/01/15 18:20:48 christos Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
@ -223,7 +223,7 @@ struct in6_ndifreq {
#define RTR_SOLICITATION_INTERVAL 4 /* 4sec */
#define MAX_RTR_SOLICITATIONS 3
#define ND6_INFINITE_LIFETIME 0xffffffff
#define ND6_INFINITE_LIFETIME ((u_int32_t)~0)
#ifdef _KERNEL
/* node constants */