aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpc.c
AgeCommit message (Collapse)Author
2013-01-14whitespace cleanup. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-27udhcpc[6]: allow discover_retries == 0 (infinite)Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-17ushcpc: gracefully handle packets with CHECKSUM_PARTIALAlexey Froloff
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-07-27udhcpc: make -O <numeric_opt> work. Closes 5402Denys Vlasenko
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-06-02udhcpc[6]: show select timeout in logDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-22udhcpc: fix improper size calculation for OPTION_STRING_HOSTDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-08udhcpc: sanitize hostnames in incoming packets. Closes 3979.Denys Vlasenko
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-11-18udhcpc: shrink code by setting xid more economicallyDenys Vlasenko
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-16udhcpc6: rudimentary code to export data to script; fix IAADDR parsingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-08udhcpc[6]: tweak help text, remove -B from udhcpc6 and "--version" from bothDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-07udhcpc: trim help text, rename badly-named variableDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-07udhcpc: code shrinkDenys Vlasenko
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-05udhcpc: reuse string constant; remove unneeded memset(0)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-05udhcpc: deprecate --hostname NAMEDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-23getty: reset tty attrs on Ctrl-C and Ctrl-D tooDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20udhcpc: add comment about server IPDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20udhcpc: in fill_envp, export BOOTP fields firstDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20dhcpc: fix the case where we might add extra space at the end of envvar.Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20udhcpc: fix 6rd option formatting (was using 4 more bytes than there is)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20udhcpc: remove unused argument in sprint_nip6Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-20udhcpc: small code shrinkDenys Vlasenko
function old new delta udhcp_recv_raw_packet 430 425 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-19udhcpc: add support for DHCP option 212 (RFC 5969)Denys Vlasenko
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-18udhcpc: on SIGUSR1, limit renew attempts time to 20 seconds; then do total ↵Vladislav Grishenko
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-18udhcp: IF_UDHCP_VERBOSE() macro - improve code readabilityLeonid Lisovskiy
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-07networking: consolidate the IP checksum code. -129 bytes.Baruch Siach
Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-10*: simplify Ethernet header includesDan Fandrich
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-04udhcpc: allow -O OPT take numeric paramsDenys Vlasenko
function old new delta udhcpc_main 2623 2654 +31 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-26dhcpc: export unrecognized options in "optNN=XXXXXXXXX" formNigel Hathaway
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-03-12udhcpc: emit "correct" secs fieldDenys Vlasenko
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-07udhcpc: add -B optionKeith Young
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-02-14udhcpc: use more correct, and more importantly, more understandable BPF codeVladislav Grishenko
Signed-off-by: Vladislav Grishenko <themiron@mail.ru> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-25udhcpc: document SIGUSRn effect in help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-21udhcpd: reduce stack usage by ~700 bytes. +28 bytes code sizeDenys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-20udhcpc: exit if iface disappeared; use correct MAC if it changesDenys Vlasenko
function old new delta udhcpc_main 2560 2618 +58 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20udhcpc: reduce stack usage by de-inlining routines with on-stack pkt bufDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20udhcpc: periodically reread our ifindex and macDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20udhcpc: emit maxsize option in all non-NAK type packetsDenys Vlasenko
Before, we were sending them only in DISCOVER packets. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20udhcpc: better help textDenys Vlasenko
function old new delta packed_usage 27452 27486 +34 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-20udhcpc: remove -c CLIENTID, it is hard to use, -x 61:hexstring does the same ↵Denys Vlasenko
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-20udhcpc: move usage text to .c file. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-17udhcpc: fix OPTION_IP_PAIR parsingVladislav Grishenko
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-06-24*: introduce and use bb_unsetenv_and_freeDenys Vlasenko
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-05-30dhcp: readability cleanups and small code shrinkDenys Vlasenko
function old new delta udhcp_run_script 654 617 -37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04udhcp: s/dhcp_option/dhcp_optflag/gDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04udhcpc: trivial shrinkDenys Vlasenko
function old new delta udhcpc_main 2801 2785 -16 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-03udhcpd: support decoding of option 120 "SIP servers". Closes bug 737Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-27udhcp: abort if we see unknown option, and show valid options if soDenys Vlasenko
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-26udhcp: cosmetic cleanups; one case of s/full_read/xread/Denys Vlasenko
function old new delta dumpleases_main 632 623 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26udhcp: pass pointer to whole packet to "add option" functionsDenys Vlasenko
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-26udhcp: move options.c to common.c; disable unused bool and s16 option codeDenys Vlasenko
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>