summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in_pcb.h
diff options
context:
space:
mode:
authorups <ups@FreeBSD.org>2006-07-18 22:34:27 +0000
committerups <ups@FreeBSD.org>2006-07-18 22:34:27 +0000
commitee0a5eb928ae5ccdf1a0e619b4ba6e93d19db5fb (patch)
tree2e39fd9d815a6efa63bdabd6bfed00c38e05310a /sys/netinet/in_pcb.h
parent9adb8df4815a901cfc690d567d4ba0b6c63b1d5d (diff)
downloadFreeBSD-src-ee0a5eb928ae5ccdf1a0e619b4ba6e93d19db5fb.zip
FreeBSD-src-ee0a5eb928ae5ccdf1a0e619b4ba6e93d19db5fb.tar.gz
Fix race conditions on enumerating pcb lists by moving the initialization
( and where appropriate the destruction) of the pcb mutex to the init/finit functions of the pcb zones. This allows locking of the pcb entries and race condition free comparison of the generation count. Rearrange locking a bit to avoid extra locking operation to update the generation count in in_pcballoc(). (in_pcballoc now returns the pcb locked) I am planning to convert pcb list handling from a type safe to a reference count model soon. ( As this allows really freeing the PCBs) Reviewed by: rwatson@, mohans@ MFC after: 1 week
Diffstat (limited to 'sys/netinet/in_pcb.h')
-rw-r--r--sys/netinet/in_pcb.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index 80ae9e9..64de94b 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -166,6 +166,7 @@ struct inpcb {
} inp_depend6;
LIST_ENTRY(inpcb) inp_portlist;
struct inpcbport *inp_phd; /* head of this list */
+#define inp_zero_size offsetof(struct inpcb, inp_gencnt)
inp_gen_t inp_gencnt; /* generation count of this instance */
struct mtx inp_mtx;
@@ -342,7 +343,7 @@ extern int ipport_hilastauto;
extern struct callout ipport_tick_callout;
void in_pcbpurgeif0(struct inpcbinfo *, struct ifnet *);
-int in_pcballoc(struct socket *, struct inpcbinfo *, const char *);
+int in_pcballoc(struct socket *, struct inpcbinfo *);
int in_pcbbind(struct inpcb *, struct sockaddr *, struct ucred *);
int in_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
u_short *, struct ucred *);
OpenPOWER on IntegriCloud