Commit Graph

676 Commits

Author SHA1 Message Date
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
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
Denys Vlasenko
28634924f0 udhcpc: account for script run time
Based on the following user report:

I ran into an issue where I was seeing a long delay in the scripts called
in udhcp_run_script. I was using an old version of OpenWrt (kamikaze)
and a satellite modem. An NTP script was being called and the modem
would sometimes take a long time to respond to the DNS lookup when
it was offline.

This delay started affecting my lease time. The lease that I would
get from my satellite modem before it was online would be short:
only 60 seconds. The delay with NTP and the modem would typically
be about 18 seconds. This would cause the first DHCP renew request
from dhcpc to be a little late. Under certain circumstances,
I could even see the first DHCP renew to occur after the lease
had expired!

function                                             old     new   delta
udhcpc_main                                         2816    2837     +21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-21 16:10:22 +01:00
Denys Vlasenko
298fabaefc udhcpd: if a lease from lease file coincides with a static one, ignore it
function                                             old     new   delta
read_leases                                          269     328     +59

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-25 18:49:14 +01:00
Michel Stam
9f41271f3c udhcpd: add option for tweaking arpping
Some clients have a very short timeout for sending the DHCP
DISCOVER, shorter than the arpping timeout of 2000 milliseconds
that udhcpd uses by default.

This patch allows tweaking the timeout, or disabling of arpping
altogether, at the risk of handing out addresses which are
already in use.

function                                             old     new   delta
udhcpd_main                                         1460    1501     +41
udhcpc_main                                         2814    2851     +37
packed_usage                                       29957   29974     +17
arpping                                              477     493     +16
find_free_or_expired_nip                             161     174     +13
send_offer                                           285     292      +7
nobody_responds_to_arp                                85      89      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/0 up/down: 135/0)             Total: 135 bytes

Signed-off-by: Michel Stam <m.stam@fugro.nl>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-10-30 11:59:04 +01:00
Jeremy Kerr
b8ffd11e65 udhcp: add PXELINUX path prefix option (code 210) definition
Like d3092c99, this change adds support for the DHCP "path-prefix"
option, as defined in RFC 5071. We use the string identifer
"pxepathprefix".

Adding this option makes string parsing in the hook scripts simpler.

function                                             old     new   delta
dhcp_option_strings                                  255     269     +14
dhcp_optflags                                         72      74      +2

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-16 14:21:42 +02:00
Denys Vlasenko
85090c162b udhcpc: make hostname sanitization optional. Closes 3979
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-16 00:17:00 +02:00
Denys Vlasenko
e2318bbad7 udhcpc: ignore NAKs from "wrong" servers. Closes 4267
function                                             old     new   delta
udhcpc_main                                         2716    2814     +98

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-27 18:15:50 +01:00
Denys Vlasenko
ffc3a93d0d udhcpc: fix BPF filter. Hopefully fixes the root cause of 4598 and 6746
Use a *signed* large positive value in BPF filter to indicate success.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-19 14:17:11 +01:00
Denys Vlasenko
744ee5db1c udhcpc: in comments, explain the kind of raw socket we create
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-07 17:38:52 +01:00
Denys Vlasenko
e4785ca653 udhcpc: don't use BPF filter, users report problems (bugs 4598, 6746)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-03 18:03:42 +01:00
Jeremy Kerr
d3092c99ae udhcp: add PXELINUX config file option (code 209) definition
This change adds a definition for DHCP option 209. RFC 5071 defines code
209 as a configuration file for a PXE bootloader; this change uses
the string "pxeconffile" as its text identifier.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-12 11:18:26 +01:00
Denys Vlasenko
8d3efaf35e udhcpc: allow zero server-id. Closes 6614.
function                                             old     new   delta
bcast_or_ucast                                         -      47     +47
udhcp_send_kernel_packet                             271     295     +24
udhcpc_main                                         2696    2705      +9
udhcp_send_raw_packet                                456     459      +3
send_release                                          90      76     -14
send_renew                                           105      77     -28
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/2 up/down: 83/-42)             Total: 41 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-03 19:20:54 +01:00
Johannes Stezenbach
2d576e2a22 udhcpc: make DHCP packets to have at least 300 DHCP bytes
Commit b8b72f02 removed all padding from DHCP packets
to fix operation with buggy servers which can't handle
maximum sized packets.  But it introduced a regression
with buggy routers which drop DHCP packets smaller
than 300 bytes (i.e. 342 byte ethernet packets).
Add back some padding to work around.

function                                             old     new   delta
udhcp_send_kernel_packet                             268     292     +24
udhcp_send_raw_packet                                462     473     +11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 35/0)               Total: 35 bytes

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-28 23:27:37 +01:00
Denys Vlasenko
9ae6d79307 udhcpc: tweak help text more
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-08 12:45:45 +02:00
Denys Vlasenko
456687fff1 udhcpc: tweak help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-08 12:33:18 +02:00
Denys Vlasenko
aadb485bd0 udhcpc: tweak help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-05 02:21:36 +02:00
Denys Vlasenko
b443a3780d udhcp: code shrink
function                                             old     new   delta
attach_option                                        416     413      -3
allocate_tempopt_if_needed                            74       -     -74

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-17 15:19:47 +02:00
Denys Vlasenko
c133fa66f3 udhcpc: fix a problem with binary-encoded options #2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-17 15:13:38 +02:00
Denys Vlasenko
7b5d5c1bdb udhcpd: also add -I ADDR to help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-14 02:18:52 +01:00
Denys Vlasenko
e3f5b73ad0 udhcpd: add -I LOCAL_ADDR option
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-13 22:27:37 +01:00
Denys Vlasenko
04ac6e03c3 udhcpc6: fix port numbers used if !FEATURE_UDHCP_PORT
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-28 15:25:35 +01:00
Denys Vlasenko
60cb48ca50 whitespace cleanup. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +01:00
Felix Fietkau
1c7a58dfb8 udhcpc[6]: allow discover_retries == 0 (infinite)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-27 16:22:24 +02:00
Alexey Froloff
3c62bbae94 ushcpc: gracefully handle packets with CHECKSUM_PARTIAL
function                                             old     new   delta
udhcp_recv_raw_packet                                415     579    +164
change_listen_mode                                   317     370     +53
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 217/0)             Total: 217 bytes

Signed-off-by: Alexey Froloff <raorn@raorn.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-17 16:02:44 +02:00
Denys Vlasenko
6567edd10b udhcp[cd]: fix binding to network aliases. Closes 5432, 5438
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-08-10 00:27:22 +02:00
Denys Vlasenko
293c94564c udhcpc: make -O <numeric_opt> work. Closes 5402
function                                             old     new   delta
udhcpc_main                                         2642    2685     +43
udhcp_recv_raw_packet                                414     415      +1
d6_recv_raw_packet                                   248     249      +1
udhcpc6_main                                        2430    2413     -17
add_client_options                                   239     213     -26
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 45/-43)              Total: 2 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-27 13:25:07 +02:00
Denys Vlasenko
5cfb818181 Add yet another missing ALIGN2 on a global declaration.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-26 12:58:41 +02:00
Denys Vlasenko
71045cc819 dhcpd: write lease file on exit
function                                             old     new   delta
udhcpd_main                                         1431    1403     -28

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-24 17:21:26 +02:00
Michael Tokarev
32f774cd34 *: declare strings with ALIGN1, as appropriate
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-24 15:56:37 +02:00
Denys Vlasenko
085b293338 udhcpc[6]: show select timeout in log
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-02 23:53:53 +02:00
Mike Frysinger
3da46c8163 udhcpc6: depend on ipv6
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-02 21:45:35 -04:00
Denys Vlasenko
d2266d43bf udhcpc: fix improper size calculation for OPTION_STRING_HOST
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-22 03:37:01 +02:00
Denys Vlasenko
8cab66730a fix build breakage found by randconfig
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-20 14:48:00 +02:00
Denys Vlasenko
6500d123d0 udhcp: make arpping code resistant to time jumps
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-17 17:10:31 +02:00
Michael McTernan
ee0f444f11 udhcp: finish support of classless static routes (now the correct patch!)
Signed-off-by: Michael McTernan <Michael.McTernan.2001@cs.bris.ac.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-16 17:10:09 +01:00
Denys Vlasenko
7280d2017d udhcpc: sanitize hostnames in incoming packets. Closes 3979.
The following options are replaced with string "bad" if they
contain malformed hostname:
HOST_NAME, DOMAIN_NAME, NIS_DOMAIN, TFTP_SERVER_NAME

