]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Close sockets better and just run the script when we're not touching the interface.
authorRoy Marples <roy@marples.name>
Tue, 24 Feb 2009 15:41:15 +0000 (15:41 +0000)
committerRoy Marples <roy@marples.name>
Tue, 24 Feb 2009 15:41:15 +0000 (15:41 +0000)
bind.c
dhcpcd.c

diff --git a/bind.c b/bind.c
index f671a4ac0c268415ee149c4b45eedd7b8aa9a17e..98873d76371fc53ee3f755c8e3bc393efeba2499 100644 (file)
--- a/bind.c
+++ b/bind.c
@@ -121,6 +121,8 @@ bind_interface(void *arg)
        struct dhcp_lease *lease = &state->lease;
        struct timeval tv;
 
+       /* We're binding an address now - ensure that sockets are closed */
+       close_sockets(iface);
        state->reason = NULL;
        delete_timeout(handle_exit_timeout, NULL);
        if (clock_monotonic)
index 5c6a10e1eb9ec8a64d815385d041eace05718532..78e28a763777129045e4bd1438949c42832f840e 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -560,7 +560,6 @@ handle_dhcp(struct interface *iface, struct dhcp_message **dhcpp)
                }
        }
 
-       close_sockets(iface);
        bind_interface(iface);
 }
 
@@ -747,7 +746,7 @@ handle_carrier(const char *ifname)
                                }
                        }
                        iface->state->reason = "CARRIER";
-                       configure(iface);
+                       run_script(iface);
                        start_interface(iface);
                }
                break;
@@ -974,7 +973,7 @@ init_state(struct interface *iface, int argc, char **argv)
        ifs->nakoff = 1;
        configure_interface(iface, argc, argv);
        if (!(options & DHCPCD_TEST))
-               configure(iface);
+               run_script(iface);
 
        if (ifs->options->options & DHCPCD_LINK) {
                switch (carrier_status(iface->name)) {
@@ -991,7 +990,7 @@ init_state(struct interface *iface, int argc, char **argv)
                        return;
                }
                if (!(options & DHCPCD_TEST))
-                       configure(iface);
+                       run_script(iface);
        } else
                iface->carrier = LINK_UNKNOWN;
 }