in_var.h (2144431c11529d1107f4440a5fe57559fb20002c) | in_var.h (c8ee75f2315e8267ad814dc5b4645ef205f0e0e1) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1985, 1986, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 65 unchanged lines hidden (view full) --- 74 */ 75struct in_ifaddr { 76 struct ifaddr ia_ifa; /* protocol-independent info */ 77#define ia_ifp ia_ifa.ifa_ifp 78#define ia_flags ia_ifa.ifa_flags 79 /* ia_subnet{,mask} in host order */ 80 u_long ia_subnet; /* subnet address */ 81 u_long ia_subnetmask; /* mask of subnet */ | 1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1985, 1986, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 65 unchanged lines hidden (view full) --- 74 */ 75struct in_ifaddr { 76 struct ifaddr ia_ifa; /* protocol-independent info */ 77#define ia_ifp ia_ifa.ifa_ifp 78#define ia_flags ia_ifa.ifa_flags 79 /* ia_subnet{,mask} in host order */ 80 u_long ia_subnet; /* subnet address */ 81 u_long ia_subnetmask; /* mask of subnet */ |
82 LIST_ENTRY(in_ifaddr) ia_hash; /* entry in bucket of inet addresses */ | 82 CK_LIST_ENTRY(in_ifaddr) ia_hash; /* hash of internet addresses */ |
83 CK_STAILQ_ENTRY(in_ifaddr) ia_link; /* list of internet addresses */ 84 struct sockaddr_in ia_addr; /* reserve space for interface name */ 85 struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ 86#define ia_broadaddr ia_dstaddr 87 struct sockaddr_in ia_sockmask; /* reserve space for general netmask */ 88 struct callout ia_garp_timer; /* timer for retransmitting GARPs */ 89 int ia_garp_count; /* count of retransmitted GARPs */ 90}; --- 12 unchanged lines hidden (view full) --- 103extern u_char inetctlerrmap[]; 104 105#define LLTABLE(ifp) \ 106 ((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt 107/* 108 * Hash table for IP addresses. 109 */ 110CK_STAILQ_HEAD(in_ifaddrhead, in_ifaddr); | 83 CK_STAILQ_ENTRY(in_ifaddr) ia_link; /* list of internet addresses */ 84 struct sockaddr_in ia_addr; /* reserve space for interface name */ 85 struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ 86#define ia_broadaddr ia_dstaddr 87 struct sockaddr_in ia_sockmask; /* reserve space for general netmask */ 88 struct callout ia_garp_timer; /* timer for retransmitting GARPs */ 89 int ia_garp_count; /* count of retransmitted GARPs */ 90}; --- 12 unchanged lines hidden (view full) --- 103extern u_char inetctlerrmap[]; 104 105#define LLTABLE(ifp) \ 106 ((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt 107/* 108 * Hash table for IP addresses. 109 */ 110CK_STAILQ_HEAD(in_ifaddrhead, in_ifaddr); |
111LIST_HEAD(in_ifaddrhashhead, in_ifaddr); | 111CK_LIST_HEAD(in_ifaddrhashhead, in_ifaddr); |
112 113VNET_DECLARE(struct in_ifaddrhashhead *, in_ifaddrhashtbl); 114VNET_DECLARE(struct in_ifaddrhead, in_ifaddrhead); 115VNET_DECLARE(u_long, in_ifaddrhmask); /* mask for hash table */ 116 117#define V_in_ifaddrhashtbl VNET(in_ifaddrhashtbl) 118#define V_in_ifaddrhead VNET(in_ifaddrhead) 119#define V_in_ifaddrhmask VNET(in_ifaddrhmask) 120 121#define INADDR_NHASH_LOG2 9 122#define INADDR_NHASH (1 << INADDR_NHASH_LOG2) 123#define INADDR_HASHVAL(x) fnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT) 124#define INADDR_HASH(x) \ 125 (&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask]) 126 | 112 113VNET_DECLARE(struct in_ifaddrhashhead *, in_ifaddrhashtbl); 114VNET_DECLARE(struct in_ifaddrhead, in_ifaddrhead); 115VNET_DECLARE(u_long, in_ifaddrhmask); /* mask for hash table */ 116 117#define V_in_ifaddrhashtbl VNET(in_ifaddrhashtbl) 118#define V_in_ifaddrhead VNET(in_ifaddrhead) 119#define V_in_ifaddrhmask VNET(in_ifaddrhmask) 120 121#define INADDR_NHASH_LOG2 9 122#define INADDR_NHASH (1 << INADDR_NHASH_LOG2) 123#define INADDR_HASHVAL(x) fnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT) 124#define INADDR_HASH(x) \ 125 (&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask]) 126 |
127extern struct rmlock in_ifaddr_lock; 128 129#define IN_IFADDR_LOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_LOCKED) 130#define IN_IFADDR_RLOCK(t) rm_rlock(&in_ifaddr_lock, (t)) 131#define IN_IFADDR_RLOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_RLOCKED) 132#define IN_IFADDR_RUNLOCK(t) rm_runlock(&in_ifaddr_lock, (t)) 133#define IN_IFADDR_WLOCK() rm_wlock(&in_ifaddr_lock) 134#define IN_IFADDR_WLOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_WLOCKED) 135#define IN_IFADDR_WUNLOCK() rm_wunlock(&in_ifaddr_lock) 136 | |
137/* 138 * Macro for finding the internet address structure (in_ifaddr) 139 * corresponding to one of our IP addresses (in_addr). 140 */ 141#define INADDR_TO_IFADDR(addr, ia) \ 142 /* struct in_addr addr; */ \ 143 /* struct in_ifaddr *ia; */ \ | 127/* 128 * Macro for finding the internet address structure (in_ifaddr) 129 * corresponding to one of our IP addresses (in_addr). 130 */ 131#define INADDR_TO_IFADDR(addr, ia) \ 132 /* struct in_addr addr; */ \ 133 /* struct in_ifaddr *ia; */ \ |
144do { \ 145\ 146 LIST_FOREACH(ia, INADDR_HASH((addr).s_addr), ia_hash) \ 147 if (IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \ 148 break; \ | 134do { \ 135 NET_EPOCH_ASSERT(); \ 136 CK_LIST_FOREACH(ia, INADDR_HASH((addr).s_addr), ia_hash) \ 137 if (IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \ 138 break; \ |
149} while (0) 150 151/* 152 * Macro for finding the interface (ifnet structure) corresponding to one 153 * of our IP addresses. 154 */ 155#define INADDR_TO_IFP(addr, ifp) \ 156 /* struct in_addr addr; */ \ --- 323 unchanged lines hidden --- | 139} while (0) 140 141/* 142 * Macro for finding the interface (ifnet structure) corresponding to one 143 * of our IP addresses. 144 */ 145#define INADDR_TO_IFP(addr, ifp) \ 146 /* struct in_addr addr; */ \ --- 323 unchanged lines hidden --- |