aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2022-04-30 14:33:14 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2022-04-30 14:33:14 +0200
commit002d6ee46d7a188aff9530cf21363b4cf7795dc4 (patch)
tree3aae1cbf4f1d3a2522e040ecc5f8540ebf7d961d
parent8456c21c09189da8eadb78ef5cc7fdb9825fbc13 (diff)
downloadbusybox-w32-002d6ee46d7a188aff9530cf21363b4cf7795dc4.tar.gz
busybox-w32-002d6ee46d7a188aff9530cf21363b4cf7795dc4.tar.bz2
busybox-w32-002d6ee46d7a188aff9530cf21363b4cf7795dc4.zip
ifplugd: split -a into -a and -A, latter disables upping in iface creation
-a meant both "don't up iface before each link detection" and "don't up iface when it newly appears". But they are not the same. I have a dock station where eth1 appears when I attach the notebook to it (looks like it's hanging off a USB bus). IOW: appearance of this interface is functionally equivalent to attaching ethernet cable. ifplugd meant to be able to *automatically* handle this case. Currently, with -a, it couldn't: newly appearing iface stayed down, user had to manually up it. function old new delta packed_usage 34253 34296 +43 .rodata 104876 104877 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 44/0) Total: 44 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/ifplugd.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index c4b6b9584..0b55bf4e5 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -28,6 +28,7 @@
28//usage: "\n -a Don't up interface at each link probe" 28//usage: "\n -a Don't up interface at each link probe"
29//usage: "\n -M Monitor creation/destruction of interface" 29//usage: "\n -M Monitor creation/destruction of interface"
30//usage: "\n (otherwise it must exist)" 30//usage: "\n (otherwise it must exist)"
31//usage: "\n -A Don't up newly appeared interface"
31//usage: "\n -r PROG Script to run" 32//usage: "\n -r PROG Script to run"
32//usage: "\n -x ARG Extra argument for script" 33//usage: "\n -x ARG Extra argument for script"
33//usage: "\n -I Don't exit on nonzero exit code from script" 34//usage: "\n -I Don't exit on nonzero exit code from script"
@@ -94,7 +95,7 @@ Netlink code then can be just dropped (1k or more?)
94#define IFPLUGD_ENV_CURRENT "IFPLUGD_CURRENT" 95#define IFPLUGD_ENV_CURRENT "IFPLUGD_CURRENT"
95 96
96enum { 97enum {
97 FLAG_NO_AUTO = 1 << 0, // -a, Do not enable interface automatically 98 FLAG_NO_AUTO = 1 << 0, // -a, Don't up interface at each link probe
98 FLAG_NO_DAEMON = 1 << 1, // -n, Do not daemonize 99 FLAG_NO_DAEMON = 1 << 1, // -n, Do not daemonize
99 FLAG_NO_SYSLOG = 1 << 2, // -s, Do not use syslog, use stderr instead 100 FLAG_NO_SYSLOG = 1 << 2, // -s, Do not use syslog, use stderr instead
100 FLAG_IGNORE_FAIL = 1 << 3, // -f, Ignore detection failure, retry instead (failure is treated as DOWN) 101 FLAG_IGNORE_FAIL = 1 << 3, // -f, Ignore detection failure, retry instead (failure is treated as DOWN)
@@ -111,14 +112,15 @@ enum {
111 FLAG_INITIAL_DOWN = 1 << 14, // -l, Run "down" script on startup if no cable is detected 112 FLAG_INITIAL_DOWN = 1 << 14, // -l, Run "down" script on startup if no cable is detected
112 FLAG_EXTRA_ARG = 1 << 15, // -x, Specify an extra argument for action script 113 FLAG_EXTRA_ARG = 1 << 15, // -x, Specify an extra argument for action script
113 FLAG_MONITOR = 1 << 16, // -M, Use interface monitoring 114 FLAG_MONITOR = 1 << 16, // -M, Use interface monitoring
115 FLAG_NO_UP_NEW_IFACE = 1 << 17, // -A, Don't up newly appeared interface
114#if ENABLE_FEATURE_PIDFILE 116#if ENABLE_FEATURE_PIDFILE
115 FLAG_KILL = 1 << 17, // -k, Kill a running daemon 117 FLAG_KILL = 1 << 18, // -k, Kill a running daemon
116#endif 118#endif
117}; 119};
118#if ENABLE_FEATURE_PIDFILE 120#if ENABLE_FEATURE_PIDFILE
119# define OPTION_STR "+ansfFi:r:It:+u:+d:+m:pqlx:Mk" 121# define OPTION_STR "+ansfFi:r:It:+u:+d:+m:pqlx:MAk"
120#else 122#else
121# define OPTION_STR "+ansfFi:r:It:+u:+d:+m:pqlx:M" 123# define OPTION_STR "+ansfFi:r:It:+u:+d:+m:pqlx:MA"
122#endif 124#endif
123 125
124enum { // interface status 126enum { // interface status
@@ -387,7 +389,7 @@ static void up_iface(void)
387 389
388static void maybe_up_new_iface(void) 390static void maybe_up_new_iface(void)
389{ 391{
390 if (!(option_mask32 & FLAG_NO_AUTO)) 392 if (!(option_mask32 & FLAG_NO_UP_NEW_IFACE))
391 up_iface(); 393 up_iface();
392 394
393#if 0 /* bloat */ 395#if 0 /* bloat */