Commit Graph

631 Commits

Author SHA1 Message Date
Denys Vlasenko
de6cb41734 udhcpc[6]: fix messages referring to select() while we use poll()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-24 12:01:28 +02:00
Denys Vlasenko
168f0ef8dd udhcpc[6]: on log level 1, three messages about raw socket is overkill
Move first two messages to log2 level:

08:46:32.23824 udhcpc: opening raw socket on ifindex 2
08:46:32.23825 udhcpc: got raw socket fd
08:46:32.26354 udhcpc: created raw socket

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21 12:04:22 +02:00
Denys Vlasenko
72089cf6b4 config: deindent all help texts
Those two spaces after tab have no effect, and always a nuisance when editing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21 09:50:55 +02:00
Denys Vlasenko
4eed2c6c50 Update menuconfig items with approximate applet sizes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18 22:01:24 +02:00
Denys Vlasenko
4ee824f6ba randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-03 01:22:13 +02:00
Denys Vlasenko
ba4fbca8a8 udhcpc6: make -O OPT work
Patch is based on work by tiggerswelt.net.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-06-28 19:18:17 +02:00
Denys Vlasenko
470bebe672 udhcpc6: add comments about option 39, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-06-27 18:31:08 +02:00
Denys Vlasenko
234b82ca19 udhcpc6: add support for timezones
Basedon patch by Bernd Holzmüller <bernd.holzmueller@tiggerswelt.net>

function                                             old     new   delta
option_to_env                                        504     580     +76

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-06-26 19:42:48 +02:00
Denys Vlasenko
ed820ccda1 udhcpc: do not accept --background on NOMMU (same as -b)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-05-08 15:11:02 +02:00
Denys Vlasenko
741bfa9a72 udhcpc: fix "udhcpc -x hostname:<name> not working on nommu"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-05-08 15:02:07 +02:00
Denys Vlasenko
10ad622dc2 Spelling fixes in comments, documentation, tests and examples
By klemens <ka7@github.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-17 16:13:32 +02:00
Denys Vlasenko
ab03061615 udhcp6: move misplaced comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-27 22:49:12 +02:00
Denys Vlasenko
ed898ed2dd udhcp6: fix releasing
Patch is based on work by tiggerswelt.net. They say:
"
We wanted udhcpc6 to release its IPv6-Addresses on
quit (-R-commandline-option) which turned out to generate once again
kind of garbage on the network-link.
We tracked this down to two issues:

 - udhcpc6 uses a variable called "srv6_buf" to send packets to
   the dhcp6-server, but this variable is never initialized correctly
   and contained kind of a garbage-address

 - The address of the dhcp6-server is usually a link-local-address,
   that requires an interface-index when using connect() on an AF_INET6-
   socket

We added an
additional parameter for ifindex to d6_send_kernel_packet() and made
d6_recv_raw_packet() to capture the address of the dhcp6-server and
forward it to its callee.
"

Three last patches together:

function                                             old     new   delta
d6_read_interface                                      -     454    +454
d6_recv_raw_packet                                     -     283    +283
option_to_env                                        249     504    +255
.rodata                                           165226  165371    +145
send_d6_discover                                     195     237     +42
send_d6_select                                       118     159     +41
send_d6_renew                                        173     186     +13
send_d6_release                                      162     173     +11
opt_req                                                -      10     +10
d6_send_kernel_packet                                304     312      +8
opt_fqdn_req                                           -       6      +6
d6_mcast_from_client_config_ifindex                   48      51      +3
d6_find_option                                        63      61      -2
udhcpc6_main                                        2416    2411      -5
static.d6_recv_raw_packet                            266       -    -266
------------------------------------------------------------------------------
(add/remove: 5/1 grow/shrink: 8/2 up/down: 1271/-273)         Total: 998 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-27 22:44:22 +02:00
Denys Vlasenko
64d58aa806 udhcp6: fix problems found running against dnsmasq
Patch is based on work by tiggerswelt.net. They say:
"
But when we tried to use dnsmasq on server-side, udhcpc6 was unable to
forward the acquired address to its setup-script although the
IPv6-Address had been assigned by the server as we could see via
tcpdump. We traced this issue down to a problem on how udhcpc6 parses
DHCPv6-Options: When moving to next option, a pointer-address is
increased and a length buffer is decreased by the length of the option.
The problem is that it is done in this order:

  option += 4 + option[3];
  len_m4 -= 4 + option[3];

