Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/in_pcb.h
Context not available. | |||||
struct in_addr ia46_addr4; | struct in_addr ia46_addr4; | ||||
}; | }; | ||||
union in_dependaddr { | |||||
struct in_addr_4in6 id46_addr; | |||||
struct in6_addr id6_addr; | |||||
}; | |||||
/* | /* | ||||
* NOTE: ipv6 addrs should be 64-bit aligned, per RFC 2553. in_conninfo has | * NOTE: ipv6 addrs should be 64-bit aligned, per RFC 2553. in_conninfo has | ||||
* some extra padding to accomplish this. | * some extra padding to accomplish this. | ||||
Context not available. | |||||
u_int16_t ie_fport; /* foreign port */ | u_int16_t ie_fport; /* foreign port */ | ||||
u_int16_t ie_lport; /* local port */ | u_int16_t ie_lport; /* local port */ | ||||
/* protocol dependent part, local and foreign addr */ | /* protocol dependent part, local and foreign addr */ | ||||
union { | union in_dependaddr ie_dependfaddr; /* foreign host table entry */ | ||||
/* foreign host table entry */ | union in_dependaddr ie_dependladdr; /* local host table entry */ | ||||
struct in_addr_4in6 ie46_foreign; | #define ie_faddr ie_dependfaddr.id46_addr.ia46_addr4 | ||||
struct in6_addr ie6_foreign; | #define ie_laddr ie_dependladdr.id46_addr.ia46_addr4 | ||||
} ie_dependfaddr; | #define ie6_faddr ie_dependfaddr.id6_addr | ||||
union { | #define ie6_laddr ie_dependladdr.id6_addr | ||||
/* local host table entry */ | |||||
struct in_addr_4in6 ie46_local; | |||||
struct in6_addr ie6_local; | |||||
} ie_dependladdr; | |||||
u_int32_t ie6_zoneid; /* scope zone id */ | u_int32_t ie6_zoneid; /* scope zone id */ | ||||
}; | }; | ||||
#define ie_faddr ie_dependfaddr.ie46_foreign.ia46_addr4 | |||||
#define ie_laddr ie_dependladdr.ie46_local.ia46_addr4 | |||||
#define ie6_faddr ie_dependfaddr.ie6_foreign | |||||
#define ie6_laddr ie_dependladdr.ie6_local | |||||
/* | /* | ||||
* XXX The defines for inc_* are hacks and should be changed to direct | * XXX The defines for inc_* are hacks and should be changed to direct | ||||
Context not available. | |||||
struct inpcbhead *ipi_wildbase; /* (p) */ | struct inpcbhead *ipi_wildbase; /* (p) */ | ||||
u_long ipi_wildmask; /* (p) */ | u_long ipi_wildmask; /* (p) */ | ||||
/* | |||||
* Load balance groups used by the SO_REUSEPORT_LB option, | |||||
* hashed by local port. | |||||
*/ | |||||
struct inpcblbgrouphead *ipi_lbgrouphashbase; /* (h) */ | |||||
u_long ipi_lbgrouphashmask; /* (h) */ | |||||
/* | /* | ||||
* Pointer to network stack instance | * Pointer to network stack instance | ||||
*/ | */ | ||||
Context not available. | |||||
struct mtx ipg_lock; | struct mtx ipg_lock; | ||||
} __aligned(CACHE_LINE_SIZE); | } __aligned(CACHE_LINE_SIZE); | ||||
/* | |||||
* Load balance groups used by the SO_REUSEPORT_LB socket option. Each group | |||||
* (or port) can be re-used at most INPCBLBGROUP_SIZMAX (256) times. | |||||
rwatson: It might be useful for this comment to mention something about il_inp[] behaviour? | |||||
*/ | |||||
struct inpcblbgroup { | |||||
LIST_ENTRY(inpcblbgroup) il_list; | |||||
uint16_t il_lport; /* (c) */ | |||||
u_char il_vflag; /* (c) */ | |||||
u_char il_pad; | |||||
uint32_t il_pad2; | |||||
union in_dependaddr il_dependladdr; /* (c) */ | |||||
#define il_laddr il_dependladdr.id46_addr.ia46_addr4 | |||||
#define il6_laddr il_dependladdr.id6_addr | |||||
uint32_t il_inpsiz; /* max count in il_inp[] */ | |||||
uint32_t il_inpcnt; /* cur count in il_inp[] */ | |||||
struct inpcb *il_inp[]; | |||||
Done Inline ActionsWhat are the locking properties of il_inpsiz, il_inpcnt, and il_inp? rwatson: What are the locking properties of il_inpsiz, il_inpcnt, and il_inp? | |||||
}; | |||||
LIST_HEAD(inpcblbgrouphead, inpcblbgroup); | |||||
#define INP_LOCK_INIT(inp, d, t) \ | #define INP_LOCK_INIT(inp, d, t) \ | ||||
rw_init_flags(&(inp)->inp_lock, (t), RW_RECURSE | RW_DUPOK) | rw_init_flags(&(inp)->inp_lock, (t), RW_RECURSE | RW_DUPOK) | ||||
#define INP_LOCK_DESTROY(inp) rw_destroy(&(inp)->inp_lock) | #define INP_LOCK_DESTROY(inp) rw_destroy(&(inp)->inp_lock) | ||||
Context not available. | |||||
inp_inpcbtotcpcb(struct inpcb *inp); | inp_inpcbtotcpcb(struct inpcb *inp); | ||||
void inp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp, | void inp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp, | ||||
uint32_t *faddr, uint16_t *fp); | uint32_t *faddr, uint16_t *fp); | ||||
short inp_so_options(const struct inpcb *inp); | int inp_so_options(const struct inpcb *inp); | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
Context not available. | |||||
(((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) | (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) | ||||
#define INP_PCBPORTHASH(lport, mask) \ | #define INP_PCBPORTHASH(lport, mask) \ | ||||
(ntohs((lport)) & (mask)) | (ntohs((lport)) & (mask)) | ||||
#define INP_PCBLBGROUP_PORTHASH(lport, mask) \ | |||||
(ntohs((lport)) & (mask)) | |||||
#define INP_PCBLBGROUP_PKTHASH(faddr, lport, fport) \ | |||||
((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) | |||||
Done Inline ActionsI have no personal objection to this design choice, which is consistent with other hashes here, but someday we should think about something better for all of these hashes! rwatson: I have no personal objection to this design choice, which is consistent with other hashes here… | |||||
#define INP6_PCBHASHKEY(faddr) ((faddr)->s6_addr32[3]) | #define INP6_PCBHASHKEY(faddr) ((faddr)->s6_addr32[3]) | ||||
/* | /* | ||||
Context not available. | |||||
#define INP_RATE_LIMIT_CHANGED 0x00000400 /* rate limit needs attention */ | #define INP_RATE_LIMIT_CHANGED 0x00000400 /* rate limit needs attention */ | ||||
#define INP_ORIGDSTADDR 0x00000800 /* receive IP dst address/port */ | #define INP_ORIGDSTADDR 0x00000800 /* receive IP dst address/port */ | ||||
#define INP_CANNOT_DO_ECN 0x00001000 /* The stack does not do ECN */ | #define INP_CANNOT_DO_ECN 0x00001000 /* The stack does not do ECN */ | ||||
#define INP_REUSEPORT_LB 0x00002000 /* SO_REUSEPORT_LB option is set */ | |||||
/* | /* | ||||
* Flags passed to in_pcblookup*() functions. | * Flags passed to in_pcblookup*() functions. | ||||
Context not available. | |||||
struct inpcb * | struct inpcb * | ||||
in_pcblookup(struct inpcbinfo *, struct in_addr, u_int, | in_pcblookup(struct inpcbinfo *, struct in_addr, u_int, | ||||
struct in_addr, u_int, int, struct ifnet *); | struct in_addr, u_int, int, struct ifnet *); | ||||
struct inpcb * | |||||
in_pcblookup_lbgroup_last(struct inpcb *inp); | |||||
struct inpcb * | struct inpcb * | ||||
in_pcblookup_mbuf(struct inpcbinfo *, struct in_addr, u_int, | in_pcblookup_mbuf(struct inpcbinfo *, struct in_addr, u_int, | ||||
struct in_addr, u_int, int, struct ifnet *, struct mbuf *); | struct in_addr, u_int, int, struct ifnet *, struct mbuf *); | ||||
Context not available. |
It might be useful for this comment to mention something about il_inp[] behaviour?