Commit Graph

2593 Commits

Author SHA1 Message Date
Denys Vlasenko
9f8eb1ee76 httpd: explain why we use sprintf and why it should be fine
While at it, fix a pathological case where it is not fine:
-r REALM with some 8-kbyte long REALM would overflow the buffer.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-22 02:23:35 +01:00
Denys Vlasenko
a8c696bf09 Make ifup and ifdown individually selectable.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-14 18:31:07 +01:00
Denys Vlasenko
67fd2f2858 dnsdomainname: split it from "hostname", make it independently selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-13 22:35:10 +01:00
Denys Vlasenko
f11c6989ba udhcpc: check read of overload option data byte to be within packet
function                                             old     new   delta
udhcp_get_option                                     220     225      +5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-25 14:26:36 +02:00
Brian Foley
f9beeb22e2 udhcpc: check read of option length byte to be within packet
function                                             old     new   delta
udhcp_get_option                                     215     220      +5
udhcp_run_script                                     802     803      +1

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-25 14:20:55 +02:00
Denys Vlasenko
662634b829 telnetd: ifdef out a buggy error handling code path
Here, not handling the error is would just eat one input 0xff char.
Correct handling would need even more corner case handling,
as-is buggy handling corrupts the buffer.
Since we just been told by kernel that pty is ready,
EAGAIN should not be happening here anyway.

function                                             old     new   delta
telnetd_main                                        1798    1785     -13

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-13 16:17:06 +02:00
Denys Vlasenko
57727d478d telnet: code shrink
put_iac2(w,c) is mostly used with constants, fold them into one arg

function                                             old     new   delta
put_iac2_merged                                        -      46     +46
telnet_main                                         1603    1583     -20
con_escape                                           285     257     -28
put_iac2                                              50       -     -50
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 46/-98)            Total: -52 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12 20:42:58 +02:00
Denys Vlasenko
26d88d6bbd telnetd: add another handshake example in comments, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12 20:09:22 +02:00
Denys Vlasenko
b6d421b635 telnetd: treat all 2-byte IACs in 240..249 range as NOPs.
A bit of future-proofing. Some of them can stand just being ignored.

function                                             old     new   delta
telnetd_main                                        1791    1798      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12 19:41:33 +02:00
Denys Vlasenko
122c47ac02 telnetd: fix corner case of input processing of 0xff bytes
I managed to reproduce the bug, with some difficulty.

function                                             old     new   delta
telnetd_main                                        1780    1791     +11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12 19:13:46 +02:00
Denys Vlasenko
0190c41bb2 telnetd: fix a corner case where CRLF->CR translation can misbehave
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12 17:36:57 +02:00
Denys Vlasenko
2a54b3e86e telnetd: fix handling of short writes to pty
If a write to pty is short, remove_iacs() can be run on a buffer repeatedly.
This, for example, can eat 0xff chars (IACs, in telnet terms).

Rework the logic to handle IACs in a special "write to pty" function.

function                                             old     new   delta
telnetd_main                                        1662    1750     +88

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-12 14:54:10 +02:00
Denys Vlasenko
3720a61daf ifupdown: rewrite state file atomically
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-10-09 23:04:16 +02:00
Denys Vlasenko
ec1ea16337 tcpsvd: don't keep shared fd open if fd limit is reached. closes 9331
Also, much improved help text.

function                                             old     new   delta
packed_usage                                       30652   30851    +199
tcpudpsvd_main                                      1782    1784      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-07 15:56:47 +02:00
Denys Vlasenko
2972e2c4ac wget: there is no -s option in GNU Wget 1.18, we should be compatible
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-04 04:23:09 +02:00
Denys Vlasenko
a85740c8af dhcp: merge leases.c and static_leases.c into dhcpd.c
function                                             old     new   delta
send_offer                                           292     461    +169
udhcpd_main                                         1531    1588     +57
read_leases                                          330     332      +2
add_lease                                            314     312      -2
find_lease_by_mac                                     68       -     -68
find_free_or_expired_nip                             174       -    -174
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 3/1 up/down: 228/-244)          Total: -16 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-04 00:56:58 +02:00
Denys Vlasenko
d2ae66cb3e dhcp: merge most of static_leases.c into dhcpd.c
function                                             old     new   delta
read_staticlease                                     121     222    +101
add_static_lease                                      48       -     -48
log_static_leases                                     68       -     -68
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/0 up/down: 101/-116)          Total: -15 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-04 00:56:58 +02:00
Denys Vlasenko
2bf2931d52 dhcp: merge files.c into dhcpd.c
Added NOINLINE to two function, since my version of gcc would actualy increase
code size otherwise.

I see no size changes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-04 00:56:58 +02:00
Denys Vlasenko
1c32e49bdf traceroute: cleanup and fixes for packet size calculations
Remove FEATURE_TRACEROUTE_SOURCE_ROUTE: it's off by default, and
source routing is not used in real world.

Tested that "traceroute -n ::1 100" and "traceroute -n 127.0.0.1 100"
both send 100 byte IP packets (this matches what traceroute on Fedora
Rawhide is doing).

function                                             old     new   delta
common_traceroute_main                              3731    3738      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-28 18:44:48 +02:00
Denys Vlasenko
bcf47eaa1f ifupdown: improve help text, add comment about run-parts error msg
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-25 02:05:24 +02:00
Denys Vlasenko
92d98f0612 ifupdown: when flushing addresses with "ip", add label %label%
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-09-20 17:31:11 +02:00
Hauke Mehrtens
4ff86df861 libnetlink: fix alignment of netlink messages
A padding to align a message should not only be added between
different attributes of a netlink message, but also at the end of the
message to pad it to the correct size.

