diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-08 21:22:04 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-08 21:22:04 +0000 |
commit | 08134b843eeef6fd346701d831841ed9d464657e (patch) | |
tree | 4e94be7c894a1e772978b71f3e70486d80aba904 /sys/netinet6/nd6.h | |
parent | 0fc8d906ee05a54d73bd80f1177a009e116cf60d (diff) |
sync with latest KAME in6_ifaddr/prefix/default router manipulation.
behavior changes:
- two iocts used by ndp(8) are now obsolete (backward compat provided).
use sysctl path instead.
- lo0 does not get ::1 automatically. it will get ::1 when lo0 comes up.
Diffstat (limited to 'sys/netinet6/nd6.h')
-rw-r--r-- | sys/netinet6/nd6.h | 110 |
1 files changed, 75 insertions, 35 deletions
diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index 1e46bbfc22a..efdc22adf8a 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -1,5 +1,5 @@ -/* $OpenBSD: nd6.h,v 1.21 2002/06/07 02:33:04 itojun Exp $ */ -/* $KAME: nd6.h,v 1.93 2002/06/05 00:56:22 itojun Exp $ */ +/* $OpenBSD: nd6.h,v 1.22 2002/06/08 21:22:03 itojun Exp $ */ +/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,6 +93,7 @@ struct nd_ifinfo { }; #define ND6_IFF_PERFORMNUD 0x1 +#define ND6_IFF_ACCEPT_RTADV 0x2 #ifdef _KERNEL #define ND_IFINFO(ifp) \ @@ -126,6 +127,32 @@ struct in6_drlist { } defrouter[DRLSTSIZ]; }; +struct in6_defrouter { + struct sockaddr_in6 rtaddr; + u_char flags; + u_short rtlifetime; + u_long expire; + u_short if_index; +}; + +#ifdef _KERNEL +struct in6_oprlist { + char ifname[IFNAMSIZ]; + struct { + struct in6_addr prefix; + struct prf_ra raflags; + 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]; +}; +#endif + struct in6_prlist { char ifname[IFNAMSIZ]; struct { @@ -133,15 +160,30 @@ struct in6_prlist { struct prf_ra raflags; u_char prefixlen; u_char origin; - u_long vltime; - u_long pltime; - u_long expire; + u_int32_t vltime; + u_int32_t pltime; + time_t expire; u_short if_index; u_short advrtrs; /* number of advertisement routers */ 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; + 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 */ + /* struct sockaddr_in6 advrtr[] */ +}; + #ifdef _KERNEL struct in6_ondireq { char ifname[IFNAMSIZ]; @@ -169,6 +211,10 @@ struct in6_ndifreq { u_long ifindex; }; +/* Prefix status */ +#define NDPRF_ONLINK 0x1 +#define NDPRF_DETACHED 0x2 +#define NDPRF_HOME 0x4 /* protocol constants */ #define MAX_RTR_SOLICITATION_DELAY 1 /*1sec*/ @@ -192,10 +238,11 @@ TAILQ_HEAD(nd_drhead, nd_defrouter); struct nd_defrouter { TAILQ_ENTRY(nd_defrouter) dr_entry; struct in6_addr rtaddr; - u_char flags; + u_char flags; /* flags on RA message */ u_short rtlifetime; u_long expire; struct ifnet *ifp; + int installed; /* is installed into kernel routing table */ }; struct nd_prefix { @@ -203,19 +250,20 @@ struct nd_prefix { LIST_ENTRY(nd_prefix) ndpr_entry; struct sockaddr_in6 ndpr_prefix; /* prefix */ struct in6_addr ndpr_mask; /* netmask derived from the prefix */ - struct in6_addr ndpr_addr; /* address that is 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 */ + struct prf_ra ndpr_flags; + u_int32_t ndpr_stateflags; /* actual state flags */ /* list of routers that advertise the prefix: */ LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs; u_char ndpr_plen; - struct ndpr_stateflags { - /* if this prefix can be regarded as on-link */ - u_char onlink : 1; - } ndpr_stateflags; + int ndpr_refcnt; /* reference couter from addresses */ }; #define ndpr_next ndpr_entry.le_next @@ -223,15 +271,7 @@ struct nd_prefix { #define ndpr_raf ndpr_flags #define ndpr_raf_onlink ndpr_flags.onlink #define ndpr_raf_auto ndpr_flags.autonomous - -#define ndpr_statef_onlink ndpr_stateflags.onlink -#define ndpr_statef_addmark ndpr_stateflags.addmark - -/* - * We keep expired prefix for certain amount of time, for validation purposes. - * 1800s = MaxRtrAdvInterval - */ -#define NDPR_KEEP_EXPIRED (1800 * 2) +#define ndpr_raf_router ndpr_flags.router /* * Message format for use in obtaining information about prefixes @@ -259,9 +299,6 @@ struct inet6_ndpr_msghdr { #define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid #define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd -#define ifpr2ndpr(ifpr) ((struct nd_prefix *)(ifpr)) -#define ndpr2ifpr(ndpr) ((struct ifprefix *)(ndpr)) - struct nd_pfxrouter { LIST_ENTRY(nd_pfxrouter) pfr_entry; #define pfr_next pfr_entry.le_next @@ -288,7 +325,6 @@ extern int nd6_debug; extern struct timeout nd6_timer_ch; /* nd6_rtr.c */ -extern struct ifnet *nd6_defifp; /* XXXYYY */ extern int nd6_defifindex; union nd_opts { @@ -329,10 +365,9 @@ struct rtentry *nd6_lookup(struct in6_addr *, int, struct ifnet *); void nd6_setmtu(struct ifnet *); void nd6_timer(void *); void nd6_purge(struct ifnet *); -struct llinfo_nd6 *nd6_free(struct rtentry *); void nd6_nud_hint(struct rtentry *, struct in6_addr *, int); int nd6_resolve(struct ifnet *, struct rtentry *, - struct mbuf *, struct sockaddr *, u_char *); + struct mbuf *, struct sockaddr *, u_char *); void nd6_rtrequest(int, struct rtentry *, struct rt_addrinfo *); void nd6_p2p_rtrequest(int, struct rtentry *, struct rt_addrinfo *); int nd6_ioctl(u_long, caddr_t, struct ifnet *); @@ -340,17 +375,19 @@ struct rtentry *nd6_cache_lladdr(struct ifnet *, struct in6_addr *, char *, int, int, int); /* for test */ int nd6_output(struct ifnet *, struct ifnet *, struct mbuf *, - struct sockaddr_in6 *, struct rtentry *); + struct sockaddr_in6 *, struct rtentry *); int nd6_storelladdr(struct ifnet *, struct rtentry *, struct mbuf *, - struct sockaddr *, u_char *); + struct sockaddr *, u_char *); +int nd6_sysctl(int, void *, size_t *, void *, size_t); +int nd6_need_cache(struct ifnet *); /* nd6_nbr.c */ void nd6_na_input(struct mbuf *, int, int); void nd6_na_output(struct ifnet *, struct in6_addr *, - struct in6_addr *, u_long, int, struct sockaddr *); + struct in6_addr *, u_long, int, struct sockaddr *); void nd6_ns_input(struct mbuf *, int, int); void nd6_ns_output(struct ifnet *, struct in6_addr *, - struct in6_addr *, struct llinfo_nd6 *, int); + struct in6_addr *, struct llinfo_nd6 *, int); caddr_t nd6_ifptomac(struct ifnet *); void nd6_dad_start(struct ifaddr *, int *); void nd6_dad_stop(struct ifaddr *); @@ -361,15 +398,18 @@ void nd6_rs_input(struct mbuf *, int, int); void nd6_ra_input(struct mbuf *, int, int); void prelist_del(struct nd_prefix *); void defrouter_addreq(struct nd_defrouter *); -void defrouter_delreq(struct nd_defrouter *, int); +void defrouter_reset(void); void defrouter_select(void); void defrtrlist_del(struct nd_defrouter *); void prelist_remove(struct nd_prefix *); -int prelist_update(struct nd_prefix *, struct nd_defrouter *, - struct mbuf *); +int prelist_update(struct nd_prefix *, struct nd_defrouter *, struct mbuf *); +int nd6_prelist_add(struct nd_prefix *, struct nd_defrouter *, + struct nd_prefix **); +int nd6_prefix_onlink(struct nd_prefix *); +int nd6_prefix_offlink(struct nd_prefix *); void pfxlist_onlink_check(void); -struct nd_defrouter *defrouter_lookup(struct in6_addr *, - struct ifnet *); +struct nd_defrouter *defrouter_lookup(struct in6_addr *, struct ifnet *); +struct nd_prefix *nd6_prefix_lookup(struct nd_prefix *); int in6_ifdel(struct ifnet *, struct in6_addr *); int in6_init_prefix_ltimes(struct nd_prefix *ndpr); void rt6_flush(struct in6_addr *, struct ifnet *); |