function                                             old     new   delta
xmalloc_optname_optval                               850     888     +38
attach_option                                        440     443      +3
len_of_option_as_string                               13      14      +1
dhcp_option_lengths                                   13      14      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 43/0)               Total: 43 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-08 16:41:05 +01:00
Denys Vlasenko
860491c525 udhcpc: shrink code by setting xid more economically
function                                             old     new   delta
send_decline                                          90      82      -8
udhcpc_main                                         2649    2640      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-18 02:09:13 +01:00
Denys Vlasenko
a092a89d8f udhcpc6: rudimentary code to export data to script; fix IAADDR parsing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-16 20:17:12 +01:00
Denys Vlasenko
7e21f0491c udhcpc[6]: tweak help text, remove -B from udhcpc6 and "--version" from both
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-08 11:39:41 +01:00
Denys Vlasenko
2b6a6b90cc udhcpc6: set hop limit to 1 in emitted raw packets
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-07 18:22:06 +01:00
Denys Vlasenko
68c5b28156 udhcpc6: fix endianness
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-07 16:21:24 +01:00
Denys Vlasenko
9ba75048c0 udhcpc6: new applet. Not yet functional.
It builds. It sends Solicit packets. Not sure these packets are well-formed.
I have no server to test it against.

function                                             old     new   delta
udhcpc6_main                                           -    2426   +2426
d6_send_raw_packet                                     -     428    +428
d6_send_kernel_packet                                  -     274    +274
d6_recv_raw_packet                                     -     248    +248
send_d6_discover                                       -     177    +177
packed_usage                                       28795   28966    +171
d6_run_script                                          -     156    +156
send_d6_renew                                          -     140    +140
send_d6_release                                        -     126    +126
d6_recv_kernel_packet                                  -     116    +116
send_d6_select                                         -      95     +95
perform_d6_release                                     -      78     +78
d6_find_option                                         -      74     +74
init_d6_packet                                         -      54     +54
d6_copy_option                                         -      48     +48
d6_mcast_from_client_config_ifindex                    -      42     +42
d6_dump_packet                                         -      24     +24
static.FF02__1_2                                       -      16     +16
d6_store_blob                                          -      13     +13
applet_names                                        2432    2440      +8
applet_main                                         1412    1416      +4
applet_nameofs                                       706     708      +2
add_d6_client_options                                  -       1      +1
------------------------------------------------------------------------------
(add/remove: 21/0 grow/shrink: 4/0 up/down: 4721/0)          Total: 4721 bytes
   text	   data	    bss	    dec	    hex	filename
 879080	    493	   7584	 887157	  d8975	busybox_old
 884585	    497	   7584	 892666	  d9efa	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-07 15:55:39 +01:00
Denys Vlasenko
50089fc61c udhcpc: trim help text, rename badly-named variable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-07 15:44:46 +01:00
Denys Vlasenko
0fd4347ced udhcpc: code shrink
function                                             old     new   delta
udhcpc_main                                         2646    2649      +3
udhcp_run_script                                     816     802     -14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-07 00:54:27 +01:00
Denys Vlasenko
3b46fcb95d udhcpc: remove workaround for bugs in Win98 dhcp server ("MSFT 98" vendor string)
Stats for last three commits:

function                                             old     new   delta
udhcpc_main                                         2635    2646     +11
udhcp_recv_raw_packet                                425     414     -11
udhcp_recv_kernel_packet                             210     134     -76
packed_usage                                       28940   28857     -83
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 11/-170)          Total: -159 bytes
   text    data     bss     dec     hex filename
 879524     493    7584  887601   d8b31 busybox_old
 879340     493    7584  887417   d8a79 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-05 01:26:18 +01:00
Denys Vlasenko
d38ca03946 udhcpc: reuse string constant; remove unneeded memset(0)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-05 01:25:03 +01:00
Denys Vlasenko
2017d48c0d udhcpc: deprecate --hostname NAME
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-05 01:24:14 +01:00
Denys Vlasenko
ee320c6d9c getty: reset tty attrs on Ctrl-C and Ctrl-D too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-23 18:05:58 +02:00
Denys Vlasenko
2af2acf9b5 udhcpc: add comment about server IP
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20 14:47:41 +02:00
Denys Vlasenko
fbca0c68a7 udhcpc: in fill_envp, export BOOTP fields first
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20 14:24:18 +02:00
Denys Vlasenko
cd4d78f525 dhcpc: fix the case where we might add extra space at the end of envvar.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20 13:21:55 +02:00
Denys Vlasenko
1dff672335 udhcpc: fix 6rd option formatting (was using 4 more bytes than there is)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20 12:29:18 +02:00
Denys Vlasenko
42816c204d udhcpc: remove unused argument in sprint_nip6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20 10:52:07 +02:00
Denys Vlasenko
7981d79ef0 udhcpc: small code shrink
function                                             old     new   delta
udhcp_recv_raw_packet                                430     425      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20 10:34:05 +02:00
Denys Vlasenko
f461385521 typo fix in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20 08:54:16 +02:00
Denys Vlasenko
1f56e51ca1 udhcpc: add support for DHCP option 212 (RFC 5969)
The patch is from OpenWRT people.

function                                             old     new   delta
xmalloc_optname_optval                               637     874    +237
dhcp_option_strings                                  237     243      +6
dhcp_optflags                                         68      70      +2
len_of_option_as_string                               12      13      +1
dhcp_option_lengths                                   12      13      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 247/0)             Total: 247 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-19 22:40:35 +02:00
Vladislav Grishenko
6464f15ddb udhcpc: on SIGUSR1, limit renew attempts time to 20 seconds; then do total reconfig
Scenario:

1. udhcpc gets lease for 86400 secs and sleeps for 43200 before renew attempt

2. PC gets physically disconnected and connected to another network

3. some phy control software sends SIGUSR1 to renew the lease, SIGUSR2 isn't
used because newly connected network could be the same as before

4. udhcpc sends unicast renew requests until lease timeout fall to 60 sec.
They are ignored by new network dhcp servers

5. udhcpc sends broadcast rebind requests for 60 seconds, which are NAKed
or ignored too

6. udhcpc deconfigs and starting from discover state, gets new lease for the
new network

So, pt.4+5 it could take up to 86400 secs without correct lease, which is
too long and not acceptable.

Second SIGUSR1 will immediately run into deconfig/discover state, which is
not preferable in case of the same subnet replugged.

This patch makes sure after SIGUSR1 timeout is no more than -A NUM
(usually 20 sec). It means that renew will be requested via broadcast,
and if no replies come back, full deconf/reconf cycle will be initiated
in 20 seconds.

Signed-off-by: Vladislav Grishenko <themiron@mail.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-18 01:37:47 +02:00
Leonid Lisovskiy
6c9c0a1dc9 udhcp: IF_UDHCP_VERBOSE() macro - improve code readability
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-18 00:35:47 +02:00
Baruch Siach
289c47b049 udhcp: remove the declaration of non-existent udhcp_checksum
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-09 11:03:45 +02:00
Baruch Siach
e8f36330d9 networking: consolidate the IP checksum code. -129 bytes.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-07 17:55:40 +02:00
Dan Fandrich
f533ec8767 *: simplify Ethernet header includes
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-10 05:17:59 +02:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Denys Vlasenko
5d3aaceb79 udhcpc: allow -O OPT take numeric params
function                                             old     new   delta
udhcpc_main                                         2623    2654     +31

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-04 05:07:16 +02:00
Denys Vlasenko
7945808c87 udhcp: fix some default values from "" to NULL
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-03 16:46:47 +02:00
Nigel Hathaway
fb6b173ff7 udhcp: add FEATURE_UDHCP_8021Q option
function                                             old     new   delta
dhcp_option_strings                                  217     237     +20
dhcp_optflags                                         64      68      +4

Signed-off-by: Nigel Hathaway <Nigel.Hathaway@ubiquisys.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-26 02:50:00 +02:00
Nigel Hathaway
c37d4c67e8 dhcpc: export unrecognized options in "optNN=XXXXXXXXX" form
function                                             old     new   delta
udhcp_run_script                                     609     818    +209

Signed-off-by: Nigel Hathaway <Nigel.Hathaway@ubiquisys.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-26 02:38:29 +02:00
Pere Orga
5bc8c005a8 move remaining help text from include/usage.src.h
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11 03:29:49 +02:00
Denys Vlasenko
9ac5596a51 udhcpc: emit "correct" secs field
In theory, sending secs set to constant zero should be ok too.
But some bleeping servers can actually be configured to answer ONLY
if secs is bigger than a preset value (!!)
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man8/bootpd.8.html
grep for "reply_threshold_seconds"

function                                             old     new   delta
udhcpc_main                                         2573    2623     +50

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-12 05:37:54 +01:00
Keith Young
e6bb8d339f udhcpc: add -B option
function                                             old     new   delta
udhcpc_longopts                                        -     262    +262
add_client_options                                   218     239     +21
packed_usage                                       28149   28163     +14
static.udhcpc_longopts                               250       -    -250
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/0 up/down: 297/-250)           Total: 47 bytes