Without this patch the following command does not work and returns an
error code:
ip link add type nlmon

Without this ip from busybox sends this:

sendmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000},
	msg_namelen=12, msg_iov=[{iov_base={{len=45, ...},
		"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\22\0\t\0\1nlmon"}, iov_len=45}],
	msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 45
return value: 2

The normal ip utile from iproute2 sends this:

sendmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000},
	msg_namelen=12, msg_iov=[{iov_base={{len=48, ...},
		"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\22\0\t\0\1nlmon\0\0\0"}, iov_len=48}],
	msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 48
return value: 0

With this patch ip from busybox sends this:

sendmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000},
	msg_namelen=12, msg_iov=[{iov_base={{len=48, ...},
		"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\22\0\t\0\1nlmon\0\0\0"}, iov_len=48}],
	msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 48
return value: 0

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-18 22:55:47 +02:00
Denys Vlasenko
ef15970d7e *: placate some compile warnings on OSX
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-01 11:16:22 +02:00
Denys Vlasenko
9ff910de6b wget: treat 201,202,203 as success codes too. Closes 9211
This matches "standard" wget.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-31 13:28:53 +02:00
Peter Korsgaard
b6355e2bb5 udhcpc: Unconditionally call deconfig script, not only if lease is active
The udhcpc script may be used to setup fallback configuration (E.G. IPv4LL,
fixed IP address, ..) that also needs to be cleaned up on release (E.G.
when SIGUSR2 is called or on shutdown with -R), so unconditionally call
deconfig.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-26 18:46:34 +02:00
Denys Vlasenko
de3da6bf87 wget/ssl_helper: update to wolfssl-3.9.8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-21 03:39:39 +02:00
Denys Vlasenko
b11be131b7 ifplugd: if SIOCSIFFLAGS fails with ENODEV, don't die
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-08-16 20:39:52 +02:00
Denys Vlasenko
4548293799 libiproute: eliminate some redundant zero stores
function                                             old     new   delta
do_iprule                                            974     955     -19
rtnl_dump_request                                    173     146     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-46)             Total: -46 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-14 02:08:56 +02:00
Denys Vlasenko
34ecc3b7ae ip: fix an improper optimization: req.r.rtm_scope may be nonzero here
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-14 01:30:34 +02:00
Miroslav Lichvar
150dc7a2b4 ntpd: respond only to client and symmetric active packets
The busybox NTP implementation doesn't check the NTP mode of packets
received on the server port and responds to any packet with the right
size. This includes responses from another NTP server. An attacker can
send a packet with a spoofed source address in order to create an
infinite loop of responses between two busybox NTP servers. Adding
more packets to the loop increases the traffic between the servers
until one of them has a fully loaded CPU and/or network.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-01 20:25:06 +02:00
Denys Vlasenko
ed72761843 wget: run s_client helper with -servername HOST
This is necessary for multi-hosted TLSed web sites.

function                                             old     new   delta
spawn_https_helper_openssl                           334     441    +107

Based on a patch by Jeremy Chadwick <jdc@koitsu.org>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-25 21:34:57 +02:00
Denys Vlasenko
9d20297ba8 ssl_helper.sh: strip was invoked incorrectly
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-25 17:12:46 +02:00
Denys Vlasenko
e695ac97fd typo fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-19 17:48:55 +02:00
Denys Vlasenko
237bedd499 getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST
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>
2016-07-06 21:58:02 +02:00
Denys Vlasenko
0844b5afe2 whois: implement -i
function                                             old     new   delta
whois_main                                           654     675     +21
packed_usage                                       30355   30356      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-06 17:16:27 +02:00
Denys Vlasenko
1035c92e2d whois: make it actually work
It was doing way too simplistic work of just querying the server,
no redirects, no query massaging. This required user to know a lot about whois,
and enter at least three queries for each host to get meaningful information.

function                                             old     new   delta
whois_main                                           209     646    +437

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-06 15:45:41 +02:00
Denys Vlasenko
ee772a0d90 arp: fix buffer overflow. Closes 9071
function                                             old     new   delta
arp_main                                            1910    1898     -12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-04 17:38:01 +02:00
Denys Vlasenko
44399e00ff udhcpc: run "deconfig" script in manual renew state too. closes 9061
The bug was seen when the following is done:

    # killall 1 udhpc; killall 2 udhpc

Performing a DHCP renew
state: 2 -> 5
Sending renew...
Entering released state
state: 5 -> 6  <<<<<<<<<<<<<< not calling script!!!!

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-03 20:26:44 +02:00
Denys Vlasenko
aabb0a93e9 ntpd: daemonize before DNS resolution
This resolves the following use case problem:

"I start ntpd by default from /etc/init.d

There might be no working network connection (not configured properly for
whatever reason, hardware problems, whatelse).

With busybox 1.25 ntpd seems to loop forever if now NTP servers are found,
blocking the boot process  and I never get a login to solve a possible pb or
to do a first time configuration."

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-03 17:58:54 +02:00
Jonas Danielsson
4d5acd2d42 ping: populate icmp_id field for "simple" ping too
The ICMP RFC says that identifier and sequence number may be zero.
Having them zero for a Echo message, along with a data of zero's
as well will result in a Echo reply message with only zero's.

Some NAT implementations seem to get the checksum wrong on these
packages. Setting a checksum of 0x0 instead of 0xffff.

