aboutsummaryrefslogtreecommitdiff
path: root/networking/ifplugd.c
AgeCommit message (Collapse)Author
2020-08-13build system: drop PLATFORM_LINUXRon Yorston
PLATFORM_LINUX is a hidden configuration option which is disabled by default and enabled at over a hundred locations for features that are deemed to be Linux specific. The only effect of PLATFORM_LINUX is to control compilation of libbb/match_fstype.c. This file is only needed by mount and umount. Remove all references to PLATFORM_LINUX and compile match_fstype.c if mount or umount is enabled. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-07-02libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-03libbb: move netlink socket binding to the utility functionDenys Vlasenko
function old new delta create_and_bind_to_netlink - 134 +134 ifplugd_main 1117 1052 -65 uevent_main 399 306 -93 mdev_main 314 215 -99 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/3 up/down: 134/-257) Total: -123 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-30Optionally re-introduce bb_info_msg()James Byrne
Between Busybox 1.24.2 and 1.25.0 the bb_info_msg() function was eliminated and calls to it changed to be bb_error_msg(). The downside of this is that daemons now log all messages to syslog at the LOG_ERR level which makes it hard to filter errors from informational messages. This change optionally re-introduces bb_info_msg(), controlled by a new option FEATURE_SYSLOG_INFO, restores all the calls to bb_info_msg() that were removed (only in applets that set logmode to LOGMODE_SYSLOG or LOGMODE_BOTH), and also changes informational messages in ifplugd and ntpd. The code size change of this is as follows (using 'defconfig' on x86_64 with gcc 7.3.0-27ubuntu1~18.04) function old new delta bb_info_msg - 182 +182 bb_vinfo_msg - 27 +27 static.log7 194 198 +4 log8 190 191 +1 log5 190 191 +1 crondlog 45 - -45 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 3/0 up/down: 215/-45) Total: 170 bytes If you don't care about everything being logged at LOG_ERR level then when FEATURE_SYSLOG_INFO is disabled Busybox actually gets smaller: function old new delta static.log7 194 200 +6 log8 190 193 +3 log5 190 193 +3 syslog_level 1 - -1 bb_verror_msg 583 581 -2 crondlog 45 - -45 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 3/1 up/down: 12/-48) Total: -36 bytes Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28config: update size informationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-29ifplugd: close signal raceDenys Vlasenko
function old new delta ifplugd_main 1109 1117 +8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-03-29ifplugd: if SIOCSIFFLAGS fails with EADDRNOTAVAIL, don't dieStefan Agner
When using ifplugd on a RNDIS interface with monitor mode, using SIOCSIFFLAGS seems to fail with EADDRNOTAVAIL. Treat it the same as if iface disappeared again. This has been observed on a Tegra TK1 using Linux 4.14. There seem to be a race when the kernel is creating the device: ifplugd(usb0): started: BusyBox v1.24.1 (2018-03-27 09:47:48 CEST) ifplugd(usb0): interface doesn't exist, waiting ifplugd(usb0): interface appeared ifplugd(usb0): upping interface ifplugd(usb0): setting interface flags failed: Cannot assign requested address <exit> With this patch ifplugd is successful in upping the device the second time around: ifplugd(usb0): upping interface ifplugd(usb0): using SIOCETHTOOL detection mode ifplugd(usb0): interface appeared ifplugd(usb0): upping interface ifplugd(usb0): setting interface flags failed: Cannot assign requested address ifplugd(usb0): interface appeared ifplugd(usb0): upping interface ifplugd(usb0): using SIOCETHTOOL detection mode ifplugd(usb0): link is up ifplugd(usb0): executing '/etc/ifplugd/ifplugd.usb.action usb0 up' ifplugd up ifplugd(usb0): exit code: 0 function old new delta up_iface 120 127 +7 Signed-off-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-22zcip: fix slow environment leakDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21config: deindent all help textsDenys Vlasenko
Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18Update menuconfig items with approximate applet sizesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23Convert all networking/* applets to "new style" applet definitionsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-16ifplugd: if SIOCSIFFLAGS fails with ENODEV, don't dieDenys Vlasenko
Some user managed to hit a race where iface is gone between SIOCGIFFLAGS and SIOCSIFFLAGS (!). If SIOCSIFFLAGS fails, treat it the same as failed SIOCGIFFLAGS Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-06getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LISTDenys Vlasenko
In many cases, this aqllows to drop use of opt_complementary. Approximately -400 bytes: function old new delta getopt32 1423 1502 +79 opt_string 17 18 +1 OPT_STR 24 25 +1 uniq_main 416 406 -10 timeout_main 279 269 -10 sulogin_main 270 260 -10 readprofile_main 1825 1815 -10 ps_main 543 533 -10 pidof_main 245 235 -10 pgrep_main 611 601 -10 od_main 2600 2590 -10 mkfs_minix_main 2684 2674 -10 mkfs_ext2_main 2603 2593 -10 microcom_main 712 702 -10 makemime_main 315 305 -10 ionice_main 282 272 -10 inetd_main 2074 2064 -10 ifplugd_main 1144 1134 -10 halt_main 353 343 -10 getopt_main 636 626 -10 fdisk_main 2854 2844 -10 env_main 206 196 -10 dmesg_main 319 309 -10 conspy_main 1214 1204 -10 awk_main 981 971 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/22 up/down: 81/-220) Total: -139 bytes text data bss dec hex filename 919373 906 14060 934339 e41c3 busybox_old 918969 906 14060 933935 e402f busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07ifplugd: discovered why it needed net/ethernet.h: just for ETH_ALENDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-05Aboriginal linux/musl build fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-10ifplugd: code shrinkDenys Vlasenko
function old new delta ifplugd_main 1161 1144 -17 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-04ifplugd: use a larger netlink bufferTito Ragusa
function old new delta check_existence_through_netlink 310 321 +11 Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-28ifplugd: make -k send SIGINT, not SIGQUITDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-12-19CONFIG_PID_FILE_PATH: new configuration option for pidfile pathsAnthony G. Basile
We set a default path for the directory where pidfiles are create when FEATURE_PIDFILE is selected. The default has no effect on applets which must specify a pidfile path on the command line to run, and it can be overridden by applets which optionally allow the user to specify the pidfile path. We also add pidfile write/remove support for klogd, ntpd and watchdog. For syslogd, we add a missing remove_pidfile() for better cleanup on daemon exit. Signed-off-by: Anthony G. Basile <blueness@gentoo.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-06-03ifplugd: tweak help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-10*: simplify Ethernet header includesDan Fandrich
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05*: remove "Options:" string from help textsDenys Vlasenko
function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11move remaining help text from include/usage.src.hPere Orga
Signed-off-by: Pere Orga <gotrunks@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-20eliminate aliasing warning in networking/route.cDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-20ifplugd: eliminate aliasing warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-22ifplugd: code shrinkMaksym Kryzhanovskyy
function old new delta ifplugd_main 1089 1161 +72 method_table - 40 +40 detect_link 221 207 -14 static.method 40 - -40 netlink_open 79 - -79 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 1/1 up/down: 112/-133) Total: -21 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-08ifplugd: code shrinkMaksym Kryzhanovskyy
function old new delta detect_link 122 221 +99 api_modes - 7 +7 maybe_up_new_iface 27 33 +6 ifplugd_main 1143 1089 -54 detect_link_auto 117 - -117 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 2/1 up/down: 112/-171) Total: -59 bytes Signed-off-by: Maksym Kryzhanovskyy <xmaks@email.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-11ifplugd: fix typo in prev commitDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-08ifplugd: replace potentially-leaking setenv with malloc/putenv/freeDenys Vlasenko
text data bss dec hex filename 842657 453 6828 849938 cf812 busybox_old 842722 453 6828 850003 cf853 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-02ifplugd: more robust interface name match checkDenys Vlasenko
function old new delta check_existence_through_netlink 278 308 +30 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-30ifplugd: code shrink; expanded commentsMaxim Kryzhanovsky
Signed-off-by: Maxim Kryzhanovsky <xmaks@email.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-29ifplugd: code shrinkMaxim Kryzhanovsky
text data bss dec hex filename 840048 453 6828 847329 cede1 busybox_old 839915 453 6828 847196 ced5c busybox_unstripped Signed-off-by: Maxim Kryzhanovsky <xmaks@email.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23*: merge some common stringsDenys Vlasenko
text data bss dec hexfilename 838650 8009 0 846659 ceb43busybox_old 838519 8009 0 846528 ceac0busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-18*: code shrink and better "died from signal" reporting from wait4pidDenys Vlasenko
function old new delta parse 964 967 +3 udhcp_run_script 670 665 -5 singlemount 911 906 -5 mount_it_now 360 355 -5 inotifyd_main 521 516 -5 xspawn 21 - -21 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/4 up/down: 3/-41) Total: -38 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-08ifplugd: restore auto-ifup unless -a; make iff method less iffy :DDenys Vlasenko
function old new delta up_iface - 112 +112 network_ioctl 13 38 +25 detect_link_iff 58 71 +13 detect_link 143 152 +9 ifplugd_main 1107 1109 +2 detect_link_wlan 131 125 -6 detect_link_ethtool 71 65 -6 detect_link_priv 88 80 -8 detect_link_mii 88 80 -8 maybe_up_new_iface 144 27 -117 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/5 up/down: 161/-145) Total: 16 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-06ifplugd: simplify run_script()Denys Vlasenko
function old new delta packed_usage 26505 26518 +13 run_script 158 112 -46 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-07ifplugd: small optimizationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23ifplugd: fix compile errorDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-08randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-01ifplugd: fix warningsDenys Vlasenko
2009-04-29*: bb_error_msg's messages should not be capitalizedDenis Vlasenko
2009-04-26ifplugd: tiny shrinkDenis Vlasenko
2009-04-26ifplugd: add copyrightDenis Vlasenko
2009-04-26ifplugd: new applet by Maksym Kryzhanovskyy (xmaks AT email.cz)Denis Vlasenko
+3k code and 0.5k in messages. Most of the bloat due to compat :(