- /* SIGUSR2 forces udhcpc to release the current lease and go inactive,
- * and SIGTERM causes udhcpc to exit. Signals are queued and processed
- * sequentially so we don't need to sleep */
- if (execute("kill -USR2 `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec)
- || execute("kill -TERM `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec))
- return 1;
- if (execute("pump -i %iface% -k", ifd, exec)) return 1;
- if (execute("kill -9 `cat /var/run/dhclient.%iface%.pid` 2>/dev/null", ifd, exec)) return 1;
- if (execute("dhcpcd -k %iface%", ifd, exec)) return 1;
- return static_down(ifd, exec);
+ if (!result)
+ bb_error_msg("warning: no dhcp clients found and stopped");
+
+ /* Sleep a bit, otherwise static_down tries to bring down interface too soon,
+ and it may come back up because udhcpc is still shutting down */
+ usleep(100000);
+ result += static_down(ifd, exec);
+ return ((result == 3) ? 3 : 0);
+}
+#elif ENABLE_UDHCPC
+static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec)
+{
+ int result;
+ result = execute("kill "
+ "`cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
+ /* Also bring the hardware interface down since
+ killing the dhcp client alone doesn't do it.
+ This enables consecutive ifup->ifdown->ifup */
+ /* Sleep a bit, otherwise static_down tries to bring down interface too soon,
+ and it may come back up because udhcpc is still shutting down */
+ usleep(100000);
+ result += static_down(ifd, exec);
+ return ((result == 3) ? 3 : 0);
+}
+#else
+static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd UNUSED_PARAM,
+ execfn *exec UNUSED_PARAM)
+{
+ return 0; /* no dhcp support */
+}
+#endif
+
+static int FAST_FUNC manual_up_down(struct interface_defn_t *ifd UNUSED_PARAM, execfn *exec UNUSED_PARAM)
+{
+ return 1;