summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorse146197 <none@none>2006-07-12 08:36:15 -0700
committerse146197 <none@none>2006-07-12 08:36:15 -0700
commitf952bcd50abdd4f13b290f1ca2a7c907a974f2bd (patch)
treeca02add2b41b3741a49174abdbddd5531926b2f9
parent0f2065cc727eb1b7dcf65d01b5c2ccb67933a005 (diff)
downloadillumos-gate-f952bcd50abdd4f13b290f1ca2a7c907a974f2bd.tar.gz
6313308 S9 UDP anonymous port assigned used/unavailable ports.
-rw-r--r--usr/src/uts/common/inet/udp/udp.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/usr/src/uts/common/inet/udp/udp.c b/usr/src/uts/common/inet/udp/udp.c
index c2213c446b..11e6f6626c 100644
--- a/usr/src/uts/common/inet/udp/udp.c
+++ b/usr/src/uts/common/inet/udp/udp.c
@@ -1388,8 +1388,23 @@ udp_bind(queue_t *q, mblk_t *mp)
* Check ipversion to allow IPv4 and IPv6 sockets to
* have disjoint port number spaces.
*/
- if (udp->udp_ipversion != udp1->udp_ipversion)
- continue;
+ if (udp->udp_ipversion != udp1->udp_ipversion) {
+
+ /*
+ * On the first time through the loop, if the
+ * the user intentionally specified a
+ * particular port number, then ignore any
+ * bindings of the other protocol that may
+ * conflict. This allows the user to bind IPv6
+ * alone and get both v4 and v6, or bind both
+ * both and get each seperately. On subsequent
+ * times through the loop, we're checking a
+ * port that we chose (not the user) and thus
+ * we do not allow casual duplicate bindings.
+ */
+ if (count == 0 && requested_port != 0)
+ continue;
+ }
/*
* No difference depending on SO_REUSEADDR.