Deleted Added
sdiff udiff text old ( 196019 ) new ( 207369 )
full compact
1/*-
2 * Copyright (C) 2000 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

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $KAME: scope6.c,v 1.10 2000/07/24 13:29:31 itojun Exp $
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/netinet6/scope6.c 207369 2010-04-29 11:52:42Z bz $");
34
35#include <sys/param.h>
36#include <sys/malloc.h>
37#include <sys/mbuf.h>
38#include <sys/socket.h>
39#include <sys/systm.h>
40#include <sys/queue.h>
41#include <sys/syslog.h>
42
43#include <net/if.h>
44#include <net/vnet.h>
45
46#include <netinet/in.h>
47
48#include <netinet/ip6.h>
49#include <netinet6/in6_var.h>
50#include <netinet6/ip6_var.h>
51#include <netinet6/scope6_var.h>
52
53#ifdef ENABLE_DEFAULT_SCOPE
54VNET_DEFINE(int, ip6_use_defzone) = 1;
55#else
56VNET_DEFINE(int, ip6_use_defzone) = 0;
57#endif
58
59/*
60 * The scope6_lock protects the global sid default stored in
61 * sid_default below.
62 */
63static struct mtx scope6_lock;
64#define SCOPE6_LOCK_INIT() mtx_init(&scope6_lock, "scope6_lock", NULL, MTX_DEF)
65#define SCOPE6_LOCK() mtx_lock(&scope6_lock)
66#define SCOPE6_UNLOCK() mtx_unlock(&scope6_lock)
67#define SCOPE6_LOCK_ASSERT() mtx_assert(&scope6_lock, MA_OWNED)
68
69static VNET_DEFINE(struct scope6_id, sid_default);
70#define V_sid_default VNET(sid_default)
71
72#define SID(ifp) \
73 (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->scope6_id)
74
75void
76scope6_init(void)
77{
78
79 bzero(&V_sid_default, sizeof(V_sid_default));
80
81 if (!IS_DEFAULT_VNET(curvnet))
82 return;
83
84 SCOPE6_LOCK_INIT();
85}
86

--- 410 unchanged lines hidden ---