Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 try to get a non-conflicting port # when bind(2...



details:   https://anonhg.NetBSD.org/src/rev/9d9ebde54019
branches:  trunk
changeset: 474286:9d9ebde54019
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Jul 02 19:57:05 1999 +0000

description:
try to get a non-conflicting port # when bind(2) to port number 0
is called.

diffstat:

 sys/netinet6/in6_pcb.c |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (19 lines):

diff -r 93c9676949ac -r 9d9ebde54019 sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c    Fri Jul 02 19:05:45 1999 +0000
+++ b/sys/netinet6/in6_pcb.c    Fri Jul 02 19:57:05 1999 +0000
@@ -267,6 +267,7 @@
                else if (head->in6p_lport > IPV6PORT_ANONMAX)
                        head->in6p_lport = IPV6PORT_ANONMIN;
                last_port = head->in6p_lport;
+               goto startover; /*to randomize*/
                for (;;) {
                        lport = htons(head->in6p_lport);
                        if (IN6_IS_ADDR_V4MAPPED(&in6p->in6p_laddr)) {
@@ -283,6 +284,7 @@
                        }
                        if (t == 0)
                                break;
+startover:
                        if (head->in6p_lport >= IPV6PORT_ANONMAX)
                                head->in6p_lport = IPV6PORT_ANONMIN;
                        else



Home | Main Index | Thread Index | Old Index