dhcp: Don't attempt to drain netdev if we ran out of packets.
authorBen Pfaff <blp@nicira.com>
Tue, 22 Jul 2008 20:16:08 +0000 (13:16 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 23 Jul 2008 20:12:17 +0000 (13:12 -0700)
Fixes a theoretical race condition that would have caused more
retransmission than otherwise necessary.

lib/dhcp-client.c

index 0757096f08f524f03674a47a432ada066b07d928..b2588e19a8688868b8a0d90dba739eb631ed0896 100644 (file)
@@ -731,7 +731,7 @@ do_receive_msg(struct dhclient *cli, struct dhcp_msg *msg)
         buffer_clear(&b);
         error = netdev_recv(cli->netdev, &b);
         if (error) {
-            break;
+            goto drained;
         }
 
         flow_extract(&b, 0, &flow);
@@ -766,6 +766,7 @@ do_receive_msg(struct dhclient *cli, struct dhcp_msg *msg)
         }
     }
     netdev_drain(cli->netdev);
+drained:
     buffer_uninit(&b);
     return false;
 }