Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/in_var.h
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
struct in_ifaddr { | struct in_ifaddr { | ||||
struct ifaddr ia_ifa; /* protocol-independent info */ | struct ifaddr ia_ifa; /* protocol-independent info */ | ||||
#define ia_ifp ia_ifa.ifa_ifp | #define ia_ifp ia_ifa.ifa_ifp | ||||
#define ia_flags ia_ifa.ifa_flags | #define ia_flags ia_ifa.ifa_flags | ||||
/* ia_subnet{,mask} in host order */ | /* ia_subnet{,mask} in host order */ | ||||
u_long ia_subnet; /* subnet address */ | u_long ia_subnet; /* subnet address */ | ||||
u_long ia_subnetmask; /* mask of subnet */ | u_long ia_subnetmask; /* mask of subnet */ | ||||
LIST_ENTRY(in_ifaddr) ia_hash; /* entry in bucket of inet addresses */ | CK_LIST_ENTRY(in_ifaddr) ia_hash; /* hash of internet addresses */ | ||||
CK_STAILQ_ENTRY(in_ifaddr) ia_link; /* list of internet addresses */ | CK_STAILQ_ENTRY(in_ifaddr) ia_link; /* list of internet addresses */ | ||||
struct sockaddr_in ia_addr; /* reserve space for interface name */ | struct sockaddr_in ia_addr; /* reserve space for interface name */ | ||||
struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ | struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ | ||||
#define ia_broadaddr ia_dstaddr | #define ia_broadaddr ia_dstaddr | ||||
struct sockaddr_in ia_sockmask; /* reserve space for general netmask */ | struct sockaddr_in ia_sockmask; /* reserve space for general netmask */ | ||||
struct callout ia_garp_timer; /* timer for retransmitting GARPs */ | struct callout ia_garp_timer; /* timer for retransmitting GARPs */ | ||||
int ia_garp_count; /* count of retransmitted GARPs */ | int ia_garp_count; /* count of retransmitted GARPs */ | ||||
}; | }; | ||||
Show All 12 Lines | |||||
extern u_char inetctlerrmap[]; | extern u_char inetctlerrmap[]; | ||||
#define LLTABLE(ifp) \ | #define LLTABLE(ifp) \ | ||||
((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt | ((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt | ||||
/* | /* | ||||
* Hash table for IP addresses. | * Hash table for IP addresses. | ||||
*/ | */ | ||||
CK_STAILQ_HEAD(in_ifaddrhead, in_ifaddr); | CK_STAILQ_HEAD(in_ifaddrhead, in_ifaddr); | ||||
LIST_HEAD(in_ifaddrhashhead, in_ifaddr); | CK_LIST_HEAD(in_ifaddrhashhead, in_ifaddr); | ||||
VNET_DECLARE(struct in_ifaddrhashhead *, in_ifaddrhashtbl); | VNET_DECLARE(struct in_ifaddrhashhead *, in_ifaddrhashtbl); | ||||
VNET_DECLARE(struct in_ifaddrhead, in_ifaddrhead); | VNET_DECLARE(struct in_ifaddrhead, in_ifaddrhead); | ||||
VNET_DECLARE(u_long, in_ifaddrhmask); /* mask for hash table */ | VNET_DECLARE(u_long, in_ifaddrhmask); /* mask for hash table */ | ||||
#define V_in_ifaddrhashtbl VNET(in_ifaddrhashtbl) | #define V_in_ifaddrhashtbl VNET(in_ifaddrhashtbl) | ||||
#define V_in_ifaddrhead VNET(in_ifaddrhead) | #define V_in_ifaddrhead VNET(in_ifaddrhead) | ||||
#define V_in_ifaddrhmask VNET(in_ifaddrhmask) | #define V_in_ifaddrhmask VNET(in_ifaddrhmask) | ||||
#define INADDR_NHASH_LOG2 9 | #define INADDR_NHASH_LOG2 9 | ||||
#define INADDR_NHASH (1 << INADDR_NHASH_LOG2) | #define INADDR_NHASH (1 << INADDR_NHASH_LOG2) | ||||
#define INADDR_HASHVAL(x) fnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT) | #define INADDR_HASHVAL(x) fnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT) | ||||
#define INADDR_HASH(x) \ | #define INADDR_HASH(x) \ | ||||
(&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask]) | (&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask]) | ||||
extern struct rmlock in_ifaddr_lock; | |||||
#define IN_IFADDR_LOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_LOCKED) | |||||
#define IN_IFADDR_RLOCK(t) rm_rlock(&in_ifaddr_lock, (t)) | |||||
#define IN_IFADDR_RLOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_RLOCKED) | |||||
#define IN_IFADDR_RUNLOCK(t) rm_runlock(&in_ifaddr_lock, (t)) | |||||
#define IN_IFADDR_WLOCK() rm_wlock(&in_ifaddr_lock) | |||||
#define IN_IFADDR_WLOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_WLOCKED) | |||||
#define IN_IFADDR_WUNLOCK() rm_wunlock(&in_ifaddr_lock) | |||||
/* | /* | ||||
* Macro for finding the internet address structure (in_ifaddr) | * Macro for finding the internet address structure (in_ifaddr) | ||||
* corresponding to one of our IP addresses (in_addr). | * corresponding to one of our IP addresses (in_addr). | ||||
*/ | */ | ||||
#define INADDR_TO_IFADDR(addr, ia) \ | #define INADDR_TO_IFADDR(addr, ia) \ | ||||
/* struct in_addr addr; */ \ | /* struct in_addr addr; */ \ | ||||
/* struct in_ifaddr *ia; */ \ | /* struct in_ifaddr *ia; */ \ | ||||
do { \ | do { \ | ||||
\ | NET_EPOCH_ASSERT(); \ | ||||
LIST_FOREACH(ia, INADDR_HASH((addr).s_addr), ia_hash) \ | CK_LIST_FOREACH(ia, INADDR_HASH((addr).s_addr), ia_hash) \ | ||||
if (IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \ | if (IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \ | ||||
break; \ | break; \ | ||||
} while (0) | } while (0) | ||||
/* | /* | ||||
* Macro for finding the interface (ifnet structure) corresponding to one | * Macro for finding the interface (ifnet structure) corresponding to one | ||||
* of our IP addresses. | * of our IP addresses. | ||||
*/ | */ | ||||
#define INADDR_TO_IFP(addr, ifp) \ | #define INADDR_TO_IFP(addr, ifp) \ | ||||
/* struct in_addr addr; */ \ | /* struct in_addr addr; */ \ | ||||
▲ Show 20 Lines • Show All 323 Lines • Show Last 20 Lines |