aboutsummaryrefslogtreecommitdiff
path: root/networking (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge branch 'busybox' into mergeRon Yorston2020-11-1214-40/+77
|\|
| * avoid using strok - eliminates use of hidden global variableDenys Vlasenko2020-10-062-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta udhcp_str2optset 616 650 +34 setpriv_main 950 975 +25 switch_root_main 688 706 +18 parse 958 970 +12 getopt_main 622 628 +6 parse_resolvconf 302 306 +4 mpstat_main 1139 1142 +3 static.p 4 - -4 cdcmd 717 702 -15 strtok 148 - -148 ------------------------------------------------------------------------------ (add/remove: 0/3 grow/shrink: 7/1 up/down: 102/-167) Total: -65 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd: code shrinkXabier Oneca2020-10-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Use decode_base64() from uuencode.c when uudecode/base64 applets are included. That function is bigger than httpd's decodeBase64(), so we use the old one when those applets are disabled. Bloat-o-meter when one of those is enabled: function old new delta handle_incoming_and_exit 2371 2265 -106 Signed-off-by: Xabier Oneca <xoneca@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ip rule: add support for fwmark/fwmask for policy routingRui Salvaterra2020-10-032-7/+27
| | | | | | | | | | | | | | | | | | | | This adds support for fwmark/fwmask in ip rule which is needed, for example, in OpenWrt's mwan3. Masks are supported since Linux 2.6.19. Fixes: https://bugs.busybox.net/show_bug.cgi?id=11621 Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcp: remove struct packing attribute, eliminates gcc-9.xDenys Vlasenko2020-10-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | "error: taking address of packed member of 'struct ip_udp_dhcp_packet' may result in an unaligned pointer value" here: udhcp_dump_packet(&packet.data); and in other places. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: shrink recursive_action() by reducing memory pressureDenys Vlasenko2020-10-011-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta recursive_action1 - 316 +316 file_action_grep 161 164 +3 add_to_prg_cache_if_socket 202 205 +3 depmod_main 509 511 +2 writeFileToTarball 488 489 +1 parse_module 281 282 +1 fileAction 207 208 +1 act 189 190 +1 add_to_dirlist 65 64 -1 writeTarFile 196 194 -2 uuidcache_init 47 45 -2 uuidcache_check_device 109 107 -2 true_action 8 6 -2 run_parts_main 310 308 -2 netstat_main 534 532 -2 lsusb_main 29 27 -2 lspci_main 45 43 -2 initial_scan 138 136 -2 grep_main 845 843 -2 find_main 482 480 -2 config_file_action 437 435 -2 chmod_main 142 140 -2 dirAction 14 10 -4 diff_main 1544 1540 -4 chown_main 154 148 -6 skip_dir 136 129 -7 dir_act 191 184 -7 recursive_action 453 69 -384 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 7/20 up/down: 328/-439) Total: -111 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * gcc-9.x warning fixesDenys Vlasenko2020-10-016-9/+9
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ntpd: fix the case where two replies received at once and first one causes a ↵Denys Vlasenko2020-09-291-0/+9
| | | | | | | | | | | | | | | | | | step function old new delta recv_and_process_peer_pkt 2476 2486 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | httpd: silence compiler warnings about %llx formatRon Yorston2020-08-231-1/+1
| |
* | Merge branch 'busybox' into mergeRon Yorston2020-08-2328-249/+498
|\|
| * httpd: Make Deny/Allow by IP config support optionalSergey Ponomarev2020-08-161-18/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When disabled: function old new delta if_ip_denied_send_HTTP_FORBIDDEN_and_exit 52 - -52 handle_incoming_and_exit 2201 2097 -104 scan_ip 170 - -170 parse_conf 1365 1065 -300 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/2 up/down: 0/-626) Total: -626 bytes Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd: Support caching via ETag headerSergey Ponomarev2020-08-151-3/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If server responds with ETag then next time client can resend it via If-None-Match header. Then httpd will check if file wasn't modified and if not return 304 Not Modified status code. The ETag value is constructed from file's last modification date in unix epoch and it's size: "hex(last_mod)-hex(file_size)" e.g. "5e132e20-417" (with quotes). That means that it's not completely reliable as hash functions but fair enough. The same form of ETag is used by Nginx so load balancing of static content is safe. function old new delta handle_incoming_and_exit 2135 2201 +66 http_response 88 96 +8 send_headers 676 683 +7 parse_conf 1362 1365 +3 http_response_type 22 24 +2 send_file_and_exit 847 841 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/1 up/down: 86/-6) Total: 80 bytes Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd: Don't add Last-Modified header to responseSergey Ponomarev2020-08-151-6/+25
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * httpd: Don't add Date header to responseSergey Ponomarev2020-08-151-2/+16
| | | | | | | | | | | | | | | | | | 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>
| * httpd: Update to HTTP/1.1Sergey Ponomarev2020-08-151-8/+8
| | | | | | | | | | | | | | | | | | 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>
| * build system: drop PLATFORM_LINUXRon Yorston2020-08-1319-26/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * udhcpc: add support for long optionsMartin Lewis2020-08-132-35/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * ip address: Add support for "valid_lft" and "preferred_lft" optionsChristian Eggers2020-07-312-7/+62
| | | | | | | | | | Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ip: Add support for "noprefixroute" optionChristian Eggers2020-07-312-16/+33
| | | | | | | | | | | | | | | | | | | | | | 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>
| * httpd_indexcgi.c: use CSS for odd/even rowsSergey Ponomarev2020-07-311-8/+2
| | | | | | | | | | Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd_indexcgi.c: minimize style CSSSergey Ponomarev2020-07-311-37/+37
| | | | | | | | | | | | | | 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>
| * ntpd: fix refid reported in server mode, closes 13056Denys Vlasenko2020-07-202-6/+33
| | | | | | | | | | | | | | | | | | | | 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>
| * networking: support ftp PASV responses not ending with ')'Denys Vlasenko2020-07-191-0/+2
| | | | | | | | | | | | | | | | | | 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>
| * domain_codec: optimize dname_dec and convert_dnameMartin Lewis2020-07-121-78/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | httpd: code shrinkRon Yorston2020-08-131-3/+2
| | | | | | | | Use the new need_system_drive() function in httpd. Saves 16 bytes.
* | win32: use a static buffer in get_system_drive()Ron Yorston2020-08-131-1/+1
| | | | | | | | | | | | | | Allocate static storage for the system drive string instead of making a new allocation on every call. This is easier to manage. Adds 16 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2020-07-0910-262/+246
|\|
| * udhcpc: fix a TODO in fill_envp using option scannerMartin Lewis2020-06-291-114/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * udhcp: add option scannerMartin Lewis2020-06-292-42/+62
| | | | | | | | | | | | | | 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>
| * wget: fix openssl options for cert verificationScott Court2020-06-291-4/+17
| | | | | | | | | | | | | | | | | | | | | | 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>
| * acpid: only display -p if supported in usageNorbert Lange2020-06-291-1/+1
| | | | | | | | | | Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dhcpd: remove hardcoded pidfile pathNorbert Lange2020-06-291-1/+7
| | | | | | | | | | Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * nc_bloaty: support udp broadcast portsNorbert Lange2020-06-291-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * randomconfig fixesDenys Vlasenko2020-06-231-1/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixesDenys Vlasenko2020-06-231-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpc6: use correct multicast MACUwe Glaeser2020-06-211-1/+5
| | | | | | | | | | | | | | | | 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>
| * dhcpc: refactor xmalloc_optname_optval to shrink binary sizeMartin Lewis2020-06-092-27/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * httpd: allow '-h' to work when daemonized with NOMMU enabledRon Yorston2020-06-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * udhcp: comment out unused domain compression codeDenys Vlasenko2020-06-093-13/+18
| | | | | | | | | | | | | | | | | | | | 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>
| * dhcpc: code shrink in good_hostnameMartin Lewis2020-06-091-48/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | win32: fix networking problemsRon Yorston2020-06-031-0/+1
| | | | | | | | | | | | | | | | | | The subprocess that handles incoming connections for httpd didn't work. It has an accepted connection on stdin and calls getpeername() to obtain its details, but getpeername() didn't initialise networking. ssl_client only seems to deal with file descriptors. Expose init_winsock() again and call it from ssl_client.
* | Merge branch 'busybox' into mergeFRP-3466-g53c09d0e1Ron Yorston2020-05-292-3/+23
|\|
| * wget: implement TLS verification with ENABLE_FEATURE_WGET_OPENSSLDimitri John Ledkov2020-05-201-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * httpd: permit non-default home directory with NOMMU enabledRon Yorston2020-04-301-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | httpd: allow use of MD5-encrypted passwordsRon Yorston2020-04-091-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Allow use of MD5-encrypted passwords in HTTP authentication. However: - Since it adds 4K to the size of the binary it isn't enabled by default. Unencrypted password are allowed in the default build. - The use of '*' wildcards for user/password in the configuration file isn't allowed. - Enabling this feature requires enabling 'Use internal crypt functions' (USE_BB_CRYPT) in the 'Login/Password Management Utilities' section.
* | httpd: prevent access to config file and authenticated URLsRon Yorston2020-04-081-0/+12
| | | | | | | | | | | | | | | | | | | | | | Filesystems on Microsoft Windows are usually case-insensitive. This allows clients to circumvent security by requesting URLs with changes in case that aren't anticipated by the server: http://example.com/Httpd.conf vs http://example.com/httpd.conf http://example.com/SeCuReDir vs http://example.com/SecureDir Use case-insensitive comparisons to avoid this.
* | httpd: don't change directory in inetd modeRon Yorston2020-04-071-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the WIN32 port inetd mode is used in the same way as in NOMMU to process each new connection. However, it shares a problem with NOMMU mode upstream: the child process changes directory unnecessarily. Thus, 'httpd -fvvvp 8080 -h www' fails with errors: httpd: can't change directory to 'www': No such file or directory Fix this in the WIN32 port by not changing directory in inetd mode. The behaviour of inetd mode is now quite unlike upstream so the option have been changed to '-I' and removed from the help message. Since the -e/-d options appear in the help message unconditionally FEATURE_HTTPD_ENCODE_URL_STR has been enabled.
* | httpd: WIN32 portRon Yorston2020-04-051-2/+133
| | | | | | | | | | | | | | | | Use mingw_spawn_detach() to daemonize the server. Pass the open socket to the child process on the command line. Omit handling of SIGHUP and SIGALRM. Timeouts are handled using poll(2) instead of alarm(2).
* | Merge branch 'busybox' into mergeRon Yorston2020-02-152-39/+50
|\|
| * tftp: on download, open local file only when first bit of data arrivedDenys Vlasenko2020-02-131-28/+33
| | | | | | | | | | | | | | | | | | | | | | | | 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>