Deleted Added
sdiff udiff text old ( 191341 ) new ( 191672 )
full compact
1/*-
2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 44 unchanged lines hidden (view full) ---

53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * @(#)in_var.h 8.1 (Berkeley) 6/10/93
61 * $FreeBSD: head/sys/netinet6/in6_var.h 191341 2009-04-20 22:56:34Z rwatson $
62 */
63
64#ifndef _NETINET6_IN6_VAR_H_
65#define _NETINET6_IN6_VAR_H_
66
67/*
68 * Interface address, Internet version. One of these structures
69 * is allocated for each interface with an Internet address.
70 * The ifaddr structure contains the protocol-independent part
71 * of the structure and is assumed to be first.
72 */
73
74/*

--- 9 unchanged lines hidden (view full) ---

84 time_t ia6t_preferred; /* preferred lifetime expiration time */
85 u_int32_t ia6t_vltime; /* valid lifetime */
86 u_int32_t ia6t_pltime; /* prefix lifetime */
87};
88
89struct nd_ifinfo;
90struct scope6_id;
91struct lltable;
92struct in6_ifextra {
93 struct in6_ifstat *in6_ifstat;
94 struct icmp6_ifstat *icmp6_ifstat;
95 struct nd_ifinfo *nd_ifinfo;
96 struct scope6_id *scope6_id;
97 struct lltable *lltable;
98};
99
100#define LLTABLE6(ifp) (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->lltable)
101
102struct in6_ifaddr {
103 struct ifaddr ia_ifa; /* protocol-independent info */
104#define ia_ifp ia_ifa.ifa_ifp
105#define ia_flags ia_ifa.ifa_flags

--- 378 unchanged lines hidden (view full) ---

484#define in6_ifstat_inc(ifp, tag) \
485do { \
486 if (ifp) \
487 ((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->in6_ifstat->tag++; \
488} while (/*CONSTCOND*/ 0)
489
490extern struct in6_addr zeroin6_addr;
491extern u_char inet6ctlerrmap[];
492#ifdef MALLOC_DECLARE
493MALLOC_DECLARE(M_IP6MADDR);
494#endif /* MALLOC_DECLARE */
495
496/*
497 * Macro for finding the internet address structure (in6_ifaddr) corresponding
498 * to a given interface (ifnet structure).
499 */
500
501#define IFP_TO_IA6(ifp, ia) \
502/* struct ifnet *ifp; */ \

--- 6 unchanged lines hidden (view full) ---

509 break; \
510 } \
511 (ia) = (struct in6_ifaddr *)ifa; \
512} while (/*CONSTCOND*/ 0)
513
514#endif /* _KERNEL */
515
516/*
517 * Multi-cast membership entry. One for each group/ifp that a PCB
518 * belongs to.
519 */
520struct in6_multi_mship {
521 struct in6_multi *i6mm_maddr; /* Multicast address pointer */
522 LIST_ENTRY(in6_multi_mship) i6mm_chain; /* multicast options chain */
523};
524
525struct in6_multi {
526 LIST_ENTRY(in6_multi) in6m_entry; /* list glue */
527 struct in6_addr in6m_addr; /* IP6 multicast address */
528 struct ifnet *in6m_ifp; /* back pointer to ifnet */
529 struct ifmultiaddr *in6m_ifma; /* back pointer to ifmultiaddr */
530 u_int in6m_refcount; /* # membership claims by sockets */
531 u_int in6m_state; /* state of the membership */
532 u_int in6m_timer; /* MLD6 listener report timer */
533 struct timeval in6m_timer_expire; /* when the timer expires */
534 struct callout *in6m_timer_ch;
535};
536
537#define IN6M_TIMER_UNDEF -1
538
539#ifdef _KERNEL
540/* flags to in6_update_ifa */
541#define IN6_IFAUPDATE_DADDELAY 0x1 /* first time to configure an address */
542
543extern LIST_HEAD(in6_multihead, in6_multi) in6_multihead;
544
545/*
546 * Structure used by macros below to remember position when stepping through
547 * all of the in6_multi records.
548 */
549struct in6_multistep {
550 struct in6_ifaddr *i_ia;
551 struct in6_multi *i_in6m;
552};
553
554/*
555 * Macros for looking up the in6_multi record for a given IP6 multicast
556 * address on a given interface. If no matching record is found, "in6m"
557 * returns NULL.
558 */
559
560#define IN6_LOOKUP_MULTI(addr, ifp, in6m) \
561/* struct in6_addr addr; */ \
562/* struct ifnet *ifp; */ \
563/* struct in6_multi *in6m; */ \
564do { \
565 struct ifmultiaddr *ifma; \
566 IF_ADDR_LOCK(ifp); \
567 TAILQ_FOREACH(ifma, &(ifp)->if_multiaddrs, ifma_link) { \
568 if (ifma->ifma_addr->sa_family == AF_INET6 \
569 && IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifma->ifma_addr)->sin6_addr, \
570 &(addr))) \
571 break; \
572 } \
573 (in6m) = (struct in6_multi *)(ifma ? ifma->ifma_protospec : 0); \
574 IF_ADDR_UNLOCK(ifp); \
575} while(0)
576
577/*
578 * Macro to step through all of the in6_multi records, one at a time.
579 * The current position is remembered in "step", which the caller must
580 * provide. IN6_FIRST_MULTI(), below, must be called to initialize "step"
581 * and get the first record. Both macros return a NULL "in6m" when there
582 * are no remaining records.
583 */
584#define IN6_NEXT_MULTI(step, in6m) \
585/* struct in6_multistep step; */ \
586/* struct in6_multi *in6m; */ \
587do { \
588 if (((in6m) = (step).i_in6m) != NULL) \
589 (step).i_in6m = LIST_NEXT((step).i_in6m, in6m_entry); \
590} while(0)
591
592#define IN6_FIRST_MULTI(step, in6m) \
593/* struct in6_multistep step; */ \
594/* struct in6_multi *in6m */ \
595do { \
596 (step).i_in6m = LIST_FIRST(&in6_multihead); \
597 IN6_NEXT_MULTI((step), (in6m)); \
598} while(0)
599
600struct in6_multi *in6_addmulti __P((struct in6_addr *, struct ifnet *,
601 int *, int));
602void in6_delmulti __P((struct in6_multi *));
603struct in6_multi_mship *in6_joingroup(struct ifnet *, struct in6_addr *, int *, int);
604int in6_leavegroup(struct in6_multi_mship *);
605int in6_mask2len __P((struct in6_addr *, u_char *));
606int in6_control __P((struct socket *, u_long, caddr_t, struct ifnet *,
607 struct thread *));
608int in6_update_ifa __P((struct ifnet *, struct in6_aliasreq *,
609 struct in6_ifaddr *, int));
610void in6_purgeaddr __P((struct ifaddr *));
611int in6if_do_dad __P((struct ifnet *));
612void in6_purgeif __P((struct ifnet *));
613void in6_savemkludge __P((struct in6_ifaddr *));
614void *in6_domifattach __P((struct ifnet *));
615void in6_domifdetach __P((struct ifnet *, void *));
616void in6_setmaxmtu __P((void));
617int in6_if2idlen __P((struct ifnet *));
618void in6_restoremkludge __P((struct in6_ifaddr *, struct ifnet *));
619void in6_purgemkludge __P((struct ifnet *));
620struct in6_ifaddr *in6ifa_ifpforlinklocal __P((struct ifnet *, int));
621struct in6_ifaddr *in6ifa_ifpwithaddr __P((struct ifnet *, struct in6_addr *));
622char *ip6_sprintf __P((char *, const struct in6_addr *));
623int in6_addr2zoneid __P((struct ifnet *, struct in6_addr *, u_int32_t *));
624int in6_matchlen __P((struct in6_addr *, struct in6_addr *));
625int in6_are_prefix_equal __P((struct in6_addr *, struct in6_addr *, int));
626void in6_prefixlen2mask __P((struct in6_addr *, int));
627int in6_prefix_ioctl __P((struct socket *, u_long, caddr_t,

--- 13 unchanged lines hidden ---