Signed-off-by: Keith Young <stripydog7@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-07 03:19:42 +01:00
Denys Vlasenko
e3b1a1fd28 Replace "depends on PLATFORM_LINUX" with "select PLATFORM_LINUX"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-26 22:24:08 +01:00
Vladislav Grishenko
5827167338 udhcpd: optional IP selection based on MAC hash
function                                             old     new   delta
find_free_or_expired_nip                             153     225     +72

Signed-off-by: Vladislav Grishenko <themiron@mail.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-16 13:31:30 +01:00
Vladislav Grishenko
713e6d78e1 udhcpc: use more correct, and more importantly, more understandable BPF code
Signed-off-by: Vladislav Grishenko <themiron@mail.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-14 04:50:30 +01:00
Denys Vlasenko
fbea220560 udhcpc: fix a problem with binary-encoded options
function                                             old     new   delta
attach_option                                        395     413     +18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-06 18:00:58 +01:00
Denys Vlasenko
dd169e8468 eliminate aliasing warnings in traceroute.c and udhcp/socket.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-20 12:13:23 +01:00
Denys Vlasenko
df1689138e remove a few aliasing warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-16 01:25:34 +01:00
Denys Vlasenko
dc7e5c46b0 libbb unicode: comment out usused function and unused parameter
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-11 13:08:28 +01:00
Denys Vlasenko
8993c3f260 udhcpc: document SIGUSRn effect in help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-25 06:21:54 +01:00
Denys Vlasenko
713d241852 dhcpd: reply with NAK to clients in INIT-REBOOT state w/o existing lease
We were not responding to them at all.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28 21:51:44 +01:00
Denys Vlasenko
fa5e295600 dhcpd: smaller code: do not look for REQUESTED_IP twice
text    data     bss     dec     hex filename
 883235     936   17192  901363   dc0f3 busybox_old
 883219     936   17192  901347   dc0e3 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28 01:10:51 +01:00
Denys Vlasenko
e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Denys Vlasenko
0bb35e19a7 udhcpd: reduce stack usage by ~700 bytes. +28 bytes code size
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-21 12:33:10 +02:00
Denys Vlasenko
5d374e9b14 udhcpc: exit if iface disappeared; use correct MAC if it changes
function                                             old     new   delta
udhcpc_main                                         2560    2618     +58

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20 22:26:38 +02:00
Denys Vlasenko
c72c1d7b31 udhcpc: reduce stack usage by de-inlining routines with on-stack pkt buf
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20 22:08:16 +02:00
Denys Vlasenko
a5048fa386 udhcpc: periodically reread our ifindex and mac
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20 21:38:29 +02:00
Denys Vlasenko
b3af65b95d udhcpc: emit maxsize option in all non-NAK type packets
Before, we were sending them only in DISCOVER packets.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20 21:37:23 +02:00
Denys Vlasenko
2c3b71a0d2 dhcp: typo fix: UPD_DHCP_SIZE -> UDP_DHCP_SIZE
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-20 18:04:36 +02:00
Denys Vlasenko
c59e06e471 udhcpc: better help text
function                                             old     new   delta
packed_usage                                       27452   27486     +34

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-20 16:10:59 +02:00
Denys Vlasenko
d3c5ab703b udhcpc: remove now-unneeded definitions of vendor and client-id opts
function                                             old     new   delta
dhcp_optflags                                         68      64      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20 02:03:30 +02:00
Denys Vlasenko
1cbdc03411 udhcpc: remove -c CLIENTID, it is hard to use, -x 61:hexstring does the same better
function                                             old     new   delta
packed_usage                                       27802   27808      +6
static.udhcpc_longopts                               261     250     -11
udhcpc_main                                         2799    2780     -19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 6/-30)             Total: -24 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20 01:42:37 +02:00
Denys Vlasenko
9e244c7600 udhcpc: move usage text to .c file. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20 01:38:56 +02:00
Denys Vlasenko
9ff50b8697 *: deinline SWAP_xE64 on 32-bit CPUs. Wins !90 bytes both on 32 and 64 bits
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-18 11:40:26 +02:00
Denys Vlasenko
b102e12253 *: use SWAP_BE64 instead of open-coding it
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-18 11:39:47 +02:00
Vladislav Grishenko
ad8def2d8a udhcpc: fix OPTION_IP_PAIR parsing
http://git.busybox.net/busybox/commit/?id=7d3a48a003cd645edfae2b404493688022
revealed incorrect OPTION_IP_PAIR implementation, which doesn't respect
option length and causes erroneous classful routes, composed from garbage
or first bytes from the next DHCP packet option.

Signed-off-by: Vladislav Grishenko <themiron@mail.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-17 12:27:50 +02:00
Denys Vlasenko
c0f39b0fb2 dhcprelay: code shrink, and explain its workings a bit more
function                                             old     new   delta
sendto_ip4                                             -      55     +55
dhcprelay_main                                      1059     942    -117
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 55/-117)           Total: -62 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-06 01:45:24 +02:00
Vladislav Grishenko
7d3a48a003 udhcp: add support for 0x21 ROUTES and 0xf9 MS_STATIC_ROUTES options
Signed-off-by: Vladislav Grishenko <themiron@mail.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-09-26 00:15:12 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
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-08-16 20:14:46 +02:00
Denys Vlasenko
58a15cd9d2 Fix a typo in config text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-07 14:02:26 +02:00
Jeremie Koenig
1d7266d3b5 mark Linux-specific configuration options
PLATFORM_LINUX is used as a dependency for applets or features
which require Linux-specific interfaces.

Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:44:56 +02:00
Denys Vlasenko
243d1757d7 remove some dead assignments, add a TODO comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04 04:26:55 +02:00
Denys Vlasenko
dd8adde386 *: introduce and use bb_unsetenv_and_free
function                                             old     new   delta
bb_unsetenv_and_free                                   -      17     +17
tcpudpsvd_main                                      1819    1810      -9
safe_setenv                                           58      47     -11
udhcp_run_script                                     630     616     -14
make_device                                         1683    1663     -20
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/4 up/down: 17/-54)            Total: -37 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-24 05:00:50 +02:00
Denys Vlasenko
d70e0e995e *: add INSERTs to *.src files where appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-08 12:15:11 +02:00
Denys Vlasenko
2f32bf8be6 remove defconfig. Now "make defconfig" simply uses defaults from Config.in
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 04:14:28 +02:00
Denys Vlasenko
da929a95aa mass renaming Kbuild -> Kbuild.src, Config.in -> Config.src
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-04 20:10:51 +02:00
Mike Frysinger
6db1373295 udhcpd: fix daemonize crash on nommu systems
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-06-04 13:24:50 -04:00
Denys Vlasenko
b8b72f02f0 dhcp: truncate packets instead of padding them to 574 bytes. closes bug 1849
function                                             old     new   delta
udhcp_send_raw_packet                                411     456     +45
udhcp_send_kernel_packet                             259     271     +12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-31 00:45:09 +02:00
Denys Vlasenko
e58c6e2e13 dhcp: indicate IP network order in prototypes too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-30 23:43:35 +02:00
Denys Vlasenko
b7d19cc400 dhcp: readability cleanups and small code shrink
function                                             old     new   delta
udhcp_run_script                                     654     617     -37

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-30 23:41:23 +02:00
Denys Vlasenko
fde3fb3009 udhcpd: fix hostname truncation bug 1663
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-02 14:17:07 +02:00
Denys Vlasenko
5ab6b0f563 udhcp: s/sipservers/sipsrv/ to match other similar option names
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-06 16:52:59 +02:00
Denys Vlasenko
f8fcc184b6 udhcpd: note missing sanity checks on INFORM message handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04 22:36:34 +02:00
Denys Vlasenko
4f3aa51f9d udhcp: implement "raw" binary options. Closes bug 735
function                                             old     new   delta
allocate_tempopt_if_needed                             -      76     +76
udhcp_str2optset                                     351     415     +64
attach_option                                        380     398     +18
len_of_option_as_string                               11      12      +1
dhcp_option_lengths                                   11      12      +1
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 160/0)             Total: 160 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04 15:31:12 +02:00
Denys Vlasenko
c03602baa4 udhcp: s/dhcp_option/dhcp_optflag/g
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04 15:28:49 +02:00
Denys Vlasenko
9c0ea86caa udhcpc: trivial shrink
function                                             old     new   delta
udhcpc_main                                         2801    2785     -16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04 02:12:03 +02:00
Denys Vlasenko
243ddcbc76 udhcpd: support decoding of option 120 "SIP servers". Closes bug 737
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-03 17:34:52 +02:00
Denys Vlasenko
8a659f6ff9 libbb: make index_in_substrings return -1 on ambiguous matches
function                                             old     new   delta
index_in_substrings                                   67      93     +26

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-03 00:52:16 +02:00
Denys Vlasenko
c8a2ab1023 dumpleases: better help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-28 00:02:20 +01:00
Denys Vlasenko
406bd14416 udhcpd: fix -v/-P mixup
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-27 23:24:57 +01:00
Denys Vlasenko
9107b63a7f udhcp: abort if we see unknown option, and show valid options if so
function                                             old     new   delta
udhcp_option_idx                                       -      77     +77
udhcp_str2optset                                     366     351     -15
udhcpc_main                                         2845    2801     -44
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 77/-59)             Total: 18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-27 23:23:41 +01:00
Denys Vlasenko
19158a837d unicode: s/FEATURE_ASSUME_UNICODE/UNICODE_SUPPORT, add UNICODE_USING_LOCALE
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 14:06:56 +01:00
Denys Vlasenko
385b4562e3 udhcp: cosmetic cleanups; one case of s/full_read/xread/
function                                             old     new   delta
dumpleases_main                                      632     623      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 10:09:34 +01:00
Denys Vlasenko
7724c766bd udhcp: pass pointer to whole packet to "add option" functions
This is needed for "overflow option" support

