Deleted Added
sdiff udiff text old ( 191340 ) 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

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

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.c 8.2 (Berkeley) 11/15/93
61 */
62
63#include <sys/cdefs.h>
64__FBSDID("$FreeBSD: head/sys/netinet6/in6.c 191672 2009-04-29 19:19:13Z bms $");
65
66#include "opt_inet.h"
67#include "opt_inet6.h"
68#include "opt_route.h"
69
70#include <sys/param.h>
71#include <sys/errno.h>
72#include <sys/jail.h>

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

101#include <netinet6/nd6.h>
102#include <netinet6/mld6_var.h>
103#include <netinet6/ip6_mroute.h>
104#include <netinet6/in6_ifattach.h>
105#include <netinet6/scope6_var.h>
106#include <netinet6/in6_pcb.h>
107#include <netinet6/vinet6.h>
108
109/*
110 * Definitions of some costant IP6 addresses.
111 */
112const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
113const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
114const struct in6_addr in6addr_nodelocal_allnodes =
115 IN6ADDR_NODELOCAL_ALLNODES_INIT;
116const struct in6_addr in6addr_linklocal_allnodes =
117 IN6ADDR_LINKLOCAL_ALLNODES_INIT;
118const struct in6_addr in6addr_linklocal_allrouters =
119 IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;
120const struct in6_addr in6addr_linklocal_allv2routers =
121 IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT;
122
123const struct in6_addr in6mask0 = IN6MASK0;
124const struct in6_addr in6mask32 = IN6MASK32;
125const struct in6_addr in6mask64 = IN6MASK64;
126const struct in6_addr in6mask96 = IN6MASK96;
127const struct in6_addr in6mask128 = IN6MASK128;
128
129const struct sockaddr_in6 sa6_any =
130 { sizeof(sa6_any), AF_INET6, 0, 0, IN6ADDR_ANY_INIT, 0 };
131
132static int in6_lifaddr_ioctl __P((struct socket *, u_long, caddr_t,
133 struct ifnet *, struct thread *));
134static int in6_ifinit __P((struct ifnet *, struct in6_ifaddr *,
135 struct sockaddr_in6 *, int));
136static void in6_unlink_ifa(struct in6_ifaddr *, struct ifnet *);
137
138int (*faithprefix_p)(struct in6_addr *);
139
140
141
142int
143in6_mask2len(struct in6_addr *mask, u_char *lim0)
144{
145 int x = 0, y;

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

1104 if ((flags & IN6_IFAUPDATE_DADDELAY)) {
1105 /*
1106 * We need to impose a delay before sending an NS
1107 * for DAD. Check if we also needed a delay for the
1108 * corresponding MLD message. If we did, the delay
1109 * should be larger than the MLD delay (this could be
1110 * relaxed a bit, but this simple logic is at least
1111 * safe).
1112 * XXX: Break data hiding guidelines and look at
1113 * state for the solicited multicast group.
1114 */
1115 mindelay = 0;
1116 if (in6m_sol != NULL &&
1117 in6m_sol->in6m_state == MLD_REPORTING_MEMBER) {
1118 mindelay = in6m_sol->in6m_timer;
1119 }
1120 maxdelay = MAX_RTR_SOLICITATION_DELAY * hz;
1121 if (maxdelay - mindelay == 0)
1122 delay = 0;
1123 else {
1124 delay =
1125 (arc4random() % (maxdelay - mindelay)) +

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

1586 ln->ln_state = ND6_LLINFO_REACHABLE;
1587 LLE_WUNLOCK(ln);
1588 }
1589 }
1590
1591 return (error);
1592}
1593
1594/*
1595 * Find an IPv6 interface link-local address specific to an interface.
1596 */
1597struct in6_ifaddr *
1598in6ifa_ifpforlinklocal(struct ifnet *ifp, int ignoreflags)
1599{
1600 struct ifaddr *ifa;
1601

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

2294 ext->lltable = lltable_init(ifp, AF_INET6);
2295 if (ext->lltable != NULL) {
2296 ext->lltable->llt_new = in6_lltable_new;
2297 ext->lltable->llt_free = in6_lltable_free;
2298 ext->lltable->llt_rtcheck = in6_lltable_rtcheck;
2299 ext->lltable->llt_lookup = in6_lltable_lookup;
2300 ext->lltable->llt_dump = in6_lltable_dump;
2301 }
2302
2303 ext->mld_ifinfo = mld_domifattach(ifp);
2304
2305 return ext;
2306}
2307
2308void
2309in6_domifdetach(struct ifnet *ifp, void *aux)
2310{
2311 struct in6_ifextra *ext = (struct in6_ifextra *)aux;
2312
2313 mld_domifdetach(ifp);
2314 scope6_ifdetach(ext->scope6_id);
2315 nd6_ifdetach(ext->nd_ifinfo);
2316 lltable_free(ext->lltable);
2317 free(ext->in6_ifstat, M_IFADDR);
2318 free(ext->icmp6_ifstat, M_IFADDR);
2319 free(ext, M_IFADDR);
2320}
2321

--- 59 unchanged lines hidden ---