summaryrefslogtreecommitdiff
path: root/networking/ifupdown.c
AgeCommit message (Collapse)Author
2017-01-10Big cleanup in config help and descriptionDenys Vlasenko
Redundant help texts (one which only repeats the description) are deleted. Descriptions and help texts are trimmed. Some config options are moved, even across menus. No config option _names_ are changed. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-23Remove FEATURE_IFUPDOWN_IP_BUILTIN and FEATURE_IFUPDOWN_IFCONFIG_BUILTINDenys Vlasenko
They merely enable ip or ifconfig/route. There is already a way to do this on the same menuconfig page. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-14Make ifup and ifdown individually selectable.Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-09ifupdown: rewrite state file atomicallyDenys Vlasenko
By user's request. Decided to not use fcntl(F_SETLKW) in lieu of problems with locking on networked filesystems. The existence of /var/run/ifstate.new is treated as a write lock. rename() provides atomicity. function old new delta ifupdown_main 1019 1122 +103 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-25ifupdown: improve help text, add comment about run-parts error msgDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-20ifupdown: when flushing addresses with "ip", add label %label%Denys Vlasenko
User report: or our board we setup eth0:0 on a 10.10.10.x/29 netwrok. The problem is ip addr flush dev eth0:0 removes all ip addresses from eth0. You can see this if you run ip -stat -stat addr flush dev eth0:0 2: eth0 inet 172.27.105.10/22 brd 172.27.107.255 scope global eth0 valid_lft forever preferred_lft forever 2: eth0 inet 10.10.10.9/29 scope global eth0:0 valid_lft forever preferred_lft forever 2: eth0 inet6 fe80::a2f6:fdff:fe18:2b13/64 scope link valid_lft forever preferred_lft forever *** Round 1, deleting 3 addresses *** *** Flush is complete after 1 round *** Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21*: add most of the required setup_common_bufsiz() callsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for itDenys Vlasenko
The config item is FEATURE_USE_BSS_TAIL. When it is off (default): function old new delta read_config 210 228 +18 doCommands 2279 2294 +15 ipneigh_list_or_flush 763 772 +9 ipaddr_list_or_flush 1256 1261 +5 display_process_list 1301 1306 +5 conspy_main 1378 1383 +5 do_lzo_compress 352 355 +3 do_lzo_decompress 565 567 +2 push 46 44 -2 inetd_main 2136 2134 -2 uevent_main 421 418 -3 addLines 97 92 -5 bb_common_bufsiz1 8193 1024 -7169 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/5 up/down: 62/-7181) Total: -7119 bytes text data bss dec hex filename 829850 4086 9080 843016 cdd08 busybox_old 829901 4086 1904 835891 cc133 busybox_unstripped FEATURE_USE_BSS_TAIL=y: read_config 210 228 +18 doCommands 2279 2294 +15 ipneigh_list_or_flush 763 772 +9 ipaddr_list_or_flush 1256 1261 +5 display_process_list 1301 1306 +5 conspy_main 1378 1383 +5 do_lzo_compress 352 355 +3 do_lzo_decompress 565 567 +2 inetd_main 2136 2134 -2 bb_common_bufsiz1 8193 - -8193 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 8/1 up/down: 62/-8195) Total: -8133 bytes text data bss dec hex filename 829850 4086 9080 843016 cdd08 busybox_old 829911 4086 880 834877 cbd3d busybox_unstripped FIXME: setup_common_bufsiz() calls are missing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-03ifupdowm: fix "warning: unused variable 'iface_list'"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-01ifupdown: allow duplicate interface definitionsNicolas Cavallari
This patch allow to have multiple interface definitions, much like Debian's ifupdown. More specifically, it removes the check for a duplicate definition, so the impact on binary size should be fairly minimal. This configuration: iface eth0 inet static address 192.168.0.15 netmask 255.255.0.0 gateway 192.168.0.1 iface eth0 inet static address 10.0.0.1 netmask 255.255.255.0 Will add two addresses to eth0 if ip is used. If ifconfig is used, the standards methods will likely not stack, but the administrator may still use the manual method. The DHCP method may work depending on the DHCP client in use. This is a fairly advanced feature for power users who knows what they are doing. There are not many other network configuration systems that allows multiple addresses on an interface. Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-31ifupdown: use -x hostname:NAME with udhcpcNatanael Copa
The -H NAME is deprecated in udhcpc. See commit 2017d48c0d70bef8768efb42909e605ea8eb5a21 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-26ifupdown: pass interface device name for ipv6 route commandsTimo Teräs
IPv6 routes need the device argument for link-local routes, or they cannot be used at all. E.g. "gateway fe80::def" seems to be used in some places, but kernel refuses to insert the route unless device name is explicitly specified in the route addition. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24ifupdown: 'prio' should have been 'metric' in static_up and static_up6Alex Dowad
When a static interface with explicit gateway and metric in /etc/network/interfaces is enabled using 'ifup', and further, the BusyBox 'ip' applet is enabled, the following error message appears at the console (and no default route is added): ip: either "to" is duplicate, or "prio" is garbage Tracing ifup reveals that it is attempting to run the following shell command: ip route add default via <GW> dev <DEVICE> prio <METRIC> 'ip' does not understand the 'prio' argument, causing this error. With 'metric', it works fine. Signed-off-by: Alex Dowad <alexinbeijing@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-22ifupdown: shrink a messageDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-22ifupdown: correct ifstate update during 'ifup -a'. Closes 6212Frank Bergmann
When 'if -a' runs into an failure on an interface all further interfaces won't be correctly updated in ifstate. This patch inserts a new variable that only tracks the current interfaces failure so that the write to ifstate can rely on this and not the one for the functions return value. Fixes https://bugs.busybox.net/show_bug.cgi?id=6212 Signed-off-by: Frank Bergmann <frank.frajasalo@googlemail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-12libbb: introduce and use is_prefixed_with()Denys Vlasenko
function old new delta is_prefixed_with - 18 +18 complete_username 78 77 -1 man_main 737 735 -2 fsck_device 429 427 -2 unpack_ar_archive 80 76 -4 strip_unsafe_prefix 105 101 -4 singlemount 1054 1050 -4 rtc_adjtime_is_utc 90 86 -4 resolve_mount_spec 88 84 -4 parse_one_line 1029 1025 -4 parse_conf 1460 1456 -4 may_wakeup 83 79 -4 loadkmap_main 219 215 -4 get_irqs_from_stat 103 99 -4 get_header_cpio 913 909 -4 findfs_main 79 75 -4 fbsplash_main 1230 1226 -4 load_crontab 776 771 -5 expand_vars_to_list 1151 1146 -5 date_main 881 876 -5 skip_dev_pfx 30 24 -6 make_device 2199 2193 -6 complete_cmd_dir_file 773 767 -6 run_applet_and_exit 715 708 -7 uudecode_main 321 313 -8 pwdx_main 197 189 -8 execute 568 560 -8 i2cdetect_main 1186 1176 -10 procps_scan 1242 1230 -12 procps_read_smaps 1017 1005 -12 process_module 746 734 -12 patch_main 1903 1891 -12 nfsmount 3572 3560 -12 stack_machine 126 112 -14 process_timer_stats 449 435 -14 match_fstype 111 97 -14 do_ipaddr 1344 1330 -14 open_list_and_close 359 343 -16 get_header_tar 1795 1779 -16 prepend_new_eth_table 340 323 -17 fsck_main 1811 1794 -17 find_iface_state 56 38 -18 dnsd_main 1321 1303 -18 base_device 179 158 -21 find_keyword 104 82 -22 handle_incoming_and_exit 2785 2762 -23 parse_and_put_prompt 774 746 -28 modinfo 347 317 -30 find_action 204 171 -33 update_passwd 1470 1436 -34 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/49 up/down: 18/-540) Total: -522 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02libbb: rename execable -> executable. No code changesDenys Vlasenko
English speakers complained that it sounded awfully broken. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-03ifupdown: support 'link' address familyKaarle Ritvanen
Does not configure anything. L2 configuration hook scripts should do their job on receiving ADDRFAM=link. Configuration will be done only once, irrespective of L3 protocols used. Using the 'link' family in the interfaces file conforms to the Debian implementation: http://sources.debian.net/src/ifupdown/0.7.47.1/link.defn function old new delta link_methods - 12 +12 addr_link - 12 +12 link_up_down - 6 +6 static.addr_fams 12 16 +4 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 1/0 up/down: 34/0) Total: 34 bytes Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-28ifupdown: support "source" stanza in /etc/network/interfacesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-11-09ifupdown: code shrinkDenys Vlasenko
function old new delta execute 571 548 -23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-11-05ifupdown: remove unused errno assignmentsDenys Vlasenko
function old new delta execute 607 571 -36 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-11-05ifupdown: simple code shrinkDenys Vlasenko
function old new delta execute 631 607 -24 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-02style fixes, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-23ifupdown: improve compatibility with DebianAndreas Oberritter
Set environment variable 'PHASE'. Treat post-up and pre-down as aliases for up and down. Uses the same logic as ifupdown.nw from ifupdown-0.6.16. Makes it possible to execute Debian's ifupdown script for wpa-supplicant. Signed-off-by: Andreas Oberritter <obi@opendreambox.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-19ifupdown: support metric for static default gwNatanael Copa
This is useful when you have multiple ISPs with failover. It allows setting the priority of the static gateway and makes it possible to specify multiple static gateways. The ubuntu ifupdown supports it. function old new delta .rodata 116725 116797 +72 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 72/0) Total: 72 bytes text data bss dec hex filename 953343 7313 8984 969640 ecba8 busybox_old 953415 7313 8984 969712 ecbf0 busybox_unstripped Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-15*: style fixes. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-15ifupdown: remove interface from state_list if iface_up failsLauri Hintsala
Fix the issue where interface is set to the configured state even if configuration has failed. Add error check to state setting logic. Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-19ifupdown: code shrinkDenys Vlasenko
function old new delta keywords_up_down - 43 +43 set_environ 371 259 -112 ifupdown_main 2194 2073 -121 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 43/-233) Total: -190 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-19ifupdown: support post-up / pre-down hooksPeter Korsgaard
function old new delta set_environ 330 371 +41 ifupdown_main 2156 2194 +38 iface_up 97 113 +16 iface_down 97 113 +16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 111/0) Total: 111 bytes Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> 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-03-08use user's shell instead of hardwired "/bin/sh" (android needs this)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-02don't leak malloced variables in the loop; remove double allocAlexey Fomenko
Signed-off-by: Alexey Fomenko <ext-alexey.fomenko@nokia.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-29ifupdown: add manual method for IPv6. Closes bug 2497.Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28*: whitespace fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-09-03ifupdown: %client%, not %clientid%Denys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.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-04*: introduce and use xfork() and xvfork()Pascal Bellard
function old new delta launch_helper 170 169 -1 setup_heredoc 312 302 -10 handle_dir_common 367 354 -13 expand_vars_to_list 2456 2443 -13 open_transformer 89 74 -15 data_extract_to_command 439 423 -16 do_ipaddr 1406 1389 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-85) Total: -85 bytes Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04libbb: introduce and use BB_EXECVP_or_die()Pascal Bellard
function old new delta BB_EXECVP_or_die - 47 +47 time_main 1042 1043 +1 chrt_main 371 364 -7 ionice_main 292 282 -10 setsid_main 69 56 -13 nohup_main 236 223 -13 cttyhack_main 266 253 -13 chroot_main 94 81 -13 chpst_main 746 733 -13 timeout_main 297 279 -18 taskset_main 541 522 -19 vfork_child 67 45 -22 parse 975 953 -22 lpd_main 770 748 -22 launch_helper 192 170 -22 tcpudpsvd_main 1810 1782 -28 nice_main 190 156 -34 env_main 242 206 -36 run_command 221 174 -47 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/17 up/down: 48/-352) Total: -304 bytes Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-25*: make exec failure message more consistentDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-02ifdown: use /var/run/udhcpc.%iface%.pid only if it existsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04*: suppress ~60% of "aliased warnings" on gcc-4.4.1Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04*: remove some uses of argcDenys Vlasenko
function old new delta whoami_main 34 37 +3 logname_main 60 63 +3 hostid_main 35 38 +3 ttysize_main 136 135 -1 nmeter_main 673 672 -1 logger_main 387 386 -1 uuencode_main 330 328 -2 ifupdown_main 2125 2123 -2 mesg_main 158 155 -3 free_main 333 330 -3 cal_main 902 899 -3 acpid_main 443 440 -3 ar_main 196 189 -7 find_main 476 467 -9 ifconfig_main 1235 1221 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/12 up/down: 9/-49) Total: -40 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-11replace APP_xxDHCPxx with xxDHCPxx, it's more consistent with the restDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-15libbb: added xfdopen_for_read/writeDenys Vlasenko
function old new delta xfdopen_helper - 40 +40 logdir_open 1163 1184 +21 process_stdin 433 443 +10 xfdopen_for_write - 9 +9 doCommands 2465 2474 +9 patch_main 1214 1222 +8 bbunpack 457 465 +8 xfdopen_for_read - 7 +7 scan_tree 258 262 +4 xstrtoul_range_sfx 230 231 +1 sendmail_main 957 955 -2 passwd_main 1027 1023 -4 parse 969 964 -5 test_main 253 247 -6 sed_main 655 649 -6 dos2unix_main 437 429 -8 fbsplash_main 950 938 -12 handle_dir_common 371 354 -17 expand_vars_to_list 2197 2169 -28 update_passwd 1275 1246 -29 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 7/10 up/down: 117/-117) Total: 0 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02*: introduce and use ffulsh_all()Denys Vlasenko
function old new delta buffer_fill_and_print 179 196 +17 fflush_all - 9 +9 spawn 87 92 +5 rtcwake_main 455 453 -2 ... alarm_intr 93 84 -9 readcmd 1072 1062 -10 bb_ask 345 333 -12 more_main 845 832 -13 flush_stdout_stderr 42 23 -19 xfflush_stdout 27 - -27 flush_stderr 30 - -30 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397) Total: -366 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-16ifup: make /etc/network/interfaces parser tolerant to trailing spacesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06more C standard compat fixes from Dan FandrichDenys Vlasenko
function old new delta docolon 207 204 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05ifupdown: if $PATH is not set, do not set it to "" in childrenDenys Vlasenko
Also random code shrink: function old new delta set_environ 328 330 +2 static.label_buf 4 - -4 startup_PATH 4 - -4 my_environ 4 - -4 ifupdown_main 2148 2134 -14 setlocalenv 117 90 -27 get_var 139 112 -27 ------------------------------------------------------------------------------ (add/remove: 0/3 grow/shrink: 1/3 up/down: 2/-80) Total: -78 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05*: add FAST_FUNC to function ptrs where it makes senseDenys Vlasenko
function old new delta evalcommand 1195 1209 +14 testcmd - 10 +10 printfcmd - 10 +10 echocmd - 10 +10 func_exec 270 276 +6 echo_dg 104 109 +5 store_nlmsg 85 89 +4 pseudo_exec_argv 195 198 +3 dotcmd 287 290 +3 machtime_stream 29 31 +2 discard_stream 24 26 +2 argstr 1299 1301 +2 killcmd 108 109 +1 evalfor 226 227 +1 daytime_stream 43 44 +1 run_list 2544 2543 -1 lookupvar 62 61 -1 ipaddr_modify 1310 1309 -1 ... parse_stream 2254 2245 -9 evalpipe 356 347 -9 collect_if 210 197 -13 read_opt 869 851 -18 handle_dollar 681 658 -23 print_addrinfo 1342 1303 -39 iterate_on_dir 156 59 -97 print_route 1709 1609 -100 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 12/130 up/down: 74/-767) Total: -693 bytes text data bss dec hex filename 841748 467 7872 850087 cf8a7 busybox_old 841061 467 7872 849400 cf5f8 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>