aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpc.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* udhcpc: fix for some Android toolchain breakageDenys Vlasenko2015-10-081-0/+14
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: add setsockopt_foo helpersDenys Vlasenko2015-08-241-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* udhcpc: dns labels can actually start with a numberArthur Gautier2015-07-301-4/+0
| | | | | | | | | | | 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>
* udhcpd: account for script delay in leaseJohn Schroeder2014-12-251-1/+5
| | | | | | | 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>
* udhcpc: account for script run timeDenys Vlasenko2014-12-211-1/+5
| | | | | | | | | | | | | | | | | | | | | | | 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>
* udhcpd: add option for tweaking arppingMichel Stam2014-10-301-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* udhcpc: make hostname sanitization optional. Closes 3979Denys Vlasenko2014-06-161-0/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc: ignore NAKs from "wrong" servers. Closes 4267Denys Vlasenko2014-02-271-1/+24
| | | | | | | function old new delta udhcpc_main 2716 2814 +98 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc: fix BPF filter. Hopefully fixes the root cause of 4598 and 6746Denys Vlasenko2014-02-191-3/+4
| | | | | | Use a *signed* large positive value in BPF filter to indicate success. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc: in comments, explain the kind of raw socket we createDenys Vlasenko2014-02-071-2/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc: don't use BPF filter, users report problems (bugs 4598, 6746)Denys Vlasenko2014-02-031-47/+46
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc: allow zero server-id. Closes 6614.Denys Vlasenko2013-11-031-11/+25
| | | | | | | | | | | | | | 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>
* udhcpc: tweak help text moreDenys Vlasenko2013-08-081-17/+17
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc: tweak help textDenys Vlasenko2013-08-081-14/+15
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc: tweak help textDenys Vlasenko2013-08-051-4/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* whitespace cleanup. no code changesDenys Vlasenko2013-01-141-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* udhcpc[6]: allow discover_retries == 0 (infinite)Felix Fietkau2012-09-271-2/+2
| | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* 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>