/* %%% copyright-nrl-95 This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee, Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All rights under this copyright have been assigned to the US Naval Research Laboratory (NRL). The NRL Copyright Notice and License Agreement Version 1.1 (January 17, 1995) applies to this software. You should have received a copy of the license with this software. If you didn't get a copy, you may request one from . */ #ifndef _NETINET6_IPV6_VAR_H #define _NETINET6_IPV6_VAR_H 1 #include /* * IPv6 multicast "options". Session state for multicast, including * weird per-session multicast things. */ struct ipv6_moptions { struct ifnet *i6mo_multicast_ifp; /* ifp for outgoing multicasts */ u_char i6mo_multicast_ttl; /* TTL for outgoing multicasts. Does this matter in IPv6? */ u_char i6mo_multicast_loop; /* 1 => hear sends if a member */ u_short i6mo_num_memberships; /* no. memberships this socket */ struct in6_multi *i6mo_membership[IN6_MAX_MEMBERSHIPS]; }; /* * IPv6 stats. */ #if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802 #define _IPV6STAT_TYPE u_quad_t #else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802 */ #define _IPV6STAT_TYPE u_long #endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802 */ struct ipv6stat { _IPV6STAT_TYPE ips_total; /* total packets received */ _IPV6STAT_TYPE ips_tooshort; /* packet too short */ _IPV6STAT_TYPE ips_toosmall; /* not enough data */ _IPV6STAT_TYPE ips_fragments; /* fragments received */ _IPV6STAT_TYPE ips_fragdropped; /* frags dropped (dups, out of space) */ _IPV6STAT_TYPE ips_fragtimeout; /* fragments timed out */ _IPV6STAT_TYPE ips_forward; /* packets forwarded */ _IPV6STAT_TYPE ips_cantforward; /* packets rcvd for unreachable dest */ _IPV6STAT_TYPE ips_redirectsent; /* packets forwarded on same net */ _IPV6STAT_TYPE ips_noproto; /* unknown or unsupported protocol */ _IPV6STAT_TYPE ips_delivered; /* datagrams delivered to upper level*/ _IPV6STAT_TYPE ips_localout; /* total ip packets generated here */ _IPV6STAT_TYPE ips_odropped; /* lost packets due to nobufs, etc. */ _IPV6STAT_TYPE ips_reassembled; /* total packets reassembled ok */ _IPV6STAT_TYPE ips_fragmented; /* datagrams sucessfully fragmented */ _IPV6STAT_TYPE ips_ofragments; /* output fragments created */ _IPV6STAT_TYPE ips_cantfrag; /* don't fragment flag was set, etc. */ _IPV6STAT_TYPE ips_badoptions; /* error in option processing */ _IPV6STAT_TYPE ips_noroute; /* packets discarded due to no route */ _IPV6STAT_TYPE ips_badvers; /* IPv6 version != 6 */ _IPV6STAT_TYPE ips_rawout; /* total raw ip packets generated */ }; #ifdef _KERNEL /* * The IPv6 fragment queue entry structure. * Notes: * Nodes are stored in ttl order. * prefix comes from whichever packet gets here first. * data contains a chain of chains of mbufs (m_next down a chain, m_nextpkt * chaining chains together) where the chains are ordered by assembly * position. When two chains are contiguous for reassembly, they are * combined and the frag header disappears. * The structure is deliberately sized so MALLOC will round up on the order * of much less than the total size instead of doubling the size. */ struct ipv6_fragment { struct ipv6_fragment *next; /* Next fragment chain */ struct mbuf *prefix; /* Headers before frag header(s) */ struct mbuf *data; /* Frag headers + whatever data */ u_char ttl; /* Fragment chain TTL. */ u_char flags; /* Bit 0 indicates got end of chain */ }; /* * Structures and definitions for discovery mechanisms in IPv6. */ /* * Neighbor cache: * * Number of unanswered probes is in discq. * "Time of next event" will be in rt->rt_rmx.rmx_expire * (rmx_expire will actually be quite overloaded, actually.) * Status REACHABLE will be dq_unanswered < 0 * Status PROBE will be dq_unanswered >= 0 * Status INCOMPLETE will be link addr length of 0 if held, * or deleted if not held. * * If held, but INCOMPLETE fails set RTF_REJECT and make sure * IPv6 and HLP's know how to deal with RTF_REJECT being set. */ struct discq /* Similar to v4's llinfo_arp, discovery's "neighbor entry". */ { struct discq *dq_next,*dq_prev; /* For {ins,rem}que(). */ struct rtentry *dq_rt; /* Back pointer to routing entry for an address that may be dead. */ struct mbuf *dq_queue; /* Queue of outgoing messages. */ int dq_unanswered; /* Number of unanswered probes. */ }; #if !defined(_BSDI_VERSION) || (_BSDI_VERSION < 199802) /* Routing flag redefinitions */ #define RTF_ISAROUTER RTF_PROTO2 /* Neighbor is a router. */ #define RTF_DEFAULT RTF_PROTO1 /* Default route. */ #endif /* !defined(_BSDI_VERSION) || (_BSDI_VERSION < 199802) */ /* * These should be configurable parameters, see ipv6_discovery.c. * All units are in comments besides constants. */ #define MAX_INITIAL_RTR_ADVERT_INTERVAL 16 /* seconds */ #define MAX_INITIAL_RTR_ADVERTISEMENTS 3 /* transmissions */ #define MAX_RTR_RESPONSE_DELAY 2 /* seconds */ #define MAX_RTR_SOLICITATION_DELAY 1 /* second */ #define RTR_SOLICITATION_INTERVAL 3 /* seconds */ #define MAX_RTR_SOLICITATIONS 3 /* transmissions */ #define MAX_MULTICAST_SOLICIT 3 /* transmissions */ #define MAX_UNICAST_SOLICIT 3 /* transmissions */ #define MAX_ANYCAST_DELAY_TIME 1 /* seconds */ #define MAX_NEIGHBOR_ADVERTISEMENTS 3 /* transmissions */ #define MIN_NEIGHBOR_ADVERT_INTERVAL 16 /* seconds */ #define REACHABLE_TIME 30 /* seconds */ #define RETRANS_TIMER 3 /* seconds */ #define DELAY_FIRST_PROBE_TIME 3 /* seconds */ /* Need to somehow define random factors. */ #define NEXTHOP_CLEAN_INTERVAL 600 /* seconds */ #define REJECT_TIMER 20 /* seconds */ /* * Child of a router or tunnel. Is a "meta-entry" for garbage collection. */ struct v6child { struct v6child *v6c_next,*v6c_prev; /* For {ins,rem}que() */ struct v6router *v6c_parent; /* Parent router. I'm null if I'm the router, or a tunnel child. */ struct rtentry *v6c_route; /* Next-hop cache entry. I won't be holding it, but I'm attached to it, like discq is to neighbor cache entries. */ }; /* * Default router list entry. Should be inserted * in priority order. Will also have entries for non- * default routers, because I may be a router myself. */ struct v6router { struct v6router *v6r_next,*v6r_prev; /* For {ins,rem}que() */ struct rtentry *v6r_rt; /* Route for this. Could be neighbor, could be tunnel. */ struct v6child v6r_children; /* Children of this router. */ /* Metric information? */ uint32_t v6r_expire; /* Expiration time. */ }; #define V6R_SIN6(v6r) ((struct sockaddr_in6 *)rt_key((v6r)->v6r_rt)) /* * Flags for "flags" argument in ipv6_output(). */ #define IPV6_FORWARDING 0x1 /* Most of IPv6 header exists? */ #define IPV6_RAWOUTPUT 0x2 /* Raw IPv6 packet! */ #define IPV6_ROUTETOIF SO_DONTROUTE /* Include sys/socket.h... */ void ipv6_init __P((void)); void ipv6_drain __P((void)); void ipv6_slowtimo __P((void)); int ipv6_sysctl __P((int *, uint, void *, size_t *, void *, size_t)); struct route6; int ipv6_ctloutput __P((int, struct socket *,int,int, struct mbuf **)); int ripv6_ctloutput __P((int, struct socket *, int, int, struct mbuf **)); void ripv6_init __P((void)); void ripv6_input __P((struct mbuf *, ...)); int ripv6_output __P((struct mbuf *, struct socket *, struct in6_addr *, struct mbuf *)); int ripv6_usrreq_send(struct socket *, int, struct mbuf *, struct sockaddr *, struct mbuf *); int ripv6_usrreq __P((struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *)); void ipv6_input __P((struct mbuf *, ...)); int ipv6_output __P((struct mbuf *, ...)); #if 0 int ipv6_output __P((struct mbuf *, struct route6 *, int, struct ipv6_moptions *, struct ifnet *, struct socket *)); #endif void ipv6_reasm __P((struct mbuf *, int)); void ipv6_hop __P((struct mbuf *, int)); int in6_control __P((struct socket *,int, caddr_t, struct ifnet *,int)); void ipv6_stripoptions __P((struct mbuf *, int)); struct in6_multi *in6_addmulti __P((struct in6_addr *,struct ifnet *)); void in6_delmulti __P((struct in6_multi *)); extern int ipv6_icmp_send(struct socket *, int, struct mbuf *, struct sockaddr *, struct mbuf *, struct proc *); void *ipv6_trans_ctlinput __P((int, struct sockaddr *, void *)); /* These might belong in in_pcb.h */ struct inpcb; void ipv6_onlink_query(struct sockaddr_in6 *); int ipv6_verify_onlink(struct sockaddr_in6 *); struct inpcbtable; int in6_pcbnotify __P((struct inpcbtable *, struct sockaddr *, uint, struct in6_addr *, uint, int, void (*)(struct inpcb *, int))); void ipv6_freemoptions __P((struct ipv6_moptions *)); #endif /* _KERNEL */ #endif /* _NETINET6_IPV6_VAR_H */