function                                             old     new   delta
udhcp_find_option                                      -      34     +34
udhcp_add_binary_option                               94     106     +12
write_leases                                         227     223      -4
udhcp_init_header                                     86      82      -4
send_release                                         104      99      -5
init_packet                                           87      81      -6
add_client_options                                   160     154      -6
add_server_options                                   100      92      -8
udhcpd_main                                         1964    1954     -10
udhcpc_main                                         2859    2837     -22
find_option                                           34       -     -34
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/8 up/down: 46/-99)            Total: -53 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 09:32:09 +01:00
Denys Vlasenko
a8f6b99987 udhcp: move options.c to common.c; disable unused bool and s16 option code
function                                             old     new   delta
udhcp_add_binary_option                                -      94     +94
udhcp_str2nip                                          -      42     +42
len_of_option_as_string                               12      10      -2
dhcp_option_lengths                                   12      10      -2
udhcpc_main                                         2859    2851      -8
read_nip                                              42       -     -42
xmalloc_optname_optval                               590     536     -54
udhcp_str2optset                                     443     366     -77
udhcp_add_option_string                               86       -     -86
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/5 up/down: 136/-271)         Total: -135 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 08:35:24 +01:00
Denys Vlasenko
7e6add1dfc udhcpc: add -x OPT:VAL option
function                                             old     new   delta
udhcp_str2optset                                       -     443    +443
add_client_options                                     -     160    +160
udhcpc_main                                         2753    2857    +104
packed_usage                                       26670   26689     +19
attach_option                                        380     385      +5
udhcpd_main                                         1964    1965      +1
udhcp_add_option_string                               94      86      -8
add_param_req_option                                 128       -    -128
read_opt                                             443       -    -443
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 4/1 up/down: 732/-579)          Total: 153 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-25 20:32:38 +01:00
Denys Vlasenko
3d9c69fb4f udhcp: add testing bits to dns en/decoder
we had two bugs there at least, must have testing

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-24 16:43:16 +01:00
Denys Vlasenko
702f7d6c0b udhcp: we call DNS name encoder with NULL, this can SEGV. added a check
function                                             old     new   delta
dname_enc                                            418     415      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-24 16:11:32 +01:00
Denys Vlasenko
a14a9d73b1 udhcp: fix DNS domanin codec bug: bad compression flag checks
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-24 15:06:23 +01:00
Denys Vlasenko
651a2697f7 *: merge some common strings
text   data    bss    dec    hexfilename
 838650   8009      0 846659  ceb43busybox_old
 838519   8009      0 846528  ceac0busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23 16:25:17 +01:00
Denys Vlasenko
37a658c4c8 udhcp: handle errors in read_staticlease
also gets rid of ether-aton's static buffer in ether-wake:
   text   data    bss    dec    hexfilename
 838664    441   7572 846677  ceb55busybox_old
 838650    441   7564 846655  ceb3fbusybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23 15:43:08 +01:00
Denys Vlasenko
e283413395 udhcp: code shrink
function                                             old     new   delta
attach_option                                          -     380    +380
read_opt                                             859     443    -416
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 380/-416)          Total: -36 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23 04:31:38 +01:00
Denys Vlasenko
6ef8def7cf udhcp: remove two unused fields
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23 02:17:52 +01:00
Denys Vlasenko
6b61629397 udhcp: make rfc derived doc more readable (but it still is contradictory)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-22 15:22:14 +01:00
Denys Vlasenko
dde8bdcc5b udhcp: merge options.h into common.h, script.c into dhcpc.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-22 14:29:13 +01:00
Denys Vlasenko
8d1144565f udhcpc: do not test for srand init, just do it at the start
function                                             old     new   delta
udhcpc_main                                         2855    2867     +12
static.initialized                                     1       -      -1
client_background                                     32      31      -1
perform_release                                      124     122      -2
random_xid                                            38       -     -38
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/2 up/down: 12/-42)            Total: -30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-22 13:44:09 +01:00
Denys Vlasenko
501e35c474 udhcp: merge clientpacket.c into dhcpc.c
function                                             old     new   delta
udhcpc_main                                         2569    2855    +286
perform_release                                      122     124      +2
client_background                                     31      32      +1
init_packet                                          156      88     -68
send_decline                                         114       -    -114
send_discover                                        121       -    -121
send_select                                          130       -    -130
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 3/1 up/down: 289/-433)         Total: -144 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-22 13:43:12 +01:00
Denys Vlasenko
6b24d5354b udhcpc: merge clientsocket.c into dhcpc.c. +4 bytes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-22 13:42:13 +01:00
Denys Vlasenko
53f72bb3f0 dhcpd: apparently, sometimes IP is in ciaddr, not requested_ip...
also revert the part which appempted to "fix" that in client

function                                             old     new   delta
udhcpd_main                                         1949    1964     +15
send_renew                                           142     105     -37
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 15/-37)            Total: -22 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-21 06:46:09 +01:00
Denys Vlasenko
c7dc79e71d udhcpd: untangle incredibly messy handling of DHCPREQUEST
Also fixes attacks possible via DHCPDECLINE / DHCPRELEASE

function                                             old     new   delta
udhcpd_main                                         1846    1949    +103
send_renew                                           105     142     +37
send_NAK                                              61       -     -61
send_ACK                                             180       -    -180
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 2/0 up/down: 140/-241)         Total: -101 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-21 06:15:28 +01:00
Denys Vlasenko
2e7aa92836 udhcp: tweak udhcpd.conf example and comments. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-21 02:22:07 +01:00
Denys Vlasenko
e5ce91b41b udhcp: code shrink; disable time and log server options
function                                             old     new   delta
add_server_options                                     -     100    +100
udhcp_add_simple_option                               92      90      -2
nobody_responds_to_arp                                88      85      -3
dhcp_options                                          66      62      -4
udhcp_add_option_string                              104      94     -10
udhcp_run_script                                     665     654     -11
dhcp_option_strings                                  203     188     -15
static.blank_chaddr                                   16       -     -16
send_ACK                                             211     180     -31
add_bootp_options                                     61       -     -61
udhcpd_main                                         1925    1846     -79
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 0/8 up/down: 100/-232)         Total: -132 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-21 00:43:11 +01:00
Denys Vlasenko
87fa216e1e udhcpc: make it possible to disable vendor id; improve help text
function                                             old     new   delta
init_packet                                          135     139      +4
packed_usage                                       26789   26786      -3
alloc_dhcp_option                                     67      63      -4
udhcpc_main                                         2467    2447     -20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 4/-27)             Total: -23 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-20 18:06:23 +01:00
Denys Vlasenko
0f62c4d065 udhcpd: remove five more options which do not make sense or not supported
requestip, vendorclass, clientid are client-side variables,
          they do not make sense as udhcpd opts
dhcptype  is the packet type (not interesting, it's always 5)
userclass needs parser support in order to work

function                                             old     new   delta
dhcp_options                                          68      66      -2
read_opt                                             865     859      -6
dhcp_option_strings                                  253     203     -50
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-58)             Total: -58 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-20 07:12:21 +01:00
Denys Vlasenko
a953987e77 udhcpd: remove redundant code in send_offer()
static_lease_nip and lease pointer are canculated in the caller,
no need to calculate them again. lease_time_sec calculation
is also redundant: it is assigned to later, w/o being used
in between.

