aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/common/inet_drv.c
AgeCommit message (Collapse)Author
2012-05-04Merge branch 'maint'Patrik Nyblom
2012-05-04gen_tcp: Make setopts(S,[{active,once}]) try a readPatrik Nyblom
This significantly reduces latency for tcp servers with high load, as we need not go into poll to get the next message. Maximum throughput may increase between 4 to 6 times compared to R15B.
2012-04-16kernel, erts: Remove bit8 option from inetBjörn-Egil Dahlberg
2012-03-30Merge branch 'maint'Björn-Egil Dahlberg
2012-03-30Update copyright yearsBjörn-Egil Dahlberg
2012-03-20Merge branch 'maint'Gustav Simonsson
2012-03-20Merge branch 'ps/inet6-less-build-fix' into maintGustav Simonsson
* ps/inet6-less-build-fix: Add missing HAVE_IN6 && AF_INET6 ifdef OTP-9996
2012-03-19Merge branch 'maint'Björn-Egil Dahlberg
Conflicts: erts/preloaded/ebin/prim_inet.beam
2012-03-19Merge branch 'ph/fix-enfile/OTP-9990' into maintBjörn-Egil Dahlberg
* ph/fix-enfile/OTP-9990: Update preloaded prim_inet.beam gen_tcp: Use correct specs for accept and listen prim_inet: Catch system_limit in open_port Fix returned error from gen_tcp:accept/1,2 when running out of ports
2012-02-21Add missing HAVE_IN6 && AF_INET6 ifdefPeer Stritzinger
This prevents building for operating systems that do not yet have IPv6 compatible socket API. Error can be reproduced by (cross)building for a os that doesn't have these headers. This will abort with a error about incomplete type 'struct in6_addr'. All other uses of IPv6 API in inet_drv.c are conditionalized like in the patch.
2012-02-21erts: Fix compiler warning in inet_drvSverker Eriksson
2012-01-04Fix returned error from gen_tcp:accept/1,2 when running out of portsPer Hedeland
The {error, enfile} return value is badly misleading and confusing for this case, since the Posix ENFILE errno value has a well-defined meaning that has nothing to do with Erlang ports. The fix changes the return value to {error, system_limit}, which is consistent with e.g. various file(3) functions. inet:format_error/1 has also been updated to support system_limit in the same manner as file:format_error/1.
2011-12-19erts: Better suppression of uninitialised sctp_sndrcvinfoSverker Eriksson
2011-12-09Merge branch 'raimo/64-bit-driver-api/OTP-9795'Björn Gustavsson
* raimo/64-bit-driver-api/OTP-9795: (22 commits) driver_SUITE.erl: Fix sys info drivers emulator test drivers: Conform to updated driver API runtime_tools's drivers: Conform to updated driver API ws's xwe_driver.c: Conform to updated driver API megaco's flex scanner: Conform to updated driver API seq_trace_SUITE_data/echo_drv.c: Conform to updated driver API erl_interface tests: Conform port_call_drv.c updated driver API erl_drv_thread_SUITE_data/testcase_driver.c: Conform to updated driver API float_SUITE_data/fp_drv.c: Conform to updated driver API port_SUITE_data/*_drv.c: Conform to updated driver API port_bif_SUITE_data/control_drv.c: Conform to updated driver API send_term_SUITE_data/send_term_drv.c: Conform to updated driver API system_profile_SUITE_data/echo_drv.c: Conform to updated driver API trace_port_SUITE_data/echo_drv.c: Conform to updated driver API Remove support for old drivers without ERL_DRV_EXTENDED_MARKER built-in drivers: Add ERL_DRV_EXTENDED_MARKER and version numbers Bump driver version to 2.0 erl_driver.h: Enlarge type on return value from call erl_driver.h: Enlarge types on driver callbacks output, control and call erl_driver.h: Enlarge types in driver output functions ... Conflicts: erts/emulator/test/driver_SUITE_data/monitor_drv.c erts/emulator/test/driver_SUITE_data/timer_drv.c
2011-12-09built-in drivers: Add ERL_DRV_EXTENDED_MARKER and version numbersBjörn Gustavsson
2011-12-09erl_driver.h: Enlarge types on driver callbacks output, control and callRaimo Niskanen
2011-12-08Merge branch 'ta/sendfile/OTP-9240'Lukas Larsson
* ta/sendfile/OTP-9240: Do not use async threads on DARWIN Fix cleanup when sendfile process crashes Return {error,closed} from sendfile if closed Do not use SFV_NOWAIT as it does not exist on all solaris Clarify some code comments Make solaris use sendfilev
2011-12-08Merge branch 'sverk/misc-valgrind-fixes'Sverker Eriksson
* sverk/misc-valgrind-fixes: erts: Suppress valgrind warning about syscall sendmsg erts: Fix memory leak in test drivers erts: Small fix in inet_drv.c:sctp_set_opts
2011-12-08Fix cleanup when sendfile process crashesLukas Larsson
When sendfile crashes during a send there should be no error_logger printouts about stolen fds.
2011-12-07erl_driver.h: Enlarge types in driver queue and alloc functionsRaimo Niskanen
2011-12-07erl_driver.h: Use ErlDrvSizeT for size field in ErlIOVecRaimo Niskanen
2011-12-07erts: Suppress valgrind warning about syscall sendmsgSverker Eriksson
Valgrind complains: "Syscall param socketcall.sendmsg(msg.msg_control) points to uninitialised byte(s)". Seems valgrind do not know which bytes of msg_control are padding.
2011-12-06erts: Small fix in inet_drv.c:sctp_set_optsSverker Eriksson
2011-12-05Clarify some code commentsLukas Larsson
Thanks Tuncer Ayaz
2011-12-05honor packet_size for http packet parsing to fix OTP-9389Steve Vinoski
Allow applications to use a packet_size setting on a socket to control acceptable HTTP header line length. This gives them the ability to accept HTTP headers larger than the default settings allow, but also lets them avoid DOS attacks by accepting header lines only up to whatever length they wish to allow. Without this change, if an HTTP request/response line or header arrives on a socket in http, http_bin, httph, or httph_bin parsing mode, and the request/response line or header is too long to fit into a default inet_drv buffer of 1460 bytes, an unexpected error occurs. These problems were described and discussed on erlang-questions in June 2011 in this thread: http://erlang.org/pipermail/erlang-questions/2011-June/059563.html In the original code, no buffer reallocation occurs to enlarge the buffer, even if packet_size or line_length are set in a way that should allow the HTTP data to be parsed properly. The only available workaround was to collect headers and parse them using erlang:decode_packet, but that approach has drawbacks such as having to collect all HTTP header data before it can be handed to decode_packet for correct parsing, and also requiring each and every Erlang web server developer/maintainer to add the workaround to his or her web server. Change the packet parser to honor the packet_size setting for HTTP parsing. If packet_size is set, and an HTTP request/response or header line exceeds the default 1460 byte TCP buffer limit, return an indication to tcp_remain that it should realloc the buffer to enlarge it to packet_size. Also fix the HTTP parsing code to properly honor line_length by truncating any HTTP request/response or header lines that exceed that setting. For backward compatibility, default behavior is unchanged; if an application wants to be able to accept long HTTP header lines, it must set packet_size to an appropriate value. Buffer reallocation occurs only when needed, so the original default buffer size in the code is still the default. Make the line mode parsing honor packet_size as well, for consistency. Add new regression tests to the emulator decode_packet suite and also to the kernel gen_tcp_misc suite. The documentation for packet_size in inet:setopts/2 is already sufficient. Many thanks to Sverker Eriksson for his guidance on how to best fix this bug and also for reviewing a number of patch attempts prior to this one.
2011-12-02Get cerl and distribution working in Win64Patrik Nyblom
Can still not setup -a, but cerl works.
2011-12-02Merge branch 'ta/sendfile/OTP-9240'Lukas Larsson
* ta/sendfile/OTP-9240: (31 commits) Add sendfile server printouts Skip recv/send during tests for fallback platforms Remove header/trailer support Remove windows implementation Expand sendfile documentation Only allow tcp sockets as target for sendfile Move sendfile api to file module Preliminary work on header/trailer Use free_sendfile explicitly for non-async Remove debug printouts Add tests for send/recv/sendfile interactions Remove tests for file_server sendfile sendfile caller now has to be the controlling_process Remove support for file_server, sendfile has to be raw Set chunk size to 3 GB Change type of fd to be ErlDrvEvent Add ifdef's for HAVE_SENDFILE Fix freebsd support for sendfile Change nbytes to 64 bit Implement ignorefd for TCP ...
2011-12-01Implement ignorefd for TCPLukas Larsson
Ignore fd is a feature used by sendfile to temporarily remove all driver_select calls on that fd so that another driver can select on it. It also delays all actions which sends or receives data in that fd until in the fd is no longer ignored. Only the controlling_process should use the feature as it is otherwise possible that the ignore will never be cleaned up and hence create a memory leak in the driver. An ignored driver will not detect that an fd has been closed until it is unignored.
2011-11-30Merge branch 'tn/inet_drv-fix'Raimo Niskanen
* tn/inet_drv-fix: Cleanup - remove unnecesary bracket level and configure for ifreq.ifr_enaddr Work around gcc linking with own view of default libs on Solaris Use libdlpi to get physical address
2011-11-29Cleanup - remove unnecesary bracket level and configure for ifreq.ifr_enaddrRaimo Niskanen
2011-11-29Work around gcc linking with own view of default libs on SolarisRaimo Niskanen
Also use 64-bit lib when necessary, specify runtime lib path for secondary dependency libs, and better check before using SIOCGIFHWADDR.
2011-11-28erts: Fix faulty udp-buffer handlingSverker Eriksson
Caused core dump with gen_udp_SUITE on halfword vm.
2011-11-24Use libdlpi to get physical addressTrond Norbye
2011-11-18Merge branch 'pan/binary_match_scope/OTP-9701'Patrik Nyblom
* pan/binary_match_scope/OTP-9701: Remove remaining gcc 4.6 assigned-but-not-used warnings from erts Remove GCC 4.6 set-but-not-used warning from erl_bif_binary Make binary:match with scope return correct values
2011-11-17Merge branch 'raimo/sctp-dev/OTP-9239'Raimo Niskanen
* raimo/sctp-dev/OTP-9239: (21 commits) erts: Possible bugfix for error chunk on old Solaris 10 kernel: Documented gen_sctp:peeloff/2 kernel: Adjust SCTP test to SuSE quirk erts: Fixes for SCTP on old Solaris 10 Update preloaded files erts,kernel: Return eprotonosupport when SCTP is not supported kernel: Adjust SCTP tests to Solaris quirks erts: Fix SCTP decoding byteorder bug for adaptation_ind kernel: Rewrite SCTP test socket handler kernel: Fix SCTP tests for the FreeBSD protocol stack kernel: Bugfix - SCTP connect with sndrcvinfo in assoc_change event erts: Default enable SCTP in configure Update primary bootstrap and preloaded files erts: Use SCTP functions in default libs erts: Improve SCTP message defragmenting erts,kernel: Bugfix - collect fragmented SCTP messages on recv kernel: Add tests for gen_sctp:peeloff/2 erts,kernel: Implement gen_sctp:peeloff/2 kernel: Add tests for SCTP stream sockets erts,kernel: Add type stream sockets to SCTP ...
2011-11-17erts: Possible bugfix for error chunk on old Solaris 10Raimo Niskanen
2011-11-17Merge branch 'sverker/valgrind-fixing'Sverker Eriksson
* sverker/valgrind-fixing: erts: valgrind suppressions for prebuilt terms in os_info_init Fix dlopen-leak of drivers with incorrect version erts: Add valgrind suppression files erts: Remove valgrind limit for erts_alloc_permanent_cache_aligned erts: Fix write-after-free bug in inet driver ETS: Fix faulty size calculation SIZEOF_EXTSEG ETS: Fix valgrind PossiblyLost in ETS hash tables
2011-11-17erts: Fixes for SCTP on old Solaris 10Raimo Niskanen
2011-11-17erts: Fix SCTP decoding byteorder bug for adaptation_indRaimo Niskanen
2011-11-17erts: Use SCTP functions in default libsRaimo Niskanen
On e.g FreeBSD the functions sctp_bindx() and sctp_peeloff() do not require any extra linkage library flags and there is no dynamic lib to load for them; use configure to find them.
2011-11-17erts: Improve SCTP message defragmentingRaimo Niskanen
Receive several fragments within the same receive loop if possible.
2011-11-17erts,kernel: Bugfix - collect fragmented SCTP messages on recvRaimo Niskanen
2011-11-17erts,kernel: Implement gen_sctp:peeloff/2Raimo Niskanen
2011-11-17erts,kernel: Add type stream sockets to SCTPRaimo Niskanen
2011-11-16Remove remaining gcc 4.6 assigned-but-not-used warnings from ertsPatrik Nyblom
2011-11-16erts,kernel: Rename operations common to TCP and SCTPRaimo Niskanen
2011-10-11Merge branch 'bjorn/some-configure-clean-ups'Björn Gustavsson
* bjorn/some-configure-clean-ups: erts/configure.in: Remove test for reversed setvbuf() arguments erts/configure.in: Remove broken support for System V erts/configure.in: Don't check for the presence of mach-o/dyld.h erts/configure.in: Remove useless --disable-fixalloc option
2011-10-06erts: Fix write-after-free bug in inet driverSverker Eriksson
Bug caught by valgrind but never confirmed as cause of a real problem. Triggered by emulator_test/distribution_SUITE:bad_dist_structure when bad data is received to a distribution port. Port is closed by erts_net_message() and the freed port data is then later used when returning to inet_drv. Everything happens in the same call to tcp_inet_input(). ==32592== Invalid read of size 8 ==32592== at 0x5B6D8C: tcp_deliver (inet_drv.c:8536) ==32592== by 0x5B720E: tcp_recv (inet_drv.c:8652) ==32592== by 0x5B7753: tcp_inet_input (inet_drv.c:8990) ==32592== by 0x5B7FA5: tcp_inet_drv_input (inet_drv.c:9257) ==32592== by 0x4B900C: erts_port_task_execute (erl_port_task.c:856) ==32592== by 0x4AC873: schedule (erl_process.c:5511) ==32592== by 0x5527CA: process_main (beam_emu.c:1225) ==32592== by 0x4A9958: sched_thread_func (erl_process.c:3789) ==32592== by 0x5E2971: thr_wrapper (ethread.c:106) ==32592== by 0x4FEA142: start_thread (in /lib64/libpthread-2.4.so) ==32592== by 0x52C374C: clone (in /lib64/libc-2.4.so) ==32592== Address 0x9b13ea8 is 440 bytes inside a block of size 488 free'd ==32592== at 0x4A1FE94: free (vg_replace_malloc.c:366) ==32592== by 0x58AE69: erts_sys_free (sys.c:2588) ==32592== by 0x48E54F: erts_free (erl_alloc.h:218) ==32592== by 0x497390: driver_free (io.c:3527) ==32592== by 0x5B2E77: inet_stop (inet_drv.c:7152) ==32592== by 0x5B502F: tcp_inet_stop (inet_drv.c:7855) ==32592== by 0x492E60: terminate_port (io.c:1849) ==32592== by 0x493971: erts_do_exit_port (io.c:2059) ==32592== by 0x4CEE01: erts_net_message (dist.c:1508) ==32592== by 0x496AC1: driver_output2 (io.c:3294) ==32592== by 0x5AAA69: inet_port_data (inet_drv.c:1894) ==32592== by 0x5AD57E: tcp_reply_data (inet_drv.c:3181) ==32592== by 0x5B6D84: tcp_deliver (inet_drv.c:8533) ==32592== by 0x5B720E: tcp_recv (inet_drv.c:8652) ==32592== by 0x5B7753: tcp_inet_input (inet_drv.c:8990) Fixed by checking the negative return code earlier in tcp_deliver().
2011-09-28Merge branch 'raimo/sctp-getsetopts-dev/OTP-9544' into devRaimo Niskanen
* raimo/sctp-getsetopts-dev/OTP-9544: erts,kernel: Bugfix - read SCTP socket options from right protocol layer erts: Fix bug SCTP send can only be called from controlling process
2011-09-19Merge branch 'raimo/sctp-getsetopts/OTP-9544' into ↵Raimo Niskanen
raimo/sctp-getsetopts-dev/OTP-9544 Conflicts: erts/emulator/drivers/common/inet_drv.c lib/kernel/test/gen_sctp_SUITE.erl