scope6.c (243235) | scope6.c (243903) |
---|---|
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 243235 2012-11-18 16:06:51Z hrs $"); | 33__FBSDID("$FreeBSD: head/sys/netinet6/scope6.c 243903 2012-12-05 19:45:24Z hrs $"); |
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> | 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/sysctl.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 | 42#include <sys/syslog.h> 43 44#include <net/if.h> 45#include <net/vnet.h> 46 47#include <netinet/in.h> 48 49#include <netinet/ip6.h> 50#include <netinet6/in6_var.h> 51#include <netinet6/ip6_var.h> 52#include <netinet6/scope6_var.h> 53 54#ifdef ENABLE_DEFAULT_SCOPE 55VNET_DEFINE(int, ip6_use_defzone) = 1; 56#else 57VNET_DEFINE(int, ip6_use_defzone) = 0; 58#endif |
59VNET_DEFINE(int, deembed_scopeid) = 1; 60SYSCTL_DECL(_net_inet6_ip6); 61SYSCTL_VNET_INT(_net_inet6_ip6, OID_AUTO, deembed_scopeid, CTLFLAG_RW, 62 &VNET_NAME(deembed_scopeid), 0, 63 "Extract embedded zone ID and set it to sin6_scope_id in sockaddr_in6."); |
|
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) --- 308 unchanged lines hidden (view full) --- 374 /* 375 * KAME assumption: link id == interface id 376 */ 377 zoneid = ntohs(sin6->sin6_addr.s6_addr16[1]); 378 if (zoneid) { 379 /* sanity check */ 380 if (V_if_index < zoneid) 381 return (ENXIO); | 64 65/* 66 * The scope6_lock protects the global sid default stored in 67 * sid_default below. 68 */ 69static struct mtx scope6_lock; 70#define SCOPE6_LOCK_INIT() mtx_init(&scope6_lock, "scope6_lock", NULL, MTX_DEF) 71#define SCOPE6_LOCK() mtx_lock(&scope6_lock) --- 308 unchanged lines hidden (view full) --- 380 /* 381 * KAME assumption: link id == interface id 382 */ 383 zoneid = ntohs(sin6->sin6_addr.s6_addr16[1]); 384 if (zoneid) { 385 /* sanity check */ 386 if (V_if_index < zoneid) 387 return (ENXIO); |
388#if 0 389 /* XXX: Disabled due to possible deadlock. */ |
|
382 if (!ifnet_byindex(zoneid)) 383 return (ENXIO); | 390 if (!ifnet_byindex(zoneid)) 391 return (ENXIO); |
392#endif |
|
384 if (sin6->sin6_scope_id != 0 && 385 zoneid != sin6->sin6_scope_id) { 386 log(LOG_NOTICE, 387 "%s: embedded scope mismatch: %s%%%d. " 388 "sin6_scope_id was overridden.", __func__, 389 ip6_sprintf(ip6buf, &sin6->sin6_addr), 390 sin6->sin6_scope_id); 391 } --- 112 unchanged lines hidden --- | 393 if (sin6->sin6_scope_id != 0 && 394 zoneid != sin6->sin6_scope_id) { 395 log(LOG_NOTICE, 396 "%s: embedded scope mismatch: %s%%%d. " 397 "sin6_scope_id was overridden.", __func__, 398 ip6_sprintf(ip6buf, &sin6->sin6_addr), 399 sin6->sin6_scope_id); 400 } --- 112 unchanged lines hidden --- |