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