scope6.c (196019) | scope6.c (207369) |
---|---|
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> | 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 196019 2009-08-01 19:26:27Z rwatson $"); | 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 | 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 |
|
53 54/* 55 * The scope6_lock protects the global sid default stored in 56 * sid_default below. 57 */ 58static struct mtx scope6_lock; 59#define SCOPE6_LOCK_INIT() mtx_init(&scope6_lock, "scope6_lock", NULL, MTX_DEF) 60#define SCOPE6_LOCK() mtx_lock(&scope6_lock) 61#define SCOPE6_UNLOCK() mtx_unlock(&scope6_lock) 62#define SCOPE6_LOCK_ASSERT() mtx_assert(&scope6_lock, MA_OWNED) 63 64static VNET_DEFINE(struct scope6_id, sid_default); | 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); |
65VNET_DEFINE(int, ip6_use_defzone); 66 | |
67#define V_sid_default VNET(sid_default) 68 69#define SID(ifp) \ 70 (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->scope6_id) 71 72void 73scope6_init(void) 74{ 75 | 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 |
76#ifdef ENABLE_DEFAULT_SCOPE 77 V_ip6_use_defzone = 1; 78#else 79 V_ip6_use_defzone = 0; 80#endif | |
81 bzero(&V_sid_default, sizeof(V_sid_default)); 82 83 if (!IS_DEFAULT_VNET(curvnet)) 84 return; 85 86 SCOPE6_LOCK_INIT(); 87} 88 --- 410 unchanged lines hidden --- | 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 --- |