Through NAT:
  Internet Control Message Protocol
      Type: 0 (Echo (ping) reply)
      Code: 0
      Checksum: 0x0000 [incorrect, should be 0xffff]
      Identifier (BE): 0 (0x0000)
      Identifier (LE): 0 (0x0000)
      Sequence number (BE): 0 (0x0000)
      Sequence number (LE): 0 (0x0000)
      Data (56 bytes)
          Data: 000000000000000000000000000000000000000000000000...
          [Length: 56]

Without NAT:
  Internet Control Message Protocol
      Type: 0 (Echo (ping) reply)
      Code: 0
      Checksum: 0xffff [correct]
      Identifier (BE): 0 (0x0000)
      Identifier (LE): 0 (0x0000)
      Sequence number (BE): 0 (0x0000)
      Sequence number (LE): 0 (0x0000)
      [Request frame: 189]
      [Response time: 0.024 ms]
      Data (56 bytes)
          Data: 000000000000000000000000000000000000000000000000...
          [Length: 56]

And this in turn will make some hardware MAC checksum offloading
engines drop the packet.

(This was seen with a Synopsis MAC, the same one used in for instance the
stmmac Ethernet driver in the linux kernel.)

This change can be seen as a workaround for bugs in other layers.
But just setting an identifier for the Echo message packet will
avoid prodding the hornets nest.

function                                             old     new   delta
common_ping_main                                     424     500     +76

Signed-off-by: Jonas Danielsson <jonasdn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-06-23 18:26:32 +02:00
Denys Vlasenko
e4caf1dd9c ntpd: retry initial DNS resolution (forever, no timeout for now).
Some users start ntpd on boot, and don't babysit it. If it dies because
DNS is not yet up and therefore NTP servers can't be found, users are
not happy.

Example behavior with a peer name which can't be resolved:

ntpd: bad address 'qwe.rty.ghj.kl'
...5 sec...
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
...

Based on the patch by Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>

function                                             old     new   delta
resolve_peer_hostname                                  -      81     +81
ntpd_main                                           1130    1061     -69
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 81/-69)             Total: 12 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-06-06 02:26:49 +02:00
Denys Vlasenko
852e8dd734 arping: avoid use of ether_ntoa(). Closes 8926
This is the only non-debug use of ether_ntoa(). By not using it,
we reduce bss:

function                                             old     new   delta
arping_main                                         1568    1665     +97
static.asc                                            18       -     -18
ether_ntoa                                            57       -     -57
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/0 up/down: 97/-75)             Total: 22 bytes
   text    data     bss     dec     hex filename
 911020     493    7352  918865   e0551 busybox_old
 911069     493    7336  918898   e0572 busybox_unstripped

Also, "standard" arping zero-pads MAC. ether_ntoa() does not.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-05-26 21:35:46 +02:00
Szabolcs Nagy
4ab372d49a ip: fix problem on mips64 n64 big endian musl systems
Use designated initializers for struct msghdr.
The struct layout is non-portable and musl libc does not match what busybox expects.

Signed-off-by: Szabolcs Nagy <nsz@port70.net>
Tested-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-24 17:39:02 +02:00
Denys Vlasenko
3e134ebf6a *: slap on a few ALIGN1/2s where appropriate
The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map"

   text	   data	    bss	    dec	    hex	filename
 829901	   4086	   1904	 835891	  cc133	busybox_before
 829665	   4086	   1904	 835655	  cc047	busybox

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-22 18:09:21 +02:00
Denys Vlasenko
df70a43af2 udhcp: add setup_common_bufsiz() as needed
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 18:54:36 +02:00
Denys Vlasenko
9de2e5a222 *: hopefully all setup_common_bufsiz() are in place
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 18:38:51 +02:00
Denys Vlasenko
47cfbf32fd *: add most of the required setup_common_bufsiz() calls
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 18:18:48 +02:00
Denys Vlasenko
e6a2f4cc5a libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for it
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-04-21 17:39:11 +02:00
Denys Vlasenko
f75a96d74c udhcp: fix capitalization of two messages
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 18:49:45 +02:00
Denys Vlasenko
16efe19128 dhcpd: string reuse
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 18:44:52 +02:00
Denys Vlasenko
8f2e99c813 udhcp: get rid of bb_info_msg()
function                                             old     new   delta
udhcpd_main                                         1501    1531     +30
d6_recv_raw_packet                                   251     264     +13
perform_d6_release                                   188     198     +10
udhcpc6_main                                        2443    2449      +6
udhcp_recv_raw_packet                                582     588      +6
udhcp_recv_kernel_packet                             132     138      +6
send_d6_renew                                        140     146      +6
d6_recv_kernel_packet                                118     124      +6
send_renew                                            77      82      +5
send_discover                                         85      90      +5
send_decline                                          84      89      +5
send_d6_select                                        97     102      +5
send_d6_discover                                     174     179      +5
perform_release                                      167     172      +5
count_lines                                           72      74      +2
udhcpc_main                                         2836    2837      +1
bb_info_msg                                          125       -    -125
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 17/4 up/down: 117/-180)         Total: -63 bytes
   text	   data	    bss	    dec	    hex	filename
 924935	    906	  17160	 943001	  e6399	busybox_old
 924736	    906	  17160	 942802	  e62d2	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 18:41:23 +02:00
