Deleted Added
full compact
in6.c (231852) in6.c (232054)
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>
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 231852 2012-02-17 02:39:58Z bz $");
64__FBSDID("$FreeBSD: head/sys/netinet6/in6.c 232054 2012-02-23 18:21:37Z kmacy $");
65
66#include "opt_compat.h"
67#include "opt_inet.h"
68#include "opt_inet6.h"
69
70#include <sys/param.h>
71#include <sys/errno.h>
72#include <sys/jail.h>

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

2434
2435#include <sys/sysctl.h>
2436
2437struct in6_llentry {
2438 struct llentry base;
2439 struct sockaddr_in6 l3_addr6;
2440};
2441
65
66#include "opt_compat.h"
67#include "opt_inet.h"
68#include "opt_inet6.h"
69
70#include <sys/param.h>
71#include <sys/errno.h>
72#include <sys/jail.h>

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

2434
2435#include <sys/sysctl.h>
2436
2437struct in6_llentry {
2438 struct llentry base;
2439 struct sockaddr_in6 l3_addr6;
2440};
2441
2442/*
2443 * Deletes an address from the address table.
2444 * This function is called by the timer functions
2445 * such as arptimer() and nd6_llinfo_timer(), and
2446 * the caller does the locking.
2447 */
2448static void
2449in6_lltable_free(struct lltable *llt, struct llentry *lle)
2450{
2451 LLE_WUNLOCK(lle);
2452 LLE_LOCK_DESTROY(lle);
2453 free(lle, M_LLTABLE);
2454}
2455
2442static struct llentry *
2443in6_lltable_new(const struct sockaddr *l3addr, u_int flags)
2444{
2445 struct in6_llentry *lle;
2446
2447 lle = malloc(sizeof(struct in6_llentry), M_LLTABLE,
2448 M_DONTWAIT | M_ZERO);
2449 if (lle == NULL) /* NB: caller generates msg */
2450 return NULL;
2451
2452 lle->l3_addr6 = *(const struct sockaddr_in6 *)l3addr;
2453 lle->base.lle_refcnt = 1;
2456static struct llentry *
2457in6_lltable_new(const struct sockaddr *l3addr, u_int flags)
2458{
2459 struct in6_llentry *lle;
2460
2461 lle = malloc(sizeof(struct in6_llentry), M_LLTABLE,
2462 M_DONTWAIT | M_ZERO);
2463 if (lle == NULL) /* NB: caller generates msg */
2464 return NULL;
2465
2466 lle->l3_addr6 = *(const struct sockaddr_in6 *)l3addr;
2467 lle->base.lle_refcnt = 1;
2468 lle->base.lle_free = in6_lltable_free;
2454 LLE_LOCK_INIT(&lle->base);
2455 callout_init_rw(&lle->base.ln_timer_ch, &lle->base.lle_lock,
2456 CALLOUT_RETURNUNLOCKED);
2457
2458 return &lle->base;
2459}
2460
2469 LLE_LOCK_INIT(&lle->base);
2470 callout_init_rw(&lle->base.ln_timer_ch, &lle->base.lle_lock,
2471 CALLOUT_RETURNUNLOCKED);
2472
2473 return &lle->base;
2474}
2475
2461/*
2462 * Deletes an address from the address table.
2463 * This function is called by the timer functions
2464 * such as arptimer() and nd6_llinfo_timer(), and
2465 * the caller does the locking.
2466 */
2467static void
2476static void
2468in6_lltable_free(struct lltable *llt, struct llentry *lle)
2469{
2470 LLE_WUNLOCK(lle);
2471 LLE_LOCK_DESTROY(lle);
2472 free(lle, M_LLTABLE);
2473}
2474
2475static void
2476in6_lltable_prefix_free(struct lltable *llt,
2477 const struct sockaddr *prefix,
2478 const struct sockaddr *mask,
2479 u_int flags)
2480{
2481 const struct sockaddr_in6 *pfx = (const struct sockaddr_in6 *)prefix;
2482 const struct sockaddr_in6 *msk = (const struct sockaddr_in6 *)mask;
2483 struct llentry *lle, *next;

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

2708 (struct icmp6_ifstat *)malloc(sizeof(struct icmp6_ifstat),
2709 M_IFADDR, M_WAITOK);
2710 bzero(ext->icmp6_ifstat, sizeof(*ext->icmp6_ifstat));
2711
2712 ext->nd_ifinfo = nd6_ifattach(ifp);
2713 ext->scope6_id = scope6_ifattach(ifp);
2714 ext->lltable = lltable_init(ifp, AF_INET6);
2715 if (ext->lltable != NULL) {
2477in6_lltable_prefix_free(struct lltable *llt,
2478 const struct sockaddr *prefix,
2479 const struct sockaddr *mask,
2480 u_int flags)
2481{
2482 const struct sockaddr_in6 *pfx = (const struct sockaddr_in6 *)prefix;
2483 const struct sockaddr_in6 *msk = (const struct sockaddr_in6 *)mask;
2484 struct llentry *lle, *next;

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

2709 (struct icmp6_ifstat *)malloc(sizeof(struct icmp6_ifstat),
2710 M_IFADDR, M_WAITOK);
2711 bzero(ext->icmp6_ifstat, sizeof(*ext->icmp6_ifstat));
2712
2713 ext->nd_ifinfo = nd6_ifattach(ifp);
2714 ext->scope6_id = scope6_ifattach(ifp);
2715 ext->lltable = lltable_init(ifp, AF_INET6);
2716 if (ext->lltable != NULL) {
2716 ext->lltable->llt_free = in6_lltable_free;
2717 ext->lltable->llt_prefix_free = in6_lltable_prefix_free;
2718 ext->lltable->llt_lookup = in6_lltable_lookup;
2719 ext->lltable->llt_dump = in6_lltable_dump;
2720 }
2721
2722 ext->mld_ifinfo = mld_domifattach(ifp);
2723
2724 return ext;

--- 75 unchanged lines hidden ---
2717 ext->lltable->llt_prefix_free = in6_lltable_prefix_free;
2718 ext->lltable->llt_lookup = in6_lltable_lookup;
2719 ext->lltable->llt_dump = in6_lltable_dump;
2720 }
2721
2722 ext->mld_ifinfo = mld_domifattach(ifp);
2723
2724 return ext;

--- 75 unchanged lines hidden ---