tcp_connect: Rearrange tcp_lport_extension run logic, no functional change
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 12 Apr 2011 09:07:30 +0000 (17:07 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 12 Apr 2011 09:13:10 +0000 (17:13 +0800)
sys/netinet/tcp_usrreq.c

index 107e52e..af75be0 100644 (file)
@@ -1060,8 +1060,11 @@ tcp_connect(netmsg_t msg)
                in_pcblink(so->so_pcb, &tcbinfo[mycpu->gd_cpuid]);
        }
 
-       if (tcp_lport_extension) {
-               if (inp->inp_lport == 0) {
+       /*
+        * Bind if we have to
+        */
+       if (inp->inp_lport == 0) {
+               if (tcp_lport_extension) {
                        KKASSERT(inp->inp_laddr.s_addr == INADDR_ANY);
 
                        error = in_pcbladdr(inp, nam, &if_sin, td);
@@ -1074,12 +1077,7 @@ tcp_connect(netmsg_t msg)
                                goto out;
 
                        calc_laddr = 0;
-               }
-       } else {
-               /*
-                * Bind if we have to
-                */
-               if (inp->inp_lport == 0) {
+               } else {
                        error = in_pcbbind(inp, NULL, td);
                        if (error)
                                goto out;