Denys Vlasenko
cde1199e01 zcip: use bb_error_msg for logging, not bb_info_msg
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 16:22:13 +02:00
Denys Vlasenko
066e76befe Replace a few more bb_info_msg's by bb_error_msg or printf
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 16:20:28 +02:00
Denys Vlasenko
76b680c7a8 Use bb_error_msg instead of bb_info_msg in all commented-out debug printouts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 16:04:37 +02:00
Denys Vlasenko
9844d7e830 Revert "networking: properly initialize ipv6 scope id for printing it"
This reverts commit 2fb63292f7.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-29 19:27:00 +02:00
Timo Teräs
2fb63292f7 networking: properly initialize ipv6 scope id for printing it
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-28 22:16:48 +02:00
Denys Vlasenko
6701e91d84 wget: make -T timeout work on header reads too. Closes 8636
function                                             old     new   delta
set_alarm                                              -      27     +27
fgets_and_trim                                        76      92     +16
wget_main                                           2610    2616      +6
open_socket                                           64      54     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-17 21:52:42 +01:00
Denys Vlasenko
1b7c17391d udhcpc: fix a warning in debug code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-11 00:26:58 +01:00
Denys Vlasenko
d474ffc682 udhcp: fix a SEGV on malformed RFC1035-encoded domain name
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-10 11:47:58 +01:00
Denys Vlasenko
86d9f60f3a udhcpc: do not use -t NUM for counting "select" packets, use 3
Otherwise, "-t 0" usage may end up sending them forever
if server does not respond.

function                                             old     new   delta
udhcpc_main                                         2846    2836     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-04 17:00:56 +01:00
Denys Vlasenko
aee7cd82be ntpd: add experimental patch
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-04 07:36:04 +01:00
Denys Vlasenko
c8641962e4 ntpd: if peer does not reply anymore, try re-resolving its hostname
function                                             old     new   delta
ntpd_main                                           1053    1130     +77
add_peers                                            166     195     +29

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-04 07:26:08 +01:00
Denys Vlasenko
f37f28199f ntpd: do not use a peer more than once (say, if two peers resolve to the same IP)
function                                             old     new   delta
add_peers                                             98     166     +68

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-04 07:06:53 +01:00
Denys Vlasenko
4c48a64747 ntpd: more informative poll lowering message
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-03 22:02:30 +01:00
Denys Vlasenko
35e063e1b9 ifupdowm: fix "warning: unused variable 'iface_list'"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-03 02:19:16 +01:00
Hans Dedecker
abe8f7515a dhcpc: Use client IP address as source address for DHCP renew/rebind messages
RFC2131 paragraph 4.1 states DHCP messages broadcast by a client prior to
that client obtaining its IP address must have the source IP address
field in the header set to 0.
Request messages transmitted in renewing and rebinding state need to use
the obtained IP address as source IP address in the header; this behavior
lines up with other implementations like ISC dhcp client.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-03 02:05:53 +01:00
Christian Lindeberg
ea2b71be66 udhcpd: keep expired leases at startup
Let udhcpd retain the information about expired leases when restarting
so that the leases are reserved until they possibly become the oldest
expired lease.

This reduces the frequency of IP address changes for example when the
DHCP server and a group of clients, who do not store and request their
previously offered IP address across restarts, are collectively restarted
and the startup order of the clients are not guaranteed.

Signed-off-by: Christian Lindeberg <christian.lindeberg@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-01 19:23:22 +01:00
Nicolas Cavallari
e5aba88712 ifupdown: allow duplicate interface definitions
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>
2016-03-01 18:59:08 +01:00
Denys Vlasenko
352f79acbd udhcpc: fix OPTION_6RD parsing (could overflow its malloced buffer)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-26 15:54:56 +01:00
Denys Vlasenko
5bec08cebd udhcp: trivial shrink
function                                             old     new   delta
dname_dec                                            337     332      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-26 14:56:18 +01:00
Denys Vlasenko
03718bb274 ntpd: print packet delay in clock update message
function                                             old     new   delta
update_local_clock                                   820     826      +6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-24 01:22:45 +01:00
Denys Vlasenko
8efcc9589b networking: allow dot at the end of the domain name in dhcp response
Patch based on Balaji Punnuru <balaji.punnuru@gmail.com> work.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-11 17:44:44 +01:00
Denys Vlasenko
383201e725 ntpd: shorter message
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-10 07:06:31 +01:00
Denys Vlasenko
fc47fcefb6 ntpd: step when |offset| > 1 sec, not 0.125 sec
update_local_clock                                   769     820     +51
recv_and_process_peer_pkt                            838     862     +24
reset_peer_stats                                     137     133      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 75/-4)              Total: 71 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-10 06:55:07 +01:00
Felix Fietkau
f2c043acfc busybox: fix uninitialized memory when displaying IPv6 addresses
After commit 8e74adab01
("libbb: make INET[6]_rresolve use sockaddr2{host,dotted}_noport")
INET_sprint6 uses more than just sin6_addr, it also tries to display the
scope id, which is uninitialized when called from ife_print6.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-01 02:20:25 +01:00
Denys Vlasenko
ce4bc1ed04 iproute: support "scope". Closes 8561
function                                             old     new   delta
iproute_modify                                      1051    1120     +69

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-12-30 17:32:51 +01:00
Natanael Copa
1062391365 ifupdown: use -x hostname:NAME with udhcpc
The -H NAME is deprecated in udhcpc. See commit
2017d48c0d

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-31 14:19:06 +01:00
Timo Teräs
028524317d ifupdown: pass interface device name for ipv6 route commands
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-10-26 17:06:12 +01:00
Denys Vlasenko
0269789537 inetd: make FEATURE_INETD_RPC off by default
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-25 20:10:46 +01:00
Ron Yorston
8814431aca libiproute: use if_nametoindex
Saves 87 bytes.  Assuming, of course, all platforms have it.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-24 22:04:36 +02:00
Denys Vlasenko
f98705a00c dumpleases: string reuse
text	   data	    bss	    dec	    hex	filename
 926254	    906	  17160	 944320	  e68c0	busybox_old
 926242	    906	  17160	 944308	  e68b4	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-24 20:45:10 +02:00