function                                             old     new   delta
udhcpd_main                                         1956    1925     -31

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-20 03:49:27 +01:00
Denys Vlasenko
8a7c166ab9 udhcp: move serverpacket.c into dhcpd.c, no other changes
function                                             old     new   delta
udhcpd_main                                         1480    1956    +476
send_inform                                           83       -     -83
send_offer                                           376       -    -376
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 1/0 up/down: 476/-459)           Total: 17 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-20 03:48:11 +01:00
Denys Vlasenko
777706cb23 udhcp: remove support for some really old and odd options
function                                             old     new   delta
dhcp_options                                          72      68      -4
dhcp_option_strings                                  271     253     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-19 23:42:23 +01:00
Denys Vlasenko
8531d76a15 *: code shrink and better "died from signal" reporting from wait4pid
function                                             old     new   delta
parse                                                964     967      +3
udhcp_run_script                                     670     665      -5
singlemount                                          911     906      -5
mount_it_now                                         360     355      -5
inotifyd_main                                        521     516      -5
xspawn                                                21       -     -21
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/4 up/down: 3/-41)             Total: -38 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-18 22:44:00 +01:00
Denys Vlasenko
2f14263c40 udhcp[cd]: fix aliasing warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-05 15:35:05 +01:00
Denys Vlasenko
12ca080a1c *: eliminate more aliasing warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 18:41:18 +01:00
Denys Vlasenko
e17764c8fb further work on unicodization
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-30 23:16:21 +01:00
Denys Vlasenko
3581c62515 whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-25 13:39:24 +01:00
Denys Vlasenko
9f93d62192 libbb: better unicode width support. Hopefully fixes bug 839.
Also opens up a possibility to make other unicode stuff smaller
and more correct later. but:

function                                             old     new   delta
static.combining                                       -     516    +516
bb_wcwidth                                             -     328    +328
unicode_cut_nchars                                     -     141    +141
mbstowc_internal                                       -      93     +93
in_table                                               -      78     +78
cal_main                                             899     961     +62
static.combining0x10000                                -      40     +40
unicode_strlen                                         -      31     +31
bb_mbstrlen                                           31       -     -31
bb_mbstowcs                                          173     102     -71
------------------------------------------------------------------------------
(add/remove: 7/1 grow/shrink: 1/1 up/down: 1289/-102)        Total: 1187 bytes

Uses code of Markus Kuhn, which is in public domain:
http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
"Permission to use, copy, modify, and distribute this software
 for any purpose and without fee is hereby granted. The author
 disclaims all warranties with regard to this software."

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-24 07:44:03 +01:00
Denys Vlasenko
f2c8aa6676 libbb: introduce and use monotonic_ms
function                                             old     new   delta
monotonic_ms                                           -      60     +60
process_stdin                                        433     443     +10
display_speed                                         85      90      +5
nmeter_main                                          672     674      +2
builtin_type                                         114     116      +2
bb__parsespent                                       117     119      +2
ifplugd_main                                        1110    1109      -1
acpid_main                                           441     440      -1
chat_main                                           1361    1359      -2
doCommands                                          2458    2449      -9
arpping                                              466     450     -16
run_command                                          268     234     -34
readcmd                                             1072    1034     -38
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/7 up/down: 81/-101)           Total: -20 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 12:52:30 +01:00
Denys Vlasenko
cb23d93c68 *: add/remove safe_, it seems we had a few incorrect uses
function                                             old     new   delta
chat_main                                           1359    1361      +2
microcom_main                                        712     713      +1
ifplugd_main                                        1109    1110      +1
arpping                                              465     466      +1
acpid_main                                           440     441      +1
script_main                                         1069    1067      -2
cgi_io_loop_and_exit                                 594     591      -3
telnet_main                                         1475    1469      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/3 up/down: 6/-11)              Total: -5 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 12:29:55 +01:00
Denys Vlasenko
28055028a7 fold: unicode support. Based on a patch by Tomas Heinrich <heinrich.tomas@gmail.com>
General Unicode support is tweaked to expose unicode_status.

function                                             old     new   delta
init_unicode                                           -      77     +77
write2stdout                                           -      19     +19
adjust_column                                         68      71      +3
unicode_status                                         -       1      +1
unicode_is_enabled                                     1       -      -1
grep_main                                            780     773      -7
fold_main                                            619     552     -67
check_unicode_in_env                                  77       -     -77
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 1/2 up/down: 100/-152)          Total: -52 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 20:49:58 +01:00
Denys Vlasenko
4662de0511 replace APP_xxDHCPxx with xxDHCPxx, it's more consistent with the rest
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-11 02:21:10 +01:00
Denys Vlasenko
6331cf059c *: use "can't" instead of "cannot"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-13 09:08:27 +01:00
Tomas Heinrich
85bb843f47 dumpleases: unicode spport
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-05 08:42:47 +01:00
Denys Vlasenko
26c64bade8 udhcpc: log script parameter too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02 18:53:57 +01:00
Denys Vlasenko
219757fee9 udhcpc: fix bug 629: use bcast receive when we perform rebinding
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-08 23:05:46 +02:00
Denys Vlasenko
043b1e5d99 more C standard compat fixes from Dan Fandrich
function                                             old     new   delta
docolon                                              207     204      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06 12:47:55 +02:00
Justin Maggard
aa369e0f0d udhcpc: if got IP successfully, disable -n for future renewals
Signed-off-by: Justin Maggard <jmaggard10@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-13 01:26:17 +02:00
Denys Vlasenko
4abfc2642d udhcpc: small simplification
function                                             old     new   delta
udhcpc_main                                         2401    2398      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-19 04:35:16 +02:00
Denys Vlasenko
753a3ce73e typo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-19 04:27:10 +02:00
Denys Vlasenko
7d6a791ef6 udhcpc: add/edit comments, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-19 04:24:23 +02:00
Denys Vlasenko
13ca4b12e2 udhcpc: simplify manual renew (make it more similar to automatic one)
function                                             old     new   delta
udhcp_run_script                                     669     673      +4
udhcpc_main                                         2414    2401     -13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 4/-13)              Total: -9 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-19 04:07:21 +02:00
Denys Vlasenko
9038d6f8f5 remove trailing whitespace
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-15 20:02:19 +02:00
Denys Vlasenko
860d2bbdda fix fallout from BSD patches
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-10 18:37:06 +02:00
Denys Vlasenko
95cc814dbd udhcpd: fix a bug in add_lease where it was reading at [-1]
It is not correct when we read lease file!

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-07 14:59:30 +02:00
Denys Vlasenko
9b1b62adc4 Patches to enable FreeBSD build
platform.h: fix wrong check for endianness, fix lchown
aliasing to chown on uclibc.

Code seems to not be affected in my testing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-05 03:34:12 +02:00
Denys Vlasenko
97ef65483a udhcpc: support option 0x79 (static routes) (part of bug 341)
function                                             old     new   delta
xmalloc_optname_optval                                 -     583    +583
dhcp_option_strings                                  258     266      +8
dhcp_options                                          70      72      +2
len_of_option_as_string                               11      12      +1
dhcp_option_lengths                                   11      12      +1
udhcp_run_script                                    1187     669    -518
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/1 up/down: 595/-518)           Total: 77 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-03 18:14:03 +02:00
Denys Vlasenko
7895b91743 udhcp: dname_dec may return NULL, account for that case
Other random cleanips included...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-03 16:59:59 +02:00
Denys Vlasenko
4248c33a85 udhcpc: fix a read error loop (e.g.: device is down) blocking TERM
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-26 23:23:16 +02:00
Denys Vlasenko
7a76eba1f6 udhcp: fix trivial compile error
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-19 13:51:29 +02:00
Denys Vlasenko
f3b92d3856 getopt: FEATURE_GETOPT_LONG for -l; rename GETOPT_LONG to LONG_OPTS
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-19 12:10:38 +02:00
Denys Vlasenko
dc36a72ac0 udhcp: cosmetics in arpping.c, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-17 13:56:50 +02:00
Denys Vlasenko
799d00e84c udhcp: convert old-style logging in print_static_leases
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-17 13:44:04 +02:00
Denys Vlasenko
6947d2c7e1 udhcp: logging improvements, field and variable renames
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-17 13:24:03 +02:00
Denys Vlasenko
4945ed32d7 udhcpc: fix format of one log message
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-17 11:58:11 +02:00
Denys Vlasenko
31af3d5a1d udhcp: shorten mac len from 16 to 6 in lease file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-17 11:57:09 +02:00
Denys Vlasenko
ac906fa85e udhcp: change UDHCP_DEBUG into int, make verbosity selectable with -v
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-17 11:54:52 +02:00
Denys Vlasenko
ed8982bfc0 udhcp: add a few TODOs
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-16 12:05:21 +02:00
Denys Vlasenko
26918dd28e udhcp: rename server/client_config.arp to server_mac and client_mac
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-16 12:04:23 +02:00
Denys Vlasenko
cab3a0127c udhcp: cleanup of static lease handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-16 12:03:12 +02:00
Denys Vlasenko
56f2d06c64 udhcp: rename sprintip to sprint_nip, siaddr to siaddr_nip
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-16 10:25:35 +02:00
Denys Vlasenko
990a617edf udhcp: rename giaddr to gateway_nip and server to server_nip
"nip" stands for "IP in network order"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-16 10:23:55 +02:00
Denys Vlasenko
1d924f59b1 udhcp: rename fields in struct dhcpOfferedAddr
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-16 10:23:01 +02:00
Denys Vlasenko
47f2d7ef7d udhcpd: don't fail ARP check if returned MAC matches client's one
Also, do not unicast replies to yiaddr.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-16 10:20:27 +02:00
Denys Vlasenko
d5f1b1bbe0 *: add FAST_FUNC to function ptrs where it makes sense
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>
2009-06-05 12:06:05 +02:00
Denis Vlasenko
5e34ff29bc *: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
2009-04-21 11:09:40 +00:00
Denis Vlasenko
76478b8091 udhcpc: fix truncation of last char in client hostnames 2009-04-21 00:41:57 +00:00
Denis Vlasenko
e8a796828e dhcprelay: fix usage text. Simplify and make code more readable.
Add TODOs.
2009-04-13 03:33:46 +00:00
Denis Vlasenko
f81e8dbc74 *: make "pragma GCC visibility push(hidden)" less ugly 2009-04-09 12:35:13 +00:00
Denis Vlasenko
551ffdccea more of pointless whitespace fixes 2009-04-01 19:48:05 +00:00
Denis Vlasenko
bd79c3d337 dhcpd: remember and record hostnames; optimize get_option
dumpleases: show hostnames

