diff options
author | Vincent Gross <vgross@cvs.openbsd.org> | 2016-04-11 21:24:30 +0000 |
---|---|---|
committer | Vincent Gross <vgross@cvs.openbsd.org> | 2016-04-11 21:24:30 +0000 |
commit | 40bbd7246f4ce6fe48b4f4cc744d7cbf68b808c5 (patch) | |
tree | 63abca1b1519203eb6d42d2ccf639bb3be39deba | |
parent | 0610b8b35ff1469cf26b6a876d5a4c4e149e8772 (diff) |
Rename in_pcblookup() to in_pcblookup_local() and change its prototype
to get rid of the now useless foreign address and ports parameters.
ok mpi@
-rw-r--r-- | sys/netinet/in_pcb.c | 25 | ||||
-rw-r--r-- | sys/netinet/in_pcb.h | 5 | ||||
-rw-r--r-- | sys/netinet6/in6_pcb.c | 8 |
3 files changed, 18 insertions, 20 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 5a400531a98..634ae4576df 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.201 2016/04/08 14:34:21 vgross Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.202 2016/04/11 21:24:29 vgross Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -415,14 +415,13 @@ in_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in *sin, int wild, struct inpcb *t; if (so->so_euid) { - t = in_pcblookup(table, &zeroin_addr, 0, - &sin->sin_addr, lport, INPLOOKUP_WILDCARD, - inp->inp_rtableid); + t = in_pcblookup_local(table, &sin->sin_addr, lport, + INPLOOKUP_WILDCARD, inp->inp_rtableid); if (t && (so->so_euid != t->inp_socket->so_euid)) return (EADDRINUSE); } - t = in_pcblookup(table, &zeroin_addr, 0, - &sin->sin_addr, lport, wild, inp->inp_rtableid); + t = in_pcblookup_local(table, &sin->sin_addr, lport, + wild, inp->inp_rtableid); if (t && (reuseport & t->inp_socket->so_options) == 0) return (EADDRINUSE); } @@ -475,8 +474,8 @@ in_pcbpickport(u_int16_t *lport, void *laddr, int wild, struct inpcb *inp, candidate = lower; localport = htons(candidate); } while (in_baddynamic(localport, so->so_proto->pr_protocol) || - in_pcblookup(table, &zeroin46_addr, 0, - laddr, localport, wild, inp->inp_rtableid)); + in_pcblookup_local(table, laddr, localport, wild, + inp->inp_rtableid)); *lport = localport; return (0); @@ -734,13 +733,15 @@ in_rtchange(struct inpcb *inp, int errno) } struct inpcb * -in_pcblookup(struct inpcbtable *table, void *faddrp, u_int fport_arg, - void *laddrp, u_int lport_arg, int flags, u_int rdomain) +in_pcblookup_local(struct inpcbtable *table, void *laddrp, u_int lport_arg, + int flags, u_int rdomain) { struct inpcb *inp, *match = NULL; int matchwild = 3, wildcard; - u_int16_t fport = fport_arg, lport = lport_arg; - struct in_addr faddr = *(struct in_addr *)faddrp; + u_int16_t fport = 0; + u_int16_t lport = lport_arg; + struct in_addr faddr = zeroin_addr; + struct in6_addr *faddrp = &zeroin6_addr; struct in_addr laddr = *(struct in_addr *)laddrp; struct inpcbhead *head; diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 657895b3c5b..c695533d0ab 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.h,v 1.97 2016/04/05 19:34:05 vgross Exp $ */ +/* $OpenBSD: in_pcb.h,v 1.98 2016/04/11 21:24:29 vgross Exp $ */ /* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */ /* @@ -271,8 +271,7 @@ int in6_setpeeraddr(struct inpcb *, struct mbuf *); #endif /* INET6 */ void in_pcbinit(struct inpcbtable *, int); struct inpcb * - in_pcblookup(struct inpcbtable *, void *, u_int, void *, - u_int, int, u_int); + in_pcblookup_local(struct inpcbtable *, void *, u_int, int, u_int); void in_pcbnotifyall(struct inpcbtable *, struct sockaddr *, u_int, int, void (*)(struct inpcb *, int)); void in_pcbrehash(struct inpcb *); diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 1ffdd1d4c84..5a1ed86f081 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_pcb.c,v 1.91 2016/04/05 21:21:41 vgross Exp $ */ +/* $OpenBSD: in6_pcb.c,v 1.92 2016/04/11 21:24:29 vgross Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -217,16 +217,14 @@ in6_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild, struct inpcb *t; if (so->so_euid) { - t = in_pcblookup(table, - (struct in_addr *)&zeroin6_addr, 0, + t = in_pcblookup_local(table, (struct in_addr *)&sin6->sin6_addr, lport, INPLOOKUP_WILDCARD | INPLOOKUP_IPV6, inp->inp_rtableid); if (t && (so->so_euid != t->inp_socket->so_euid)) return (EADDRINUSE); } - t = in_pcblookup(table, - (struct in_addr *)&zeroin6_addr, 0, + t = in_pcblookup_local(table, (struct in_addr *)&sin6->sin6_addr, lport, wild, inp->inp_rtableid); if (t && (reuseport & t->inp_socket->so_options) == 0) |