From 784c40b5fe9be2b8cee78178303b18f260db13ac Mon Sep 17 00:00:00 2001 From: Markus Friedl Date: Sun, 21 Dec 2003 15:12:28 +0000 Subject: change in*_pcbnotify to return numbers of matches; ok itojun, mcbride, henning --- sys/netinet/in_pcb.c | 11 +++++++---- sys/netinet/in_pcb.h | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'sys/netinet') diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 525172c5b34..042697622f1 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.72 2003/12/21 14:57:19 markus Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.73 2003/12/21 15:12:27 markus Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -562,7 +562,7 @@ in_setpeeraddr(inp, nam) * * Must be called at splsoftnet. */ -void +int in_pcbnotify(table, dst, fport_arg, laddr, lport_arg, errno, notify) struct inpcbtable *table; struct sockaddr *dst; @@ -574,6 +574,7 @@ in_pcbnotify(table, dst, fport_arg, laddr, lport_arg, errno, notify) struct inpcb *inp, *oinp; struct in_addr faddr; u_int16_t fport = fport_arg, lport = lport_arg; + int nmatch = 0; splassert(IPL_SOFTNET); @@ -586,10 +587,10 @@ in_pcbnotify(table, dst, fport_arg, laddr, lport_arg, errno, notify) #endif /* INET6 */ if (dst->sa_family != AF_INET) - return; + return (0); faddr = satosin(dst)->sin_addr; if (faddr.s_addr == INADDR_ANY) - return; + return (0); for (inp = CIRCLEQ_FIRST(&table->inpt_queue); inp != CIRCLEQ_END(&table->inpt_queue);) { @@ -609,9 +610,11 @@ in_pcbnotify(table, dst, fport_arg, laddr, lport_arg, errno, notify) } oinp = inp; inp = CIRCLEQ_NEXT(inp, inp_queue); + nmatch++; if (notify) (*notify)(oinp, errno); } + return (nmatch); } void diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 27d411b4a5c..705d15c4fe3 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.h,v 1.48 2003/12/08 07:07:36 mcbride Exp $ */ +/* $OpenBSD: in_pcb.h,v 1.49 2003/12/21 15:12:27 markus Exp $ */ /* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */ /* @@ -256,7 +256,7 @@ void in_pcbinit(struct inpcbtable *, int); struct inpcb * in_pcblookup(struct inpcbtable *, void *, u_int, void *, u_int, int); -void in_pcbnotify(struct inpcbtable *, struct sockaddr *, +int in_pcbnotify(struct inpcbtable *, struct sockaddr *, u_int, struct in_addr, u_int, int, void (*)(struct inpcb *, int)); void in_pcbnotifyall(struct inpcbtable *, struct sockaddr *, int, void (*)(struct inpcb *, int)); -- cgit v1.2.3