diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-25 22:16:04 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-25 22:16:04 +0000 |
commit | 6dd333dfe677858e73651b80d3d190eebddf2709 (patch) | |
tree | c7230c39b45e354cbec3d17c37a3db3f7d9ba624 /docs/ifupdown_design.txt | |
parent | 30bab71f7bd8b3b31fedb90c2510fc89ade04619 (diff) | |
download | busybox-w32-6dd333dfe677858e73651b80d3d190eebddf2709.tar.gz busybox-w32-6dd333dfe677858e73651b80d3d190eebddf2709.tar.bz2 busybox-w32-6dd333dfe677858e73651b80d3d190eebddf2709.zip |
Start a small document "why ifupdown is bad"
Diffstat (limited to 'docs/ifupdown_design.txt')
-rw-r--r-- | docs/ifupdown_design.txt | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/docs/ifupdown_design.txt b/docs/ifupdown_design.txt new file mode 100644 index 000000000..9df579289 --- /dev/null +++ b/docs/ifupdown_design.txt | |||
@@ -0,0 +1,44 @@ | |||
1 | This document is meant to convince you to not use ifup/ifdown. | ||
2 | |||
3 | |||
4 | The general problem with ifupdown is that it is "copulated in vertical | ||
5 | fashion" by design. It tries to do the job of shell script in C, | ||
6 | and this is invariably doomed to fail. You need ifup/ifdown | ||
7 | to be adaptable by local admins, and C is an extremely poor choice | ||
8 | for that. | ||
9 | |||
10 | We are doomed to have problems with ifup/ifdown. Just look as this code: | ||
11 | |||
12 | static const struct dhcp_client_t ext_dhcp_clients[] = { | ||
13 | { "dhcpcd", "<up cmd>", "<down cmd>" }, | ||
14 | { "dhclient", ........ }, | ||
15 | { "pump", ........ }, | ||
16 | { "udhcpc", ........ }, | ||
17 | }; | ||
18 | |||
19 | static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) | ||
20 | { | ||
21 | #if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP | ||
22 | int i ; | ||
23 | for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { | ||
24 | if (exists_execable(ext_dhcp_clients[i].name)) | ||
25 | return execute(ext_dhcp_clients[i].stopcmd, ifd, exec); | ||
26 | } | ||
27 | bb_error_msg("no dhcp clients found, using static interface shutdown"); | ||
28 | return static_down(ifd, exec); | ||
29 | #elif ENABLE_APP_UDHCPC | ||
30 | return execute("kill " | ||
31 | "`cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec); | ||
32 | #else | ||
33 | return 0; /* no dhcp support */ | ||
34 | #endif | ||
35 | } | ||
36 | |||
37 | How the hell it is supposed to work reliably this way? Just imagine that | ||
38 | admin is using pump and ifup/ifdown. It works. Then, for whatever reason, | ||
39 | admin installs dhclient, but does NOT use it. ifdown will STOP WORKING, | ||
40 | just because it will see installed dhclient binary in e.g. /usr/bin/dhclient! | ||
41 | This is stupid. | ||
42 | |||
43 | I seriously urge people to not use ifup/ifdown. | ||
44 | Use something less brain damaged. | ||