dhcp: Be more precise about updating 'changed' flag.
authorBen Pfaff <blp@nicira.com>
Tue, 22 Jul 2008 21:00:03 +0000 (14:00 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 22 Jul 2008 21:00:03 +0000 (14:00 -0700)
There's no need to set changed unconditionally in dhclient_init(), and
it can make extra work for the users of the dhclient, by causing them
to think that something changed when it didn't.

lib/dhcp-client.c

index c1724477f5a49f9e01df53a41e63bc5a4a7cc91f..4735d597d80d7f86329febee728335abbc53d68b 100644 (file)
@@ -214,7 +214,6 @@ dhclient_init(struct dhclient *cli, uint32_t requested_ip)
 {
     state_transition(cli, requested_ip ? S_INIT_REBOOT : S_INIT);
     cli->ipaddr = requested_ip;
-    cli->changed = true;
     cli->min_timeout = 0;
     cli->init_delay = 0;
 }
@@ -230,6 +229,7 @@ dhclient_release(struct dhclient *cli)
         msg.ciaddr = cli->ipaddr;
         do_send_msg(cli, &msg);
         dhcp_msg_uninit(&msg);
+        cli->changed = true;
     }
     state_transition(cli, S_RELEASED);
     cli->min_timeout = UINT_MAX;