summaryrefslogtreecommitdiff
path: root/networking
AgeCommit message (Collapse)Author
2020-08-15httpd: Don't add Last-Modified header to responseSergey Ponomarev
The Last-Modified header is used for caching. The client (browser) will send back the received date to server via If-Modified-Since request header. But both headers MUST be an RFC 1123 formatted string. And the formatting consumes resources on request parsing and response generation. Instead we can use ETag header. This simplifies logic and the only downside is that in JavaScript the document.lastModified will return null. Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-08-15httpd: Don't add Date header to responseSergey Ponomarev
RFC 2616 sec. 14.18 says that server MUST send Date header. But in fact the header make sense only for Cache-Control and can be omitted. In the same time the Date eats power, CPU and network resources which are critical for embedded systems. Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-08-15httpd: Update to HTTP/1.1Sergey Ponomarev
HTTP v1.1 was released in 1999 year and it's time to update BB HTTPD. Browsers may behave badly with HTTP/1.0 E.g. Chrome does not send the If-None-Match header with ETag. Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-08-13build system: drop PLATFORM_LINUXRon Yorston
PLATFORM_LINUX is a hidden configuration option which is disabled by default and enabled at over a hundred locations for features that are deemed to be Linux specific. The only effect of PLATFORM_LINUX is to control compilation of libbb/match_fstype.c. This file is only needed by mount and umount. Remove all references to PLATFORM_LINUX and compile match_fstype.c if mount or umount is enabled. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-08-13udhcpc: add support for long optionsMartin Lewis
Duplicate options are currently overridden (only the last option is kept). This leads to unexpected behavior when using long options. The patch adds support for long options in compliance with RFC 3396. Fixes #13136. function old new delta udhcp_run_script 601 725 +124 optitem_unset_env_and_free - 38 +38 putenvp 46 59 +13 static.xmalloc_optname_optval 718 717 -1 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/1 up/down: 175/-1) Total: 174 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-07-31ip address: Add support for "valid_lft" and "preferred_lft" optionsChristian Eggers
Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-07-31ip: Add support for "noprefixroute" optionChristian Eggers
The "noprefixroute" option suppresses automatic generation of a routing table entry based on the interface's ip address. The ifa_flags field has only 8 bit. If higher bits are set, rta_tb[IFA_FLAGS] has to be used instead. Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-07-31httpd_indexcgi.c: use CSS for odd/even rowsSergey Ponomarev
Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-07-31httpd_indexcgi.c: minimize style CSSSergey Ponomarev
Remove new lines \n and some semicolons ;. This minimize page style size from 655 to 604 Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-07-20ntpd: fix refid reported in server mode, closes 13056Denys Vlasenko
function old new delta resolve_peer_hostname 129 196 +67 recv_and_process_peer_pkt 2475 2476 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 68/0) Total: 68 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-07-19networking: support ftp PASV responses not ending with ')'Denys Vlasenko
Patch by Baruch Burstein <bmburstein@gmail.com> function old new delta parse_pasv_epsv 153 181 +28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-07-12domain_codec: optimize dname_dec and convert_dnameMartin Lewis
dname_dec: now iterates over the packet only once. convert_dname: remove redundant checks and code shrink. While testing I've noticed that some of the tests didn't compile properly, so I fixed them. function old new delta dname_dec 286 267 -19 dname_enc 166 143 -23 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-42) Total: -42 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29udhcpc: fix a TODO in fill_envp using option scannerMartin Lewis
fill_envp now iterates over the packet only once instead of a few hundred times using the new option scanner. function old new delta udhcp_scan_options - 189 +189 putenvp - 46 +46 init_scan_state - 22 +22 udhcp_get_option 227 104 -123 udhcp_run_script 835 601 -234 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 0/2 up/down: 257/-357) Total: -100 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29udhcp: add option scannerMartin Lewis
Added an option scanner to udhcp to enable iteration over packet options. Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29wget: fix openssl options for cert verificationScott Court
function old new delta is_ip_address - 54 +54 spawn_https_helper_openssl 461 486 +25 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 79/0) Total: 79 bytes Signed-off-by: Scott Court <z5t1@z5t1.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29acpid: only display -p if supported in usageNorbert Lange
Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29dhcpd: remove hardcoded pidfile pathNorbert Lange
Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29nc_bloaty: support udp broadcast portsNorbert Lange
Add a -b option, identical to debians "traditional" netcat. This allows sending (subnet) UDP Broadcasts. function old new delta packed_usage 33420 33441 +21 nc_main 1041 1057 +16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 37/0) Total: 37 bytes Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-21udhcpc6: use correct multicast MACUwe Glaeser
function old new delta static.MAC_DHCP6MCAST_ADDR - 6 +6 Signed-off-by: Uwe Glaeser <uwe.glaeser@dormakaba.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09dhcpc: refactor xmalloc_optname_optval to shrink binary sizeMartin Lewis
function old new delta len_of_option_as_string 14 13 -1 dhcp_option_lengths 14 13 -1 udhcp_str2optset 641 637 -4 static.xmalloc_optname_optval 777 718 -59 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-65) Total: -65 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09httpd: allow '-h' to work when daemonized with NOMMU enabledRon Yorston
Commit d1b75e184 (httpd: permit non-default home directory with NOMMU enabled) only works when used with the '-f' (foreground) option. When '-f' isn't specified and NOMMU is enabled bb_daemonize_or_rexec() is called to daemonize the server. Since the server process has been re-execed the previous patch results in the xchdir() not being called. Fix this by resetting the re_execed variable in this case. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09udhcp: comment out unused domain compression codeDenys Vlasenko
function old new delta attach_option 411 406 -5 dname_enc 381 167 -214 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-219) Total: -219 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09dhcpc: code shrink in good_hostnameMartin Lewis
Incorporated valid_domain_label into good_hostname to simplify the implementation. function old new delta static.xmalloc_optname_optval 973 958 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-15) Total: -15 bytes text data bss dec hex filename 993144 16915 1872 1011931 f70db busybox_old 993129 16915 1872 1011916 f70cc busybox_unstripped Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-05-20wget: implement TLS verification with ENABLE_FEATURE_WGET_OPENSSLDimitri John Ledkov
When ENABLE_FEATURE_WGET_OPENSSL is enabled, correctly implement TLS verification by default. And only ignore verification errors, if --no-check-certificate was passed. Also note, that previously OPENSSL implementation did not implement TLS verification, nor printed any warning messages that verification was not performed. Bug-Ubuntu: https://bugs.launchpad.net/bugs/1879533 CVE-2018-1000500 Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-30httpd: permit non-default home directory with NOMMU enabledRon Yorston
When BusyBox is compiled with NOMMU enabled running httpd with the '-h' option fails even if the specified directory exists: $ ls -d www www $ busybox httpd -fvvvp 8080 -h www ... ... try to access http://localhost:8080/www ... httpd: can't change directory to 'www': No such file or directory The parent process executes xchdir("www"). When a connection is accepted it's handled by re-executing httpd in inetd mode. The child process inherits the current directory "www" and tries to change directory again to "www", which fails. Omit the call to xchdir() when httpd is re-executed. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-13tftp: on download, open local file only when first bit of data arrivedDenys Vlasenko
No reason to potentially clobber existing file before absolutely necessary. function old new delta tftp_protocol 1947 2020 +73 tftp_main 393 376 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 73/-17) Total: 56 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-13tftp: fix thinko in code shrinkDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-13tftp: code shrinkDenys Vlasenko
function old new delta tftp_protocol 1949 1947 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-13tftpd: show requested file name in open error messageDenys Vlasenko
function old new delta tftp_protocol 1902 1949 +47 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-01-14udhcpd: mangle hostnames starting with dash ("-option")Denys Vlasenko
function old new delta add_lease 316 328 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-12-03whois: limit total length of response to 32+2 kbDenys Vlasenko
function old new delta query 517 554 +37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-30ntpd: decrease MIN_FREQHOLD by 2, increase "penalty" for largish offset x2Denys Vlasenko
> 2018-07-25: > ntpd: increase MIN_FREQHOLD by 3 > This means we'll start correcting frequency ~5 minutes after start, > not ~3.5 ones. > With previous settings I still often see largish ~0.7s initial offsets > only about 1/2 corrected before frequency correction kicks in, > resulting in ~200ppm "correction" which is then slowly undone. Review of real-world results of the above shows that with small initial offsets, freq correction can be allowed to kick in sooner, whereas with large (~0.8s) offsets, we still start freq correction a bit too soon. Let's rebalance this a bit. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-27nslookup: implement support for SRV recordsJo-Philipp Wich
Add support for querying and parsing SRV DNS records. function old new delta send_queries 1711 1865 +154 qtypes 72 80 +8 Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-27nslookup: handle replies without RRsJo-Philipp Wich
Under some circumstances, a DNS reply might contain no resource records, e.g. when a valid domain is queried that does not have records of the requested type. Example with nslookup from BIND dnsutils: $ nslookup -q=SRV example.org Server: 10.11.12.13 Address: 10.11.12.13#53 Non-authoritative answer: *** Can't find example.org: No answer Currently the busybox nslookup applet simply prints nothing after the "Non-authoritative answer:" line in the same situation. This change modifies nslookup to either print "Parse error" or "No answer" diagnostics, depending on the parse_reply() return value. function old new delta send_queries 1676 1711 +35 Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25ntpd: abs(tmx.offset) was truncating a "long" typed valueDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25tc: array address is never NULLDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25traceroute: fix gcc-ismDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25suppress a few "unused function" warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25netstat: suppress a warning (conversion from 'int' to 'smallint' changes value)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-18telnet: add disabled code to emit EC and IPDenys Vlasenko
> I'm trying to connect to a Korenix 3005 switch through telnet > for management purposes, and all is well except for the backspace character > - seems like my switch doesn't handle it too well and instead of erasing > the last character all it does is print some garbage to the screen. > I've had the same issue before while using putty, but saw a solution that > suggests to enable "Telnet special commands" in the options menu, and it > worked. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-15brctl: code shrinkDenys Vlasenko
function old new delta show_bridge 323 317 -6 brctl_main 2171 2164 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-13) Total: -13 bytes text data bss dec hex filename 1002083 551 5612 1008246 f6276 busybox_old 1002065 551 5612 1008228 f6264 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-12brctl: tweak help text, fix commentsDenys Vlasenko
function old new delta packed_usage 33255 33236 -19 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-12brctl: fold show_bridge_ports_ into its callerDenys Vlasenko
function old new delta brctl_main 2235 2171 -64 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-12brctl: code shrinkDenys Vlasenko
packed_usage 33253 33255 +2 write_uint 96 90 -6 show_bridge_timer 93 69 -24 brctl_main 2338 2235 -103 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 2/-133) Total: -131 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-11brctl: add support for showstp commandMartin Lewis
function old new delta brctl_main 974 2339 +1365 show_bridge_timer - 93 +93 static.state_names - 48 +48 printf_xstrtou - 26 +26 packed_usage 33243 33253 +10 show_bridge 333 323 -10 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 2/1 up/down: 1542/-10) Total: 1532 bytes text data bss dec hex filename 999868 551 5612 1006031 f59cf busybox_old 1002309 551 5612 1008472 f6358 busybox_unstripped Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-08udhcpc: fix segmentation fault on empty bin optMichal Kazior
The following caused udhcpc to segfault: busybox udhcpc -i lo -s /dev/null -x 0x3d: function old new delta udhcp_str2optset 629 641 +12 Signed-off-by: Michal Kazior <michal@plume.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-08brctl: add support for showmacs commandMartin Lewis
function old new delta brctl_main 680 974 +294 packed_usage 33167 33187 +20 compare_fdbs - 19 +19 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/0 up/down: 333/0) Total: 333 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-08route: fix output of "route -n -A inet6"Tomas Paukrt
The output of the command "route -n -A inet6" may be corrupted due to partially initialized structure snaddr6 in the function INET6_displayroutes. Signed-off-by: Tomas Paukrt <tomaspaukrt@email.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>