But this has to be switched as the length is decreased by the length of
the *next* option, not the current one. This affected both - internal
checks if a required option is present and the function to expose
options to the environment of the setup-script.
There was also a bug parsing D6_OPT_STATUS_CODE Options, that made
dnsmasq not work as udhcpc6 thought it is receiving a non-positive
status-code (because it did not parse the status-code as required in RFC
3315).
In addition we introduced basic support for RFC 3646 (OPTION_DNS_SERVERS
and OPTION_DOMAIN_LIST) and RFC 4704 (OPTION_CLIENT_FQDN).
"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-27 22:41:59 +02:00
Denys Vlasenko
e09f5e3045 udhcp6: read_interface should save link-local ipv6 address
Patch is based on work by tiggerswelt.net. They say:
"Using this patch it was no problem to acquire an IPv6-Address via DHCPv6
using ISC DHCPD6 on server-side."

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-27 22:41:59 +02:00
Denys Vlasenko
7c67f1e9ab udhcpc: make sure we do not overflow poll timeout
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-17 19:20:32 +01:00
Denys Vlasenko
52a515d187 udhcp: use poll() instead of select()
function                                             old     new   delta
udhcp_sp_read                                         65      46     -19
udhcp_sp_fd_set                                       79      54     -25
udhcpd_main                                         1530    1482     -48
udhcpc_main                                         2780    2730     -50
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-142)           Total: -142 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-16 23:25:44 +01:00
Denys Vlasenko
dc207f6696 udhcp: do not clobber errno by signal handler
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-16 20:04:19 +01:00
Denys Vlasenko
b181ca7552 typo in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-29 18:48:58 +01:00
Denys Vlasenko
bbc7bee966 make --help texts more uniform
function                                             old     new   delta
packed_usage                                       31062   31035     -27

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-21 02:49:58 +01:00
Denys Vlasenko
f560422fa0 Big cleanup in config help and description
Redundant help texts (one which only repeats the description)
are deleted.

Descriptions and help texts are trimmed.

Some config options are moved, even across menus.

No config option _names_ are changed.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10 14:58:54 +01:00
Denys Vlasenko
c6137ba510 udhcp: tweak config order and menu item names
All other applets are listed simply by their name, no reason why
dumpleases doesn't do that.

Group all udhcpd feature options directly after it.

Put "NOT READY" into udhcpc6 item (some users actually tried to use it,
and complained).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-04 12:13:38 +01:00
Denys Vlasenko
9cc3d3ab21 fix breakage found by mass one-applet builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-23 02:42:26 +01:00
Denys Vlasenko
f7683cdf83 Convert all udhcp applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 18:54:59 +01:00
Denys Vlasenko
f11c6989ba udhcpc: check read of overload option data byte to be within packet
function                                             old     new   delta
udhcp_get_option                                     220     225      +5

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

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-25 14:20:55 +02:00
Denys Vlasenko
a85740c8af dhcp: merge leases.c and static_leases.c into dhcpd.c
function                                             old     new   delta
send_offer                                           292     461    +169
udhcpd_main                                         1531    1588     +57
read_leases                                          330     332      +2
add_lease                                            314     312      -2
find_lease_by_mac                                     68       -     -68
find_free_or_expired_nip                             174       -    -174
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 3/1 up/down: 228/-244)          Total: -16 bytes

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

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

I see no size changes.

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

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-26 18:46:34 +02:00
Denys Vlasenko
237bedd499 getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST
In many cases, this aqllows to drop use of opt_complementary.
Approximately -400 bytes:

function                                             old     new   delta
getopt32                                            1423    1502     +79
opt_string                                            17      18      +1
OPT_STR                                               24      25      +1
uniq_main                                            416     406     -10
timeout_main                                         279     269     -10
sulogin_main                                         270     260     -10
readprofile_main                                    1825    1815     -10
ps_main                                              543     533     -10
pidof_main                                           245     235     -10
pgrep_main                                           611     601     -10
od_main                                             2600    2590     -10
mkfs_minix_main                                     2684    2674     -10
mkfs_ext2_main                                      2603    2593     -10
microcom_main                                        712     702     -10
makemime_main                                        315     305     -10
ionice_main                                          282     272     -10
inetd_main                                          2074    2064     -10
ifplugd_main                                        1144    1134     -10
halt_main                                            353     343     -10
getopt_main                                          636     626     -10
fdisk_main                                          2854    2844     -10
env_main                                             206     196     -10
dmesg_main                                           319     309     -10
conspy_main                                         1214    1204     -10
awk_main                                             981     971     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/22 up/down: 81/-220)         Total: -139 bytes
   text	   data	    bss	    dec	    hex	filename
 919373	    906	  14060	 934339	  e41c3	busybox_old
 918969	    906	  14060	 933935	  e402f	busybox_unstripped

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

    # killall 1 udhpc; killall 2 udhpc

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

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-03 20:26:44 +02:00
Denys Vlasenko
3e134ebf6a *: slap on a few ALIGN1/2s where appropriate
The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map"

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

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-22 18:09:21 +02:00
Denys Vlasenko
df70a43af2 udhcp: add setup_common_bufsiz() as needed
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 18:54:36 +02:00
Denys Vlasenko
47cfbf32fd *: add most of the required setup_common_bufsiz() calls
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 18:18:48 +02:00
Denys Vlasenko
e6a2f4cc5a libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for it
The config item is FEATURE_USE_BSS_TAIL. When it is off (default):

function                                             old     new   delta
read_config                                          210     228     +18
doCommands                                          2279    2294     +15
ipneigh_list_or_flush                                763     772      +9
ipaddr_list_or_flush                                1256    1261      +5
display_process_list                                1301    1306      +5
conspy_main                                         1378    1383      +5
do_lzo_compress                                      352     355      +3
do_lzo_decompress                                    565     567      +2
push                                                  46      44      -2
inetd_main                                          2136    2134      -2
uevent_main                                          421     418      -3
addLines                                              97      92      -5
bb_common_bufsiz1                                   8193    1024   -7169
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/5 up/down: 62/-7181)        Total: -7119 bytes
   text	   data	    bss	    dec	    hex	filename
 829850	   4086	   9080	 843016	  cdd08	busybox_old
 829901	   4086	   1904	 835891	  cc133	busybox_unstripped

FEATURE_USE_BSS_TAIL=y:

read_config                                          210     228     +18
doCommands                                          2279    2294     +15
ipneigh_list_or_flush                                763     772      +9
ipaddr_list_or_flush                                1256    1261      +5
display_process_list                                1301    1306      +5
conspy_main                                         1378    1383      +5
do_lzo_compress                                      352     355      +3
do_lzo_decompress                                    565     567      +2
inetd_main                                          2136    2134      -2
bb_common_bufsiz1                                   8193       -   -8193
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 8/1 up/down: 62/-8195)        Total: -8133 bytes
   text	   data	    bss	    dec	    hex	filename
 829850	   4086	   9080	 843016	  cdd08	busybox_old
 829911	   4086	    880	 834877	  cbd3d	busybox_unstripped

FIXME: setup_common_bufsiz() calls are missing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 17:39:11 +02:00
Denys Vlasenko
f75a96d74c udhcp: fix capitalization of two messages
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 18:49:45 +02:00
Denys Vlasenko
16efe19128 dhcpd: string reuse
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 18:44:52 +02:00
Denys Vlasenko
8f2e99c813 udhcp: get rid of bb_info_msg()
function                                             old     new   delta
udhcpd_main                                         1501    1531     +30
d6_recv_raw_packet                                   251     264     +13
perform_d6_release                                   188     198     +10
udhcpc6_main                                        2443    2449      +6
udhcp_recv_raw_packet                                582     588      +6
udhcp_recv_kernel_packet                             132     138      +6
send_d6_renew                                        140     146      +6
d6_recv_kernel_packet                                118     124      +6
send_renew                                            77      82      +5
send_discover                                         85      90      +5
send_decline                                          84      89      +5
send_d6_select                                        97     102      +5
send_d6_discover                                     174     179      +5
perform_release                                      167     172      +5
count_lines                                           72      74      +2
udhcpc_main                                         2836    2837      +1
bb_info_msg                                          125       -    -125
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 17/4 up/down: 117/-180)         Total: -63 bytes
   text	   data	    bss	    dec	    hex	filename
 924935	    906	  17160	 943001	  e6399	busybox_old
 924736	    906	  17160	 942802	  e62d2	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 18:41:23 +02:00