function                                             old     new   delta
add_lease                                            230     292     +62
send_offer                                           403     421     +18
send_ACK                                             232     249     +17
read_leases                                          249     258      +9
dumpleases_main                                      604     609      +5
nobody_responds_to_arp                                84      86      +2
udhcp_end_option                                      32      30      -2
udhcp_get_option                                     222     171     -51
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/2 up/down: 113/-53)            Total: 60 bytes
2009-04-01 12:36:09 +00:00
Denis Vlasenko
a19e64933c docs/logging_and_backgrounding.txt: new mini-doc
dnsd: remove statics, remove nerly-useless SIGINT handler
crond: correct more of logfile to 0666 (as usual, umask allows
 user to remove unwanted bits).
nameif: print errors to stderr too, not just to syslog

function                                             old     new   delta
udhcp_read_interface                                 308     306      -2
ttl                                                    4       -      -4
fileconf                                               4       -      -4
dnsentry                                               4       -      -4
interrupt                                             19       -     -19
dnsd_main                                           1463    1394     -69
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 0/2 up/down: 0/-102)           Total: -102 bytes
   text    data     bss     dec     hex filename
 808161     476    7864  816501   c7575 busybox_old
 807994     468    7856  816318   c74be busybox_unstripped
2009-03-11 14:40:00 +00:00
Denis Vlasenko
5e4fda0aff ftpd: code chrink, fixed some minor bugs
ls: update comment
*: openlog fixes (added LOG_PID, set LOG_DAEMON as appropriate)

function                                             old     new   delta
xwrite_str                                             -      26     +26
cmdio_write_ok                                         -      15     +15
handle_cwd                                            40      45      +5
packed_usage                                       25668   25670      +2
cmdio_write_raw                                        7       9      +2
handle_upload_common                                 322     320      -2
udhcpd_main                                         1375    1372      -3
udhcpc_main                                         2362    2359      -3
port_cleanup                                          27      23      -4
handle_dir_common                                    221     209     -12
str_netfd_write                                       26       -     -26
cmdio_get_cmd_and_arg                                122       -    -122
ftpd_main                                           2208    2050    -158
------------------------------------------------------------------------------
   text    data     bss     dec     hex filename
 809933     476    7864  818273   c7c61 busybox_old
 809199     476    7864  817539   c7983 busybox_unstripped
2009-03-08 23:46:48 +00:00
Denis Vlasenko
04158e0459 udhcpd: add code which rejects lease files with suspicious or old timestamp.
*: s/time(0)/time(NULL)/g
2009-02-02 10:48:06 +00:00
Denis Vlasenko
73121c3c8c dhcpd,dumpleases: write and use 64-bit current time in lease file.
without it, determination of remaining lease time is unreliable.
 Yes, it's costly in code size, but without it, dumpleases output
 is misleading!

