summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2013-08-11 22:13:33 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2013-08-11 22:13:33 +0000
commitc56fee9e71c36858614fa30c04b1287fefad6a96 (patch)
treedde51d665b91553290f222f298e2eb793e4c5dbc
parent3fa5914c3e7a38d3fc898f85de3e32f4c225ba92 (diff)
To control the lifetime of IPv6 addresses, prefixes and default
routers, the kernel and ndp use a bunch of expire fields. Before they were int or u_long, convert expire to time_t in all structs. Move vltime and pltime to u_int32_t everywhere. Sort struct fields by size. Struct inet6_ndpr_msghdr is not used at all, so remove it. Binary compatibility of rtsold and ndp break with this change as rtsold uses in6_drlist and ndp uses in6_defrouter and in6_prefix to interact with the kernel. OK mpi@
-rw-r--r--sys/netinet6/nd6.h102
1 files changed, 38 insertions, 64 deletions
diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h
index 8825557dab5..02a74df474a 100644
--- a/sys/netinet6/nd6.h
+++ b/sys/netinet6/nd6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.h,v 1.31 2013/07/01 14:22:20 bluhm Exp $ */
+/* $OpenBSD: nd6.h,v 1.32 2013/08/11 22:13:32 bluhm Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
@@ -46,14 +46,14 @@ struct llinfo_nd6 {
struct llinfo_nd6 *ln_prev;
struct rtentry *ln_rt;
struct mbuf *ln_hold; /* last packet until resolved/timeout */
- long ln_asked; /* number of queries already sent for this addr */
- u_long ln_expire; /* lifetime for NDP state transition */
+ time_t ln_expire; /* lifetime for NDP state transition */
+ long ln_asked; /* number of queries already sent for addr */
+ int ln_byhint; /* # of times we made it reachable by UL hint */
short ln_state; /* reachability state */
short ln_router; /* 2^0: ND6 router bit */
- int ln_byhint; /* # of times we made it reachable by UL hint */
long ln_ntick;
- struct timeout ln_timer_ch;
+ struct timeout ln_timer_ch;
};
#define ND6_LLINFO_PURGE -3
@@ -107,10 +107,10 @@ struct nd_ifinfo {
struct in6_nbrinfo {
char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
struct in6_addr addr; /* IPv6 address of the neighbor */
- long asked; /* number of queries already sent for this addr */
+ time_t expire; /* lifetime for NDP state transition */
+ long asked; /* number of queries already sent for addr */
int isrouter; /* if it acts as a router */
int state; /* reachability state */
- int expire; /* lifetime for NDP state transition */
};
#define DRLSTSIZ 10
@@ -119,19 +119,19 @@ struct in6_drlist {
char ifname[IFNAMSIZ];
struct {
struct in6_addr rtaddr;
- u_char flags;
+ time_t expire;
u_short rtlifetime;
- u_long expire;
- u_short if_index;
+ u_short if_index;
+ u_char flags;
} defrouter[DRLSTSIZ];
};
struct in6_defrouter {
struct sockaddr_in6 rtaddr;
- u_char flags;
+ time_t expire;
u_short rtlifetime;
- u_long expire;
- u_short if_index;
+ u_short if_index;
+ u_char flags;
};
#ifdef _KERNEL
@@ -139,14 +139,14 @@ struct in6_oprlist {
char ifname[IFNAMSIZ];
struct {
struct in6_addr prefix;
- struct prf_ra raflags;
+ struct prf_ra raflags;
+ time_t expire;
+ u_int32_t vltime;
+ u_int32_t pltime;
+ u_short if_index;
+ u_short advrtrs; /* number of advertisement routers */
u_char prefixlen;
u_char origin;
- u_long vltime;
- u_long pltime;
- u_long expire;
- u_short if_index;
- u_short advrtrs; /* number of advertisement routers */
struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
} prefix[PRLSTSIZ];
};
@@ -156,30 +156,30 @@ struct in6_prlist {
char ifname[IFNAMSIZ];
struct {
struct in6_addr prefix;
- struct prf_ra raflags;
- u_char prefixlen;
- u_char origin;
+ struct prf_ra raflags;
+ time_t expire;
u_int32_t vltime;
u_int32_t pltime;
- time_t expire;
- u_short if_index;
- u_short advrtrs; /* number of advertisement routers */
+ u_short if_index;
+ u_short advrtrs; /* number of advertisement routers */
+ u_char prefixlen;
+ u_char origin;
struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
} prefix[PRLSTSIZ];
};
struct in6_prefix {
struct sockaddr_in6 prefix;
- struct prf_ra raflags;
- u_char prefixlen;
- u_char origin;
+ struct prf_ra raflags;
+ time_t expire;
u_int32_t vltime;
u_int32_t pltime;
- time_t expire;
u_int32_t flags;
- int refcnt;
- u_short if_index;
- u_short advrtrs; /* number of advertisement routers */
+ int refcnt;
+ u_short if_index;
+ u_short advrtrs; /* number of advertisement routers */
+ u_char prefixlen;
+ u_char origin;
/* struct sockaddr_in6 advrtr[] */
};
@@ -242,11 +242,11 @@ TAILQ_HEAD(nd_drhead, nd_defrouter);
struct nd_defrouter {
TAILQ_ENTRY(nd_defrouter) dr_entry;
struct in6_addr rtaddr;
- u_char flags; /* flags on RA message */
- u_short rtlifetime;
- u_long expire;
struct ifnet *ifp;
+ time_t expire;
int installed; /* is installed into kernel routing table */
+ u_short rtlifetime;
+ u_char flags; /* flags on RA message */
};
struct nd_prefix {
@@ -255,13 +255,13 @@ struct nd_prefix {
struct sockaddr_in6 ndpr_prefix; /* prefix */
struct in6_addr ndpr_mask; /* netmask derived from the prefix */
- u_int32_t ndpr_vltime; /* advertised valid lifetime */
- u_int32_t ndpr_pltime; /* advertised preferred lifetime */
-
time_t ndpr_expire; /* expiration time of the prefix */
time_t ndpr_preferred; /* preferred time of the prefix */
time_t ndpr_lastupdate; /* reception time of last advertisement */
+ u_int32_t ndpr_vltime; /* advertised valid lifetime */
+ u_int32_t ndpr_pltime; /* advertised preferred lifetime */
+
struct prf_ra ndpr_flags;
u_int32_t ndpr_stateflags; /* actual state flags */
/* list of routers that advertise the prefix: */
@@ -275,32 +275,6 @@ struct nd_prefix {
#define ndpr_raf_auto ndpr_flags.autonomous
#define ndpr_raf_router ndpr_flags.router
-/*
- * Message format for use in obtaining information about prefixes
- * from inet6 sysctl function
- */
-struct inet6_ndpr_msghdr {
- u_short inpm_msglen; /* to skip over non-understood messages */
- u_char inpm_version; /* future binary compatibility */
- u_char inpm_type; /* message type */
- struct in6_addr inpm_prefix;
- u_long prm_vltim;
- u_long prm_pltime;
- u_long prm_expire;
- u_long prm_preferred;
- struct in6_prflags prm_flags;
- u_short prm_index; /* index for associated ifp */
- u_char prm_plen; /* length of prefix in bits */
-};
-
-#define prm_raf_onlink prm_flags.prf_ra.onlink
-#define prm_raf_auto prm_flags.prf_ra.autonomous
-
-#define prm_statef_onlink prm_flags.prf_state.onlink
-
-#define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid
-#define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd
-
struct nd_pfxrouter {
LIST_ENTRY(nd_pfxrouter) pfr_entry;
struct nd_defrouter *router;