Denys Vlasenko
76b680c7a8 Use bb_error_msg instead of bb_info_msg in all commented-out debug printouts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 16:04:37 +02:00
Denys Vlasenko
1b7c17391d udhcpc: fix a warning in debug code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-11 00:26:58 +01:00
Denys Vlasenko
d474ffc682 udhcp: fix a SEGV on malformed RFC1035-encoded domain name
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-10 11:47:58 +01:00
Denys Vlasenko
86d9f60f3a udhcpc: do not use -t NUM for counting "select" packets, use 3
Otherwise, "-t 0" usage may end up sending them forever
if server does not respond.

function                                             old     new   delta
udhcpc_main                                         2846    2836     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-04 17:00:56 +01:00
Hans Dedecker
abe8f7515a dhcpc: Use client IP address as source address for DHCP renew/rebind messages
RFC2131 paragraph 4.1 states DHCP messages broadcast by a client prior to
that client obtaining its IP address must have the source IP address
field in the header set to 0.
Request messages transmitted in renewing and rebinding state need to use
the obtained IP address as source IP address in the header; this behavior
lines up with other implementations like ISC dhcp client.

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

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

Signed-off-by: Christian Lindeberg <christian.lindeberg@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-01 19:23:22 +01:00
Denys Vlasenko
352f79acbd udhcpc: fix OPTION_6RD parsing (could overflow its malloced buffer)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-26 15:54:56 +01:00
Denys Vlasenko
5bec08cebd udhcp: trivial shrink
function                                             old     new   delta
dname_dec                                            337     332      -5

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

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-11 17:44:44 +01:00
Denys Vlasenko
f98705a00c dumpleases: string reuse
text	   data	    bss	    dec	    hex	filename
 926254	    906	  17160	 944320	  e68c0	busybox_old
 926242	    906	  17160	 944308	  e68b4	busybox_unstripped

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

Signed-off-by: Isaac Dunham <ibid.ag@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-24 20:28:04 +02:00
Denys Vlasenko
9a51217668 dumpleases: make host names sanitized to shell-friendly condition
function                                             old     new   delta
add_lease                                            271     298     +27

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-24 04:45:22 +02:00
Denys Vlasenko
f2bf20f5d5 udhcpc: fix for some Android toolchain breakage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-08 18:13:57 +02:00
Denys Vlasenko
c52cbea2bb libbb: add setsockopt_foo helpers
function                                             old     new   delta
setsockopt_int                                         -      23     +23
do_load                                              918     934     +16
setsockopt_SOL_SOCKET_int                              -      14     +14
setsockopt_keepalive                                   -      10     +10
setsockopt_SOL_SOCKET_1                                -      10     +10
buffer_fill_and_print                                169     178      +9
setsockopt_1                                           -       8      +8
nfsmount                                            3560    3566      +6
redirect                                            1277    1282      +5
tcpudpsvd_main                                      1782    1786      +4
d6_send_kernel_packet                                272     275      +3
i2cget_main                                          380     382      +2
ed_main                                             2544    2545      +1
scan_recursive                                       380     378      -2
nbdclient_main                                       492     490      -2
hash_find                                            235     233      -2
cmdputs                                              334     332      -2
parse_command                                       1443    1440      -3
static.two                                             4       -      -4
ntpd_main                                           1039    1035      -4
const_int_1                                            4       -      -4
const_IPTOS_LOWDELAY                                   4       -      -4
RCVBUF                                                 4       -      -4
ntp_init                                             474     469      -5
change_listen_mode                                   316     310      -6
uevent_main                                          416     409      -7
arping_main                                         1697    1690      -7
telnet_main                                         1612    1603      -9
socket_want_pktinfo                                   42      33      -9
setsockopt_reuseaddr                                  21      10     -11
setsockopt_broadcast                                  21      10     -11
httpd_main                                           772     757     -15
get_remote_transfer_fd                               109      94     -15
make_new_session                                     503     487     -16
ftpd_main                                           2177    2160     -17
read_bunzip                                         1896    1866     -30
common_traceroute_main                              4099    4058     -41
common_ping_main                                    1836    1783     -53
------------------------------------------------------------------------------
(add/remove: 5/4 grow/shrink: 8/21 up/down: 111/-283)        Total: -172 bytes

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

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

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

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

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

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

Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-19 23:05:20 +02:00
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