Isaac Dunham
d320a1e7a5 dumpleases: new option -d to show time in seconds
function                                             old     new   delta
dumpleases_main                                      493     534     +41
static.dumpleases_longopts                            31      41     +10
packed_usage                                       30777   30752     -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 51/-25)             Total: 26 bytes

Signed-off-by: Isaac Dunham <ibid.ag@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-24 20:28:04 +02:00
Denys Vlasenko
334e12ac6a zcip: ...ad suppress the warning
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-24 19:15:44 +02:00
Denys Vlasenko
49d51598ac zcip: do not query current time if we won't use the result
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-24 19:14:04 +02:00
Denys Vlasenko
9a51217668 dumpleases: make host names sanitized to shell-friendly condition
function                                             old     new   delta
add_lease                                            271     298     +27

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-24 04:45:22 +02:00
Denys Vlasenko
59f8475924 httpd: fix heap buffer overflow. Closes 8426
function                                             old     new   delta
send_headers                                         654     677     +23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-23 11:49:04 +02:00
Denys Vlasenko
92e1b0826d wget: make Bartosz's "wget --passive-ftp -nd -t 3" work
function                                             old     new   delta
static.wget_longopts                                 166     234     +68
wget_main                                           2608    2610      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-20 21:51:52 +02:00
Denys Vlasenko
926d801fa5 libiproute: make rt_addr_n2a() and format_host() return auto strings
function                                             old     new   delta
rt_addr_n2a                                           56      53      -3
print_addrinfo                                      1227    1178     -49
print_neigh                                          933     881     -52
print_rule                                           689     617     -72
print_tunnel                                         640     560     -80
print_route                                         1727    1588    -139
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-395)           Total: -395 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-14 13:56:42 +02:00
Denys Vlasenko
0f296a3a56 libiproute: rename invarg(a,b) to invarg_1_to_2(a,b)
invarg(a,b) - "invalid argument", but how a and b enter the message?

invarg_1_to_2(a,b) is somewhat easier to read: "invalid argument 'a' to 'b'"

Audit of usage revealed a number of bad uses, with too long messages.

   text	   data	    bss	    dec	    hex	filename
 938848	    932	  17448	 957228	  e9b2c	busybox_old
 938788	    932	  17448	 957168	  e9af0	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-14 13:21:01 +02:00
Curt Brune
69934701fd networking: add 'ip neigh' command
This patch ports the 'ip neigh' command, originally written by Alexey
Kuznetsov, <kuznet@ms2.inr.ac.ru>, to busybox.

The base of the port is the version of iproute that shipped with
Debian Squeeze, taken from:

  http://http.debian.net/debian/pool/main/i/iproute/iproute_20100519.orig.tar.gz

This patch has actively been used by the Open Network Install
Environment (ONIE) project for over 3 years without incident.

function                                             old     new   delta
print_neigh                                            -     933    +933
ipneigh_list_or_flush                                  -     742    +742
get_hz                                                 -     109    +109
do_ipneigh                                             -      62     +62
do_iproute                                          2112    2153     +41
packed_usage                                       30647   30667     +20
ipneigh_main                                           -      14     +14
static.ip_neigh_commands                               -      12     +12
static.nuds                                            -       9      +9
static.ip_func_ptrs                                   32      36      +4
print_route                                         1858    1727    -131
------------------------------------------------------------------------------
(add/remove: 8/0 grow/shrink: 3/1 up/down: 1946/-131)        Total: 1815 bytes

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-14 12:53:47 +02:00
Denys Vlasenko
7b85ec30b5 *: more BUILD_BUG_ON conversions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-13 17:17:34 +02:00
Ron Yorston
4d0c1ea478 wget: shrink code if https isn't supported
If FEATURE_WGET_OPENSSL and FEATURE_WGET_SSL_HELPER are both disabled
there's no point in checking for https URLs.

function                                             old     new   delta
P_HTTPS                                                6       -      -6
.rodata                                           155501  155469     -32
parse_url                                            476     423     -53
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-91)             Total: -91 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-13 14:56:22 +02:00
Denys Vlasenko
ab3964db4e libbb: introduce kernel-style BUILD_BUG_ON()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-13 14:50:20 +02:00
Denys Vlasenko
f7ad927c20 ftpd: make DIR parameter work for non-root too: chdir to it instead of chroot
Unfortunately, chroot() works only for root user, because of attacks
on setuid binaries (make DIR/lib/ld-linux.so a shell, hardlink to
a setuid binary, chroot to DIR, execute it and get root shell).

function                                             old     new   delta
ftpd_main                                           2160    2180     +20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-13 13:49:53 +02:00
Denys Vlasenko
6390a3a4e5 whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-13 01:51:37 +02:00
Denys Vlasenko
02859aaeb2 use auto_string() where appropriate to kill a few statics
Custom linker script 'busybox_ldscript' found, using it
function                                             old     new   delta
static.str                                             4       -      -4
static.passwd                                          4       0      -4
bb_ask                                               322     311     -11
ether_print                                           63      47     -16
UNSPEC_print                                          82      66     -16
INET_sprint                                           59      38     -21
INET6_sprint                                          54      30     -24
make_human_readable_str                              292     235     -57
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/7 up/down: 0/-153)           Total: -153 bytes
   text	   data	    bss	    dec	    hex	filename
 939880	    992	  17480	 958352	  e9f90	busybox_old
 939736	    992	  17456	 958184	  e9ee8	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-09 18:16:40 +02:00
