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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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