function                                             old     new   delta
read_leases                                          143     282    +139
dumpleases_main                                      447     572    +125
write_leases                                         193     233     +40
hton64                                                29      58     +29
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 333/0)             Total: 333 bytes
2009-02-01 00:40:45 +00:00
Denis Vlasenko
ec64a5775e dhcpc: suppress "warning: 'timestamp_before_wait' might be used uninitialized 2009-01-14 00:28:03 +00:00
Denis Vlasenko
0416e3dde1 udhcpd: disable opton to have absolute lease times in lease file
(that does not work with dumpleases)
dumpleases: fix -a option.
networking/udhcp/*: code shrink, more compact static leases struture,
 better comments, etc

function                                             old     new   delta
find_free_or_expired_address                           -     147    +147
nobody_responds_to_arp                                 -      84     +84
read_opt                                             781     830     +49
dumpleases_main                                      435     447     +12
send_ACK                                             229     232      +3
read_staticlease                                      90      93      +3
addStaticLease                                        60      61      +1
getIpByMac                                            46      43      -3
reservedIp                                            31      20     -11
keywords                                             304     288     -16
send_offer                                           428     403     -25
write_leases                                         225     193     -32
read_leases                                          184     143     -41
read_yn                                               64       -     -64
find_address                                         191       -    -191
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 5/6 up/down: 299/-383)          Total: -84 bytes
2009-01-01 17:52:09 +00:00
Denis Vlasenko
76ddc2e3e4 libbb: add bb_unsetenv (taken from hush).
udhcpc: stop filtering environment passed to the script.
crond: fix uncovered potential bug (failing unsetenv)
mdev: fix uncovered potential bug (failing unsetenv)
tcp, udpsvd: fix uncovered potential bug (failing unsetenv)

function                                             old     new   delta
safe_setenv                                            -      58     +58
bb_unsetenv                                            -      55     +55
builtin_unset                                        139     138      -1
tcpudpsvd_main                                      1843    1830     -13
free_strings_and_unsetenv                             87      53     -34
udhcp_run_script                                    1186    1133     -53
safe_setenv4                                          62       -     -62
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/4 up/down: 113/-163)          Total: -50 bytes
2008-12-30 05:05:31 +00:00
Denis Vlasenko
517413f9af bb_info_msg: make it do atomic, unbuffered writes
udhcpc: fix a problem where we don't open listening socket fast enough

function                                             old     new   delta
bb_info_msg                                           70     126     +56
change_listen_mode                                    37      78     +41
udhcp_listen_socket                                  151     124     -27
udhcpc_main                                         2344    2285     -59
2008-12-10 11:16:47 +00:00
Denis Vlasenko
e53738558f *: fix SO_BINDTODEVICE. Kernel wants at least IFNAMSIZ bytes there. 2008-12-10 11:12:16 +00:00
Denis Vlasenko
efb545b9bd optimize 16- and 32-bit moves
function                                             old     new   delta
udhcpd_main                                         1239    1257     +18
udhcp_add_simple_option                               93      92      -1
buffer_read_le_u32                                    19      18      -1
unpack_gz_stream_with_info                           526     520      -6
dnsd_main                                           1470    1463      -7
udhcp_run_script                                    1208    1186     -22
send_ACK                                             255     229     -26
arping_main                                         1661    1623     -38
send_offer                                           470     428     -42
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/8 up/down: 18/-143)          Total: -125 bytes
2008-12-08 22:56:18 +00:00
Denis Vlasenko
db12d1d733 Fix forgotten license comments 2008-12-07 00:52:58 +00:00
Denis Vlasenko
360d9661b6 libbb: add strncpy_IFNAMSIZ
function                                             old     new   delta
...
udhcp_read_interface                                 225     220      -5
brctl_main                                          1151    1146      -5
add_interface                                        109     104      -5
ipaddr_list_or_flush                                2174    2167      -7
do_add_ioctl                                          88      80      -8
vconfig_main                                         249     240      -9
do_del_ioctl                                          78      68     -10
do_iplink                                           1186    1173     -13
do_if_fetch                                          766     753     -13
buffer_fill_and_print                                196     179     -17
parse_args                                          1709    1684     -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/20 up/down: 11/-140)         Total: -129 bytes
2008-12-02 18:18:50 +00:00
Denis Vlasenko
35a064b67f build system: tidying up CONFIG_xxx names (suggested by Rob) 2008-11-06 00:49:59 +00:00
Denis Vlasenko
7ff85c53f1 udhcp: simplify SO_BINDTODEVICE call 2008-10-27 12:56:58 +00:00
Denis Vlasenko
739e30fbc3 udhcp: add inline docs; small code shrink
function                                             old     new   delta
send_packet                                          103      87     -16
udhcpc_main                                         2359    2323     -36
2008-09-26 23:45:20 +00:00
Denis Vlasenko
7d9399e8dc udhcpc: fixlet for previous commit 2008-09-26 22:21:03 +00:00
Denis Vlasenko
c321b51dc6 udhcp: added some FIXMEs; code shrink. -49 bytes 2008-09-26 16:29:12 +00:00
Denis Vlasenko
f1980f67d3 dhcp: add FAST_FUNC as appropriate. -160 bytes. 2008-09-26 09:34:59 +00:00
Denis Vlasenko
cdb0b652dd dhcpc: treat "discover...select...discover..." loop the same way
as "discover...discover...discover..."
2008-09-26 09:34:15 +00:00
Denis Vlasenko
18c93029fd insmod: shrink
function                                             old     new   delta
obj_allocate_commons                                 488     462     -26
insmod_main                                         3830    3714    -116
2008-08-27 22:29:43 +00:00
Denis Vlasenko
084266ed52 fix several problems with config parser:
a bug where it underflows the string
 a bug where it never frees parser_t struct
make read_config() return 0 if parser is NULL,
 make config_close() accept and ignore NULL parser -
 eliminates many if() blocks
reverse the sense of parser bit flags - negative flags
 are harder to grok.
hexdump: revert the change to use config parser, it is BIGGER
 and also requires additional quirks in parser
*: explicitly use PARSER_NORMAL instead of 0

function                                             old     new   delta
login_main                                          1575    1596     +21
config_close                                          18      29     +11
bbunpack                                             383     391      +8
qgravechar                                           106     109      +3
rtnl_tab_initialize                                  121     117      -4
expand                                              1697    1693      -4
man_main                                             717     712      -5
nameif_main                                          674     668      -6
hexdump_main                                         597     591      -6
read_config                                          217     209      -8
dnsd_main                                           1478    1470      -8
sysctl_main                                          203     189     -14
config_open2                                          44      25     -19
make_device                                         1177    1141     -36
config_read                                          597     549     -48
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/11 up/down: 43/-158)         Total: -115 bytes
2008-07-26 23:08:31 +00:00
Denis Vlasenko
5415c856ea libbb: [x]fopen_for_{read,write} introduced and used.
(by Valdimir)

function                                             old     new   delta
config_open2                                           -      41     +41
config_read                                          507     542     +35
find_pair                                            169     187     +18
fopen_for_write                                        -      14     +14
fopen_for_read                                         -      14     +14
find_main                                            406     418     +12
xfopen_for_write                                       -      10     +10
xfopen_for_read                                        -      10     +10
popstring                                            134     140      +6
parse_inittab                                        396     401      +5
next_token                                           923     928      +5
pack_gzip                                           1659    1661      +2
bb__parsespent                                       117     119      +2
fallbackSort                                        1719    1717      -2
evalvar                                             1376    1374      -2
qrealloc                                              36      33      -3
...
...
...
...
singlemount                                         4579    4569     -10
process_stdin                                        443     433     -10
patch_main                                          1111    1101     -10
ifupdown_main                                       2175    2165     -10
file_action_grep                                      90      80     -10
uuidcache_init                                       649     637     -12
hush_main                                            797     785     -12
read_config                                          230     217     -13
dpkg_main                                           3835    3820     -15
read_line_input                                     3134    3110     -24
sysctl_main                                          232     203     -29
config_open                                           40      10     -30
WARN_BAD_LINE                                         44       -     -44
login_main                                          1714    1575    -139
------------------------------------------------------------------------------
(add/remove: 5/1 grow/shrink: 8/74 up/down: 174/-737)        Total: -563 bytes
2008-07-21 23:05:26 +00:00
Denis Vlasenko
eb7512984a udhcp: use libbb for config file parsing (by Vladimir)
function                                             old     new   delta
read_config                                          313     230     -83
2008-07-20 17:58:12 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
7049ff8696 whitespace fixes. no code changes 2008-06-25 09:53:17 +00:00
Denis Vlasenko
dd9c072846 udhcpc: change BPF filter to not use 0xffffffff as a max packet size,
there are kernels which don't like big (negative when viewed as signed)
sizes.
2008-06-20 12:17:59 +00:00
Denis Vlasenko
ff7cd6f925 use USE_FEATURE_UDHCP_PORT instead of ifdef 2008-06-15 09:58:53 +00:00
Denis Vlasenko
f716a6da9a udhcpc: removing stray whitespace 2008-06-15 09:49:21 +00:00
Denis Vlasenko
d50dda8c35 *: use llist_pop for traverse-and-free list operation
function                                             old     new   delta
append_file_list_to_list                             109     111      +2
udhcpc_main                                         2414    2413      -1
run_parts_main                                       325     324      -1
od_main                                             2324    2323      -1
getopt_main                                          709     707      -2
env_main                                             253     251      -2
sed_main                                             659     656      -3
ps_main                                              522     519      -3
traceroute_main                                     3960    3954      -6
sort_main                                            844     838      -6
diff_main                                            866     858      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/10 up/down: 2/-33)            Total: -31 bytes
2008-06-15 05:40:56 +00:00
Denis Vlasenko
873b895d50 udhcpc: reduce ifdef forest, no code changes 2008-06-15 05:40:08 +00:00
Denis Vlasenko
21765fa063 udhcpc: kill undocumented -W, it was a no-op.
fix option parsing in the case some CONFIG_x are off.
 disable -b on NOMMU, make backgrounding work correctly
 (if a bit differently from MMU case). Previously,
 it wasn't working at all.
 stop using global data for flags in main(), opt
 bitfield works as well.

function                                             old     new   delta
cryptpw_main                                         177     153     -24
packed_usage                                       24478   24452     -26
client_background                                     26       -     -26
udhcpc_main                                         2462    2372     -90
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/3 up/down: 0/-166)           Total: -166 bytes
2008-06-13 20:44:05 +00:00
Denis Vlasenko
fc9e108032 udhcpc: shrink
udhcpc: guard against zero lease time

function                                             old     new   delta
timeout                                                4       -      -4
server_addr                                            4       -      -4
requested_ip                                           4       -      -4
perform_release                                      134     112     -22
udhcpc_main                                         2511    2485     -26
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 0/2 up/down: 0/-60)             Total: -60 bytes
2008-05-26 17:32:35 +00:00
Denis Vlasenko
6de8994440 udhcpc: regularize the names of receiving functions,
pause on "serious failure to receive".
Some misc fixes are also folded in here.
2008-05-21 07:05:06 +00:00
Denis Vlasenko
19903f0d44 udhcpc: simplify renewal of the lease 2008-05-21 07:03:03 +00:00
Denis Vlasenko
b23429198e udhcpc: properly reduce timeout if bogus packets were received 2008-05-21 07:02:16 +00:00
Denis Vlasenko
6b06cb80be more of -Wall fixes from Cristian Ionescu-Idbohrn.
Some are fixing real bugs.

function                                             old     new   delta
syslogd_main                                         938     958     +20
get_signum                                           136     143      +7
obj_load                                             777     782      +5
recv_from_to                                         210     214      +4
get_next_block                                      1795    1799      +4
display_topmem_process_list                         1117    1121      +4
logread_main                                         484     487      +3
buffer_fill_and_print                                 73      76      +3
kill_main                                            687     689      +2
ll_remember_index                                    240     241      +1
do_stats                                             452     453      +1
if_readconf                                          166     165      -1
display_process_list                                1192    1191      -1
run_applet_and_exit                                  507     505      -2
print_signames                                        33      31      -2
parse_one_line                                      1092    1090      -2
find_out_spec                                         57      55      -2
add_ksymoops_symbols                                 421     419      -2
ash_main                                            1407    1402      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 11/8 up/down: 54/-17)            Total: 37 bytes
2008-05-15 21:30:45 +00:00
Denis Vlasenko
c4f12f59cc -Wall fixes by Cristian Ionescu-Idbohrn. No object code changes. 2008-05-12 14:35:56 +00:00
Denis Vlasenko
98636eb08c Use intra-DSO calls when we build libbusybox. No-op for normal build.
This was Bernhard Fischer' idea.

   text    data     bss     dec     hex filename
 773549    7781    9740  791070   c121e busybox.t7/0_lib/libbusybox.so.1.11.0.svn_unstripped
 769683    7397    9740  786820   c0184 busybox.t9t/0_lib/libbusybox.so.1.11.0.svn_unstripped
2008-05-09 17:59:34 +00:00
Denis Vlasenko
b89e2027d9 udhcp: protect agianst timer overflowing 32-bit counter
function                                             old     new   delta
arpping                                              398     387     -11
2008-05-09 11:55:58 +00:00
Denis Vlasenko
a4a93fdf18 udhcp: fix config help text 2008-04-21 20:27:29 +00:00
Denis Vlasenko
fcc6347976 udhcp,ipcalc: simple code shrink (Nico Erfurth <masta AT perlgolf.de>)
function                                             old     new   delta
ipcalc_main                                          609     610      +1
read_staticlease                                     102      85     -17
ether_aton                                            17       -     -17
2008-04-10 02:09:40 +00:00
Denis Vlasenko
2e4c3c4cc3 udhcpc: add -o "do not request options by default" switch
(by L. Gabriel Somlo <somlo AT cmu.edu>)

function                                             old     new   delta
udhcpc_main                                         2513    2554     +41
static.udhcpc_longopts                               226     247     +21
add_param_req_option                                 119     132     +13
packed_usage                                       23952   23964     +12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 87/0)               Total: 87 bytes
2008-04-02 13:04:19 +00:00
Denis Vlasenko
95891fc016 openvt: fix gross mismatch between us and "standard" openvt.
standard one even has different syntax!
  std: "openvt -c 12", we: "openvt 12"
  std: "openvt top", we: complain that "top" is not a number.
openvt: implement -c -w -s (-l -f -v are also accepted but ingnored)

openvt_main                                          188     343    +155
vfork_child                                            -      67     +67
not_vt_fd                                              -      23     +23
packed_usage                                       23932   23952     +20
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/0 up/down: 265/0)             Total: 265 bytes
   text    data     bss     dec     hex filename
 801344     641    7380  809365   c5995 busybox_old
 801617     641    7380  809638   c5aa6 busybox_unstripped
2008-03-27 16:26:35 +00:00
Denis Vlasenko
a1acfc8f37 udhcp: build fix for ppc kernel 2.4.36 2008-03-25 06:04:58 +00:00
Denis Vlasenko
c93b162248 patch: shrink by Pascal Bellard <pascal.bellard AT ads-lu.com> (-80 bytes)
*: removal of #include <getopt.h>
2008-03-23 22:55:25 +00:00
Denis Vlasenko
027271e5a9 udhcp: fix wrong order of args here: index_in_strings(opt, dhcp_option_strings);
code shrink while at it:

function                                             old     new   delta
read_config                                          406     323     -83
2008-03-20 12:47:01 +00:00
Denis Vlasenko
1d42665b6b *: shrink: use Vladimir's "o+" specifier instead of xatou(opt_param)
function                                             old     new   delta
getopt32                                            1370    1385     +15
sulogin_main                                         490     494      +4
realpath_main                                         84      86      +2
sleep_main                                            76      77      +1
mt_main                                              256     257      +1
printenv_main                                         75      74      -1
fdformat_main                                        546     545      -1
usleep_main                                           44      42      -2
setlogcons_main                                       77      75      -2
ed_main                                             2654    2649      -5
deallocvt_main                                        69      64      -5
addgroup_main                                        373     368      -5
mkfs_minix_main                                     2989    2982      -7
tail_main                                           1221    1213      -8
sv_main                                             1254    1241     -13
du_main                                              348     328     -20
tftp_main                                            325     302     -23
split_main                                           581     558     -23
nc_main                                             1000     977     -23
diff_main                                            891     868     -23
arping_main                                         1797    1770     -27
ls_main                                              893     847     -46
od_main                                             2797    2750     -47
readprofile_main                                    1944    1895     -49
tcpudpsvd_main                                      1973    1922     -51
udhcpc_main                                         2590    2513     -77
grep_main                                            824     722    -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/22 up/down: 23/-560)         Total: -537 bytes
   text    data     bss     dec     hex filename
 796973     658    7428  805059   c48c3 busybox_old
 796479     662    7420  804561   c46d1 busybox_unstripped
2008-03-17 09:09:09 +00:00
Denis Vlasenko
62a90cdd74 *: shrink by using [f]open_or_warn_stdin where appropriate
function                                             old     new   delta
lsattr_main                                           62     143     +81
open_or_warn_stdin                                     -      36     +36
fclose_if_not_stdin                                   20      47     +27
xfopen_stdin                                           -      20     +20
tac_main                                             336     356     +20
cksum_main                                           249     259     +10
bb_argv_dash                                           -       8      +8
su_main                                              448     455      +7
cmp_main                                             630     633      +3
passwd_main                                         1072    1074      +2
uudecode_main                                        317     315      -2
text_yank                                            110     108      -2
handle_incoming_and_exit                            2653    2651      -2
flags                                                  5       1      -4
write_leases                                         235     230      -5
fopen_or_warn_stdin                                   48      42      -6
fold_main                                            648     642      -6
static.argv_dash                                       8       -      -8
sum_main                                             142     128     -14
tail_main                                           1237    1221     -16
sed_main                                             711     695     -16
cmp_xfopen_input                                      17       -     -17
bb_cat                                               113      96     -17
catv_main                                            328     306     -22
strings_main                                         457     434     -23
hash_file                                            298     274     -24
sum_file                                             353     325     -28
sort_main                                            904     859     -45
expand_main                                          736     686     -50
cut_main                                            1116    1065     -51
md5_sha1_sum_main                                    549     493     -56
lsattr_args                                           90       -     -90
read_stduu                                           408     255    -153
------------------------------------------------------------------------------
(add/remove: 3/3 grow/shrink: 7/20 up/down: 214/-657)        Total: -443 bytes
   text    data     bss     dec     hex filename
 797417     658    7428  805503   c4a7f busybox_old
 796973     658    7428  805059   c48c3 busybox_unstripped
2008-03-17 09:07:36 +00:00
Denis Vlasenko
85c247161b *: fix fallout from -Wunused-parameter
function                                             old     new   delta
bbunpack                                             358     366      +8
passwd_main                                         1070    1072      +2
handle_incoming_and_exit                            2651    2653      +2
getpty                                                88      86      -2
script_main                                          975     972      -3
inetd_main                                          2036    2033      -3
dname_enc                                            377     373      -4
make_new_session                                     474     462     -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/5 up/down: 12/-24)            Total: -12 bytes
   text    data     bss     dec     hex filename
 797429     658    7428  805515   c4a8b busybox_old
 797417     658    7428  805503   c4a7f busybox_unstripped
2008-03-17 09:04:04 +00:00
Denis Vlasenko
68404f13d4 *: add -Wunused-parameter; fix resulting breakage
function                                             old     new   delta
procps_scan                                         1265    1298     +33
aliascmd                                             278     283      +5
parse_file_cmd                                       116     120      +4
dname_enc                                            373     377      +4
setcmd                                                90      93      +3
execcmd                                               57      60      +3
count_lines                                           72      74      +2
process_command_subs                                 340     339      -1
test_main                                            409     407      -2
mknod_main                                           179     177      -2
handle_incoming_and_exit                            2653    2651      -2
argstr                                              1312    1310      -2
shiftcmd                                             131     128      -3
exitcmd                                               46      43      -3
dotcmd                                               297     294      -3
breakcmd                                              86      83      -3
evalpipe                                             353     349      -4
evalcommand                                         1180    1176      -4
evalcmd                                              109     105      -4
send_tree                                            374     369      -5
mkfifo_main                                           82      77      -5
evalsubshell                                         152     147      -5
typecmd                                               75      69      -6
letcmd                                                61      55      -6
add_cmd                                             1190    1183      -7
main                                                 891     883      -8
ash_main                                            1415    1407      -8
parse_stream                                        1377    1367     -10
alloc_procps_scan                                     55       -     -55
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148)          Total: -94 bytes
   text    data     bss     dec     hex filename
 797195     658    7428  805281   c49a1 busybox_old
 797101     658    7428  805187   c4943 busybox_unstripped
2008-03-17 09:00:54 +00:00
Denis Vlasenko
a523e2efad udhcp: we were forgetting to set right op byte in tha packet
for DHCPDECLINE. Fixing, and making code smaller.
2008-02-20 22:33:38 +00:00
Denis Vlasenko
84da0bf475 udhcp: make paths configurable
syslogd: trivial build fix
2008-02-20 22:29:52 +00:00
Denis Vlasenko
25591c322c libbb: introduce bb_signals and bb_signals_recursive,
which sets same handler for many signals. sig_catch is nuked
(bb_signals_recursive is more descriptive name).
*: use them as appropriate. 

function                                             old     new   delta
bb_signals_recursive                                   -      95     +95
bb_signals                                             -      52     +52
run_command                                          258     273     +15
svlogd_main                                         1368    1377      +9
runsv_main                                          1746    1752      +6
runsvdir_main                                       1643    1646      +3
UNSPEC_print                                          64      66      +2
time_main                                           1128    1127      -1
...
resize_main                                          246     210     -36
sig_catch                                             63       -     -63
set_fatal_sighandler                                  85      14     -71
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 5/24 up/down: 182/-548)        Total: -366 bytes
2008-02-16 22:58:56 +00:00
Denis Vlasenko
3718832a15 *: more readable handling of pipe fds. No code changes. 2008-02-16 13:20:56 +00:00
Denis Vlasenko
b386c1c614 udhcp: ifdef out unused members 2008-02-04 13:23:53 +00:00
Denis Vlasenko
d55fe3e595 udhcp: optional support for non-standard DHCP ports (+300 bytes when selected) 2008-02-04 13:12:16 +00:00