aboutsummaryrefslogtreecommitdiff
path: root/networking/ifupdown.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/ifupdown.c')
-rw-r--r--networking/ifupdown.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 25b04c9d7..b0bc0d70f 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -21,7 +21,7 @@
21//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." 21//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..."
22//usage:#define ifup_full_usage "\n\n" 22//usage:#define ifup_full_usage "\n\n"
23//usage: " -a De/configure all interfaces automatically" 23//usage: " -a De/configure all interfaces automatically"
24//usage: "\n -i FILE Use FILE for interface definitions" 24//usage: "\n -i FILE Use FILE instead of /etc/network/interfaces"
25//usage: "\n -n Print out what would happen, but don't do it" 25//usage: "\n -n Print out what would happen, but don't do it"
26//usage: IF_FEATURE_IFUPDOWN_MAPPING( 26//usage: IF_FEATURE_IFUPDOWN_MAPPING(
27//usage: "\n (note: doesn't disable mappings)" 27//usage: "\n (note: doesn't disable mappings)"
@@ -492,7 +492,7 @@ static int FAST_FUNC static_up(struct interface_defn_t *ifd, execfn *exec)
492 result = execute("ifconfig %iface%[[ hw %hwaddress%]][[ media %media%]][[ mtu %mtu%]] up", 492 result = execute("ifconfig %iface%[[ hw %hwaddress%]][[ media %media%]][[ mtu %mtu%]] up",
493 ifd, exec); 493 ifd, exec);
494 result += execute("ifconfig %iface% %address% netmask %netmask%" 494 result += execute("ifconfig %iface% %address% netmask %netmask%"
495 "[[ broadcast %broadcast%]][[ pointopoint %pointopoint%]] ", 495 "[[ broadcast %broadcast%]][[ pointopoint %pointopoint%]]",
496 ifd, exec); 496 ifd, exec);
497 result += execute("[[route add default gw %gateway%[[ metric %metric%]] %iface%]]", ifd, exec); 497 result += execute("[[route add default gw %gateway%[[ metric %metric%]] %iface%]]", ifd, exec);
498 return ((result == 3) ? 3 : 0); 498 return ((result == 3) ? 3 : 0);
@@ -503,7 +503,10 @@ static int FAST_FUNC static_down(struct interface_defn_t *ifd, execfn *exec)
503{ 503{
504 int result; 504 int result;
505# if ENABLE_FEATURE_IFUPDOWN_IP 505# if ENABLE_FEATURE_IFUPDOWN_IP
506 result = execute("ip addr flush dev %iface%", ifd, exec); 506 /* Optional "label LBL" is necessary if interface is an alias (eth0:0),
507 * otherwise "ip addr flush dev eth0:0" flushes all addresses on eth0.
508 */
509 result = execute("ip addr flush dev %iface%[[ label %label%]]", ifd, exec);
507 result += execute("ip link set %iface% down", ifd, exec); 510 result += execute("ip link set %iface% down", ifd, exec);
508# else 511# else
509 /* result = execute("[[route del default gw %gateway% %iface%]]", ifd, exec); */ 512 /* result = execute("[[route del default gw %gateway% %iface%]]", ifd, exec); */
@@ -1066,6 +1069,11 @@ static int execute_all(struct interface_defn_t *ifd, const char *opt)
1066 } 1069 }
1067 } 1070 }
1068 1071
1072 /* Tested on Debian Squeeze: "standard" ifup runs this without
1073 * checking that directory exists. If it doesn't, run-parts
1074 * complains, and this message _is_ annoyingly visible.
1075 * Don't "fix" this (unless newer Debian does).
1076 */
1069 buf = xasprintf("run-parts /etc/network/if-%s.d", opt); 1077 buf = xasprintf("run-parts /etc/network/if-%s.d", opt);
1070 /* heh, we don't bother free'ing it */ 1078 /* heh, we don't bother free'ing it */
1071 return doit(buf); 1079 return doit(buf);