Denys Vlasenko
e52da5570e libbb: auto_string() for efficient handling of temporary malloced stirngs
Use it in libiproute: get rid of one static string buffer.

function                                             old     new   delta
auto_string                                            -      51     +51
ll_index_to_name                                      10      49     +39
buffer_fill_and_print                                169     178      +9
scan_recursive                                       378     380      +2
decode_one_format                                    732     734      +2
cmdputs                                              334     332      -2
static.cur_saved                                       4       1      -3
static.nbuf                                           16       -     -16
printable_string                                      94      57     -37
ll_idx_n2a                                            53       -     -53
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 4/3 up/down: 103/-111)           Total: -8 bytes
   text	   data	    bss	    dec	    hex	filename
 939880	    992	  17496	 958368	  e9fa0	busybox_old
 939880	    992	  17480	 958352	  e9f90	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-09 17:59:56 +02:00
Denys Vlasenko
f2bf20f5d5 udhcpc: fix for some Android toolchain breakage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-08 18:13:57 +02:00
Denys Vlasenko
8403b01217 iproute: more string reuse
text	   data	    bss	    dec	    hex	filename
 936892	    932	  17676	 955500	  e946c	busybox_old
 936843	    932	  17676	 955451	  e943b	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-08 17:15:08 +02:00
Christoph J. Thompson
d1eea8db92 iproute: don't hardcode the path to config files
Allows using an alternate path for config files.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Christoph J. Thompson <cjsthompson@gmail.com>
Signed-off-by: Michael Bestas <mikeioannina@gmail.com>
2015-10-08 17:06:06 +02:00
Denys Vlasenko
413feca279 ip: increased max ID for /etc/iproute2/rt_tables to 1023
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-08 15:10:10 +02:00
Denys Vlasenko
3d8d5e8ad4 libiproute: use itoa() where appropriate
function                                             old     new   delta
rtnl_rtprot_a2n                                       31      88     +57
print_tunnel                                         647     640      -7
print_route                                         1865    1858      -7
print_linkinfo                                       820     812      -8
print_addrinfo                                      1241    1227     -14
rtnl_rttable_n2a                                      53      38     -15
rtnl_rtscope_n2a                                      53      38     -15
rtnl_rtrealm_n2a                                      53      38     -15
rtnl_dsfield_n2a                                      61      38     -23
rtnl_rtntype_n2a                                     118      89     -29
print_rule                                           724     689     -35
ipaddr_list_or_flush                                1293    1253     -40
rtnl_rtprot_n2a                                       53       -     -53
rtnl_rtprot_initialize                                63       -     -63
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/11 up/down: 57/-324)         Total: -267 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-08 13:02:28 +02:00
Denys Vlasenko
7f3a2a2256 join some common strings, -400 bytes
function                                             old     new   delta
print_intel_cstates                                  499     511     +12
file_insert                                          355     364      +9
dpkg_main                                           2944    2940      -4
ifenslave_main                                       645     640      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 21/-9)              Total: 12 bytes
   text	   data	    bss	    dec	    hex	filename
 937564	    932	  17676	 956172	  e970c	busybox_old
 937164	    932	  17676	 955772	  e957c	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-08 11:24:44 +02:00
Denys Vlasenko
d60752f8c9 build system: -fno-builtin-printf
Benefits are: drops reference to out-of-line putchar(), fixes a few cases
of failed string merge.

function                                             old     new   delta
i2cdump_main                                        1488    1502     +14
sha256_process_block64                               423     433     +10
sendmail_main                                       1183    1185      +2
list_table                                          1114    1116      +2
i2cdetect_main                                      1235    1237      +2
fdisk_main                                          2852    2854      +2
builtin_type                                         119     121      +2
unicode_conv_to_printable2                           325     324      -1
scan_recursive                                       380     378      -2
mkfs_minix_main                                     2687    2684      -3
buffer_fill_and_print                                178     169      -9
putchar                                              152       -    -152
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 7/4 up/down: 34/-167)          Total: -133 bytes
   text    data     bss     dec     hex filename
 937788     932   17676  956396   e97ec busybox_old
 937564     932   17676  956172   e970c busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07 22:42:45 +02:00
Denys Vlasenko
2007ef5c3c wget: make it possible to have both SSL helpers configured
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07 02:40:53 +02:00
Denys Vlasenko
4271698fea ifplugd: discovered why it needed net/ethernet.h: just for ETH_ALEN
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07 02:02:56 +02:00
Denys Vlasenko
78fb6ea63a ssl_helper: tweaks discovered while building 32-bit version
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07 02:00:11 +02:00
Denys Vlasenko
1c6c670ed4 wget: make openssl/ssl_helper choice configurable
I got sick of not being able to wget a https file...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07 01:39:40 +02:00
Denys Vlasenko
5fa6d1a632 Aboriginal linux/musl build fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-05 11:15:43 +02:00
Denys Vlasenko
5b865deb3f ping: fix recently introduced build breakage for non-optimizing builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-25 16:26:31 +02:00
Alex Dowad
65c501a093 ifupdown: 'prio' should have been 'metric' in static_up and static_up6
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-08-24 20:18:36 +02:00
Denys Vlasenko
c52cbea2bb libbb: add setsockopt_foo helpers
function                                             old     new   delta
setsockopt_int                                         -      23     +23
do_load                                              918     934     +16
setsockopt_SOL_SOCKET_int                              -      14     +14
setsockopt_keepalive                                   -      10     +10
setsockopt_SOL_SOCKET_1                                -      10     +10
buffer_fill_and_print                                169     178      +9
setsockopt_1                                           -       8      +8
nfsmount                                            3560    3566      +6
redirect                                            1277    1282      +5
tcpudpsvd_main                                      1782    1786      +4
d6_send_kernel_packet                                272     275      +3
i2cget_main                                          380     382      +2
ed_main                                             2544    2545      +1
scan_recursive                                       380     378      -2
nbdclient_main                                       492     490      -2
hash_find                                            235     233      -2
cmdputs                                              334     332      -2
parse_command                                       1443    1440      -3
static.two                                             4       -      -4
ntpd_main                                           1039    1035      -4
const_int_1                                            4       -      -4
const_IPTOS_LOWDELAY                                   4       -      -4
RCVBUF                                                 4       -      -4
ntp_init                                             474     469      -5
change_listen_mode                                   316     310      -6
uevent_main                                          416     409      -7
arping_main                                         1697    1690      -7
telnet_main                                         1612    1603      -9
socket_want_pktinfo                                   42      33      -9
setsockopt_reuseaddr                                  21      10     -11
setsockopt_broadcast                                  21      10     -11
httpd_main                                           772     757     -15
get_remote_transfer_fd                               109      94     -15
make_new_session                                     503     487     -16
ftpd_main                                           2177    2160     -17
read_bunzip                                         1896    1866     -30
common_traceroute_main                              4099    4058     -41
common_ping_main                                    1836    1783     -53
------------------------------------------------------------------------------
(add/remove: 5/4 grow/shrink: 8/21 up/down: 111/-283)        Total: -172 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24 20:00:17 +02:00
Denys Vlasenko
2db782bc7b Merge setsockopt error messages
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24 20:00:17 +02:00
Denys Vlasenko
729b70646c traceroute: fix help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24 20:00:17 +02:00
Denys Vlasenko
fb52769f4a arping: make help text clearer
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-16 19:56:16 +02:00
Ron Yorston
72dcbe4df7 ipcalc: fix trivial usage message
Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-15 21:15:27 +02:00
Denys Vlasenko
a83e3ae172 zcip: tweak comments and make unsigned division more obvious
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-04 15:06:38 +02:00
Denys Vlasenko
e347583835 zcip: another code shrink
function                                             old     new   delta
send_arp_request                                       -     185    +185
zcip_main                                           1273    1272      -1
pick_nip                                              40       -     -40
arp                                                  185       -    -185
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 0/1 up/down: 185/-226)          Total: -41 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-04 14:30:31 +02:00
Denys Vlasenko
99e30be38b zcip: code shrink
function                                             old     new   delta
zcip_main                                           1263    1230     -33

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-04 12:28:21 +02:00
Denys Vlasenko
16aa7a73c4 zcip: simplify code
function                                             old     new   delta
zcip_main                                           1411    1263    -148

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-04 03:27:56 +02:00
Arthur Gautier
c29021e2a5 udhcpc: dns labels can actually start with a number
While RFC1035 recommends a label not to start with a number, there is
actually no such limitation in dns. One may buy a domain name like
0x1.net and use it.

This commit remove this check and allow a user to use such domains.

Signed-off-by: Arthur Gautier <baloo@gandi.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-30 03:03:58 +02:00
Ron Yorston
d840c5d139 libbb: add a function to make a copy of a region of memory
Introduce a library routine to package the idiom:

    p = xmalloc(b, n);
    memcpy(p, b, n);

and use it where possible.  The example in traceroute used xzalloc
but it didn't need to.

function                                             old     new   delta
xmemdup                                                -      32     +32
last_main                                            834     826      -8
make_device                                         2321    2311     -10
common_traceroute_main                              3698    3685     -13
readtoken1                                          3182    3168     -14
procps_scan                                         1222    1206     -16
forkchild                                            655     638     -17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/6 up/down: 32/-78)            Total: -46 bytes

Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-19 23:05:20 +02:00
Maninder Singh
97f2f7ca7f Removes stray empty line from code
This patch removes stray empty line from busybox code
reported by script find_stray_empty_lines

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-13 03:25:46 +02:00
Denys Vlasenko
db31c637fa ipaddress: better formatting, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-01 18:36:06 +02:00
Michael Tokarev
6a7cd3d4ab ip addr: support change and replace commands
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-01 18:26:41 +02:00
Maninder Singh
97c6491b4e typo fixes
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-25 13:46:36 +02:00
Denys Vlasenko
b878121e76 tc: fix print_rate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-24 18:01:53 +02:00
Denys Vlasenko
9472e8a86f ftpd: change_identity() must be after chroot()
Otherwise chroot() doesn't work for non-root

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-31 21:46:26 +02:00
Vladislav Grishenko
4d15068d83 zcip: fix wrong comparison of source IP with our IP
Commit "zcip: fix link-local IP conflict detection" has introduced
wrong comparsion of source IP with our IP. This leads to a new IP
being picked unnecessarily on every incoming ARP packet.

Signed-off-by: Vladislav Grishenko <themiron@mail.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-22 17:59:34 +01:00
Denys Vlasenko
6d8ea1d50e ifupdown: shrink a message
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-22 17:08:51 +01:00
Frank Bergmann
6ca03f2dd8 ifupdown: correct ifstate update during 'ifup -a'. Closes 6212
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-22 17:04:27 +01:00
Ron Yorston
8ec1ff350c Use chomp to remove newlines
function                                             old     new   delta
unix_do_one                                          548     540      -8
process_timer_stats                                  508     500      -8
process_irq_counts                                   532     524      -8
lpd_main                                             839     831      -8
hwclock_main                                         502     494      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-50)             Total: -40 bytes

Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-12 20:18:51 +01:00
Denys Vlasenko
8dff01d06a libbb: introduce and use is_prefixed_with()
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>
2015-03-12 17:48:34 +01:00
Alexander Korolkov
748fb60f27 arping: fix iface name in error messages
arping: interface eth0 not found: No such device
                  ^^^^

This is because error template is formed before parsing command line arguments,
so it always uses default interface name "eth0".

Signed-off-by: Alexander Korolkov <alexander.korolkov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-12 13:05:33 +01:00
Denys Vlasenko
3c31b092ac ntpd: tweak help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-05 14:04:44 +01:00
Denys Vlasenko
2ec4f44225 inetd: fix order of array index check and array access
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-03 13:10:30 +01:00
Denys Vlasenko
3aef814c0b ntpd: chnage help text about -l to say that it doesn't disable client code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-02 20:59:13 +01:00
Bernhard Reutner-Fischer
d7bfee1edb wget: fix --header to not append duplicate headers
function                                             old     new   delta
wget_main                                           2551    2715    +164
wget_user_headers                                      -      62     +62
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 226/0)             Total: 226 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-18 20:41:02 +01:00
Denys Vlasenko
54e9585e10 trivial code shrink
function                                             old     new   delta
rdate_main                                           246     251      +5
show_entry                                           291     287      -4
daytime_stream                                        44      39      -5
packed_usage                                       30176   30168      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 5/-17)             Total: -12 bytes
   text	   data	    bss	    dec	    hex	filename
 929453	    932	  17684	 948069	  e7765	busybox_old
 929411	    932	  17684	 948027	  e773b	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-18 13:47:46 +01:00
Denys Vlasenko
a75dcd4353 route: fix bogus read error when route table is empty
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-04 10:40:10 +01:00
Denys Vlasenko
09020b1aa8 route: improve -A inet6
Upstream route command shows non-up routes, it shows reject and nonexthop flags.
And we had "ref" and "use" values mixed up...

function                                             old     new   delta
flagvals                                              32      44     +12
flagchars                                              9      12      +3
INET_setroute                                        767     768      +1
INET6_setroute                                       495     496      +1
set_flags                                             43      39      -4
flags_ipvx                                            16       8      -8
route_main                                           632     623      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/3 up/down: 17/-21)             Total: -4 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-03 19:32:44 +01:00
Denys Vlasenko
a977778893 ifconfig: fix double free fatal error in INET_sprint
Based on the patch by Zheng Junling <zhengjunling@huawei.com>
and Chen Gang <cg.chen@huawei.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-03 12:11:30 +01:00
Martin Kaiser
1cbe93cf4e telnetd: we only need CONFIG_UNIX98_PTYS from the Linux kernel
(re-sending this as it got ignored completey and the format of the
previous mail was probably not correct - please let me know if there's
anything else I can do to get this trivial fix applied)

for telnetd to work, we only need CONFIG_UNIX98_PTYS to be enabled
in the Linux kernel - DEVPTS_FS has been obsolete for some time

Signed-off-by: Martin Kaiser <lists@kaiser.cx>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-30 17:12:38 +01:00
Denys Vlasenko
ff3f3accc6 ntpd: get rid of G.initial_poll_complete
This speeds up syncing - now happens only just
two replies from a peer. Especially useful for "ntpd -q".
Shouldn't have ill effects: if we chose a bad peer,
we will discover it later and switch to another one.

The code is even smaller this way.

Suggested by Miroslav Lichvar <mlichvar@redhat.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-29 16:31:36 +01:00
Denys Vlasenko
936c401077 dhcpd: fix an improper widening conversion
We wanted to detect when tv_sec = unsigned1 - unsigned2
underflows by looking at tv_sec's sign. But if tv_sec
is long and it is wider than unsigned, we get unsigned -> long
conversion which is in this case never negative.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-27 21:59:40 +01:00
Denys Vlasenko
64b744997e ftpd: prevent zombies. closes 7832
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-26 15:45:48 +01:00
Denys Vlasenko
da9212667c libbb: code shrink by factoring out common update_utmp_DEAD_PROCESS
function                                             old     new   delta
update_utmp_DEAD_PROCESS                               -      17     +17
telnetd_main                                        1685    1674     -11
mark_terminated                                       56      45     -11
handle_sigchld                                        74      63     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 15:37:58 +01:00
Denys Vlasenko
08b90a9d10 deleting unused ntpd_simple.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 15:12:37 +01:00
Adam Tkac
4bf88d9094 ntpd: relicense ntpd applet to ISC-style license
OpenNTPd is licensed under ISC-style license so it's good idea to keep
ntpd applet under same license to avoid mess, instead of having
our changes to be under GPL.

Names of original code's authors are added.

Signed-off-by: Adam Tkac <vonsch@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-04 17:46:08 +01:00
John Schroeder
8074a6ca4d udhcpd: account for script delay in lease
Prevent nasty surprises if script runs longer than lease time / 2.

Signed-off-by: John Schroeder <jschroed@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-25 21:12:51 +01:00