aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/common
AgeCommit message (Collapse)Author
2015-12-04Merge branch 'maint'Henrik Nord
2015-12-04Merge branch 'maint-17' into maintHenrik Nord
Conflicts: OTP_VERSION erts/doc/src/notes.xml erts/vsn.mk lib/kernel/doc/src/notes.xml lib/kernel/src/kernel.appup.src lib/kernel/vsn.mk lib/ssl/doc/src/notes.xml lib/ssl/src/ssl.appup.src lib/ssl/src/ssl_cipher.erl lib/ssl/vsn.mk otp_versions.table
2015-11-27Merge branch 'maint'Sverker Eriksson
2015-11-27Merge branch 'sverk/cpool_fetch-dc_list-fix' into maintSverker Eriksson
OTP-13147 * sverk/cpool_fetch-dc_list-fix: erts: Reduce alloc_SUITE:rbtree runtime for valgrind erts: Remove double free in efile_drv erts: Improve alloc_SUITE:migration test erts: Pass free mem and build type to alloc_SUITE tests erts: Fix snprintf in alloc_SUITE for windows erts: Workaround for strange crash on win64 in alloc_SUITE test code erts: Refactor alloc_SUITE to use NIFs instead of drivers erts: Add enif_getenv erts: Make key argument constant for erl_drv_{get|put}env erts: Add alloc_SUITE:migration erts: Add TEST allocator erts: Fix confusion of callbacks destroying_mbc() vs remove_mbc() erts: Fix resurrection of carriers from dc_list
2015-11-26erts: Remove double free in efile_drvSverker Eriksson
That double free is probably very seldom invoked as the port is already gone leading to free_data being called instead of file_async_ready.
2015-11-19Fix error propagate from setoptsRaimo Niskanen
2015-10-26erts: Add {line_delimiter, byte()} option to inet:setopts/2Serge Aleynikov
A new {line_delimiter, byte()} option allows line-oriented TCP-based protocols to use a custom line delimiting character. It is to be used in conjunction with {packet, line}. This option also works with erlang:decode_packet/3 when its first argument is 'line'.
2015-10-26Update primary bootstrapIngela Anderton Andin
2015-10-26erts: Add {line_delimiter, byte()} option to inet:setopts/2Serge Aleynikov
A new {line_delimiter, byte()} option allows line-oriented TCP-based protocols to use a custom line delimiting character. It is to be used in conjunction with {packet, line}. This option also works with erlang:decode_packet/3 when its first argument is 'line'.
2015-09-10Merge branch 'maint'Ingela Anderton Andin
2015-09-07erts: Fix inet packet mode ssl_tls for passive modeSverker Eriksson
Caused stack corruption leading to VM crash on windows. {packet,ssl_tls} is undocumented by the way.
2015-07-10ose: Remove all code related to the OSE portLukas Larsson
The OSE port is no longer supported and this commit removed it and any changes related to it. The things that were general improvements have been left in the code.
2015-06-24erts: Remove HALFWORD_HEAP definitionBjörn-Egil Dahlberg
2015-06-18Change license text to APLv2Bruce Yinhe
2015-06-17Merge branch 'nybek/fix_so_linger_zero__simple'Raimo Niskanen
* nybek/fix_so_linger_zero__simple: Update prim_inet.beam Fix socket option {linger, {true, 0}} to abort TCP connections Apply 'show_econnreset' socket option to send errors as well Add 'show_econnreset' TCP socket option
2015-06-09Fix socket option {linger, {true, 0}} to abort TCP connectionsRory Byrne
Up until now, if {linger, {true, 0}} is set on the socket and there is data in the port driver queue, the connection is not aborted until the port queue is empty and close() is called on the underlying file descriptor. This bug allows an idle TCP client to prevent a server from terminating the connection and freeing resources. This patch fixes the problem by discarding the port queue if the socket is closed when {linger, {true, 0}} is set.
2015-06-09Apply 'show_econnreset' socket option to send errors as wellRory Byrne
Up till now all send errors have been translated into a generic {error, closed}. This patch allows {error, econnreset} to be returned on send errors when it is detected that the TCP peer has sent an RST.
2015-06-09Add 'show_econnreset' TCP socket optionRory Byrne
An ECONNRESET is a socket error which tells us that a TCP peer has sent an RST. The RST indicates that they have aborted the connection and that the payload we have received should not be considered complete. Up until now, the implementation of TCP in inet_drv.c has hidden the receipt of the RST from the user, treating it as though it was just a FIN terminating the read side of the socket. There are many cases where user code needs to be able to distinguish between a socket that was closed normally and one that was aborted. Setting the option {show_econnreset, true} enables the user to receive ECONNRESET errors on both active and passive sockets. A connected socket returned from gen_tcp:accept/1 will inherit the show_econnreset setting of the listening socket. By default this option is set to {show_econnreset, false}. Note that this patch only enables the reporting of ECONNRESET when the socket is being read from. It does not report ECONNRESET (or EPIPE) when the user tries to write to a connection when an RST has already been received. Currently the TCP implementation in inet_drv.c hides all such send errors from the user in favour of returning {error, close}. A separate patch will be needed to enable the reporting of such errors.
2015-06-04Fix add_multi_timer() in inet_drvRory Byrne
Fix the sorting logic in add_multi_timer() and expand the test case coverage around this area.
2015-06-02Merge branch 'nybek/fix_gen_tcp_shutdown'Zandra Hird
OTP-12797
2015-05-12Fix gen_tcp:shutdown/2 by making it asynchronousRory Byrne
If the driver queue is empty, or the user is requesting a 'read' shutdown, then the shutdown() syscall is performed synchronously, as per the old version of shutdown/2. However, if the user is requesting a 'write' or 'read_write' shutdown, and there is data in the driver queue for the socket, then the shutdown() syscall is delayed and handled asynchronously when the driver queue is written out. This version of shutdown solves a number of issues with the old version. The two main solutions it offers are: * It doesn't block when the TCP peer is idle or slow. This is the expected behaviour when shutdown() is called: the caller needs to be able to continue reading from the socket, not be prevented from doing so. * It doesn't truncate the output. The current version of gen_tcp:shutdown/2 will truncate any outbound data in the driver queue after about 10 seconds if the TCP peer is idle of slow. Worse yet, it doesn't even inform anyone that the data has been truncated: 'ok' is returned to the caller; and a FIN rather than an RST is sent to the TCP peer. For a detailed description of all the problems with the old version of shutdown, please see the EEP Light that was written to justify this patch.
2015-04-23Fix FreeBSD sendfileStefan Grundmann
check (nbytes == 0 && d->c.sendfile.nbytes == 0) when efile_sendfile returns 0 and has EAGAIN set. FreeBSD sendfile(2) man page: When using a socket marked for non-blocking I/O, sendfile() may send fewer bytes than requested. In this case, the number of bytes successfully written is returned in *sbytes (if specified), and the error EAGAIN is returned. The number of bytes successfully written can be 0. If this happens and in a request handling either file:sendfile/2 or file:sendfile/5 with Bytes=0, the sendfile loop will stop prematurely and file:sendfile will return {ok, BytesSent} where BytesSent < DataAfterOffset, effectively breaking sendfile support on FreeBSD.
2015-04-10erts: Cleanup code in invoke_pwritevSverker Eriksson
2015-04-10Use the correct union member inside efile_drvNick Mills
The `invoke_pwritev()` function was in some places using the union member intended for the `invoke_writev()` function.
2015-03-18Merge branch 'maint'Zandra Hird
2015-03-14Remove unused time macros from efile_drvNick Mills
All uses of these macros were removed in commit c3a615aa2da09bc3a0575e973959f800460a63de.
2015-03-09Merge branch 'seriyps/zlib-inflate-bound'Henrik Nord
* seriyps/zlib-inflate-bound: Add zlib limited output buffer size functionality Conflicts: erts/preloaded/ebin/zlib.beam OTP-12548
2015-02-12Add zlib limited output buffer size functionalityСергей Прохоров
This functionality may be useful for compressed streams with high compression ratio (in case of gzip it may be up to x1000), when small amount of compressed data will produce large amount of uncompressed output. This may lead to DoS attacks, because server easily goes out of memory. Example of such high compression ratio stream: ``` dd if=/dev/zero of=sparse.bin bs=1MB count=100 # 100mb of zeroes gzip sparse.bin # 95kb sparse.bin.gz $ erl > {ok, Compressed} = file:read_file("sparse.bin.gz"), > 97082 = size(Compressed), > Uncompressed = zlib:gunzip(Compressed), > 100000000 = iolist_size(Uncompressed). ```
2015-02-03Merge branch 'maint'Zandra Hird
Conflicts: OTP_VERSION erts/emulator/sys/unix/sys.c erts/vsn.mk
2015-02-03Merge branch 'maint-17' into maintZandra Hird
2015-01-30Merge branch 'egil/fix-getifaddrs-realloc/OTP-12445' into maint-17Erlang/OTP
* egil/fix-getifaddrs-realloc/OTP-12445: erts: Fix getifaddrs realloc ptr mismatch
2015-01-29erts: Fix getifaddrs realloc ptr mismatchBjörn-Egil Dahlberg
When a buffer was exhausted and subsequently a realloc, we could get an invalid pointer. For this to occur we would need to have a realloc to lower adresses. The symptom would be garbage returned from erlang:port_control(Port, 25, []) (prim_inet:getifaddrs(Port) resulting in a badarg) or a segmentation fault.
2015-01-23erts: Use emergency close to close epmdBjörn-Egil Dahlberg
Closes all open socket before writing crashdump to file.
2015-01-14Merge branch 'maint'Marcus Arendt
2015-01-13erts: Extend driver interface with emergency_closeBjörn-Egil Dahlberg
The intention of this callback is to close all sockets associated to a port. It is closed only on crashdumps. This will currently only be used for the epmd port.
2014-12-08Fix inet:getopts involving #sctp_paddrinfo{}Simon Cornish
Handle peer addresses that are unconfirmed (i.e. in state SCTP_UNCONFIRMED). Handle unknown states instead of using ASSERT
2014-12-02erts: Add compile time assert ERTS_CT_ASSERTSverker Eriksson
and usage
2014-09-12erts: getsockname is not allowed on non-bound socketsLukas Larsson
This only produces an error on win32, but should not really be called on *nix either.
2014-08-25Fix misspellings of 'another'Tuncer Ayaz
2014-07-24Merge branch 'maint-r16' into maintHenrik Nord
Conflicts: erts/doc/src/notes.xml erts/preloaded/ebin/prim_inet.beam erts/vsn.mk lib/kernel/doc/src/notes.xml lib/kernel/vsn.mk
2014-07-22erts: Fix inet close on prebound fdsBjörn-Egil Dahlberg
Inet close must remove fd from select/poll without closing the fd.
2014-07-22kernel: When doing an fdopen we now also bind the fd to the specified addr/portLukas Larsson
2014-03-28Merge branch 'lukas/ose/master-17.0/OTP-11334'Lukas Larsson
* lukas/ose/master-17.0/OTP-11334: erts: Move debug printout to eliminate gcc warning
2014-03-28erts: Move debug printout to eliminate gcc warningLukas Larsson
2014-03-27Merge branch 'lukas/ose/master-17.0/OTP-11334'Lukas Larsson
* lukas/ose/master-17.0/OTP-11334: ose: Fix erts assert failed printouts ose: fix for packet_bytes in fd/spawn driver. ose: Prepare slave for running on OSE ose: Fix bug when hunting for signal proxy ose: Implement tcp inet driver for OSE ose: Add ifdefs for HAVE_UDP ose: Yielding has to be done differently for background processes. ose: Print faults in aio sys driver calls ose: Prinout errno when to_erl read fails ose: erlang display goes to ramlog printf ose: Initiate stdin/stdout/stderr ose: Break lmconf into one per load module ose: Reset busy port when pdq empty ose: Restore the owner of the signal
2014-03-26ose: Implement tcp inet driver for OSELukas Larsson
The inet driver for OSE has to handle signals instead of selects and thus the wrappers for ready_input/output are a little bit different. However the majority of the inet code remains the same.
2014-03-26ose: Add ifdefs for HAVE_UDPLukas Larsson
2014-03-25Merge branch 'bjorn/erts/zlib-fix'Björn Gustavsson
* bjorn/erts/zlib-fix: zlib: Fix adler32_combine/4 and crc32_combine/4
2014-03-24Merge branch 'sverk/win-long-filenames/OTP-11813'Sverker Eriksson
* sverk/win-long-filenames/OTP-11813: erts: Cleanup debug tracing in win_efile.c erts: Fix file:list_dir for windows paths 258 or 259 chars long erts: Increase MAXPATHLEN to 4096 for windows erts: Fix bug in efile_readlink for long win paths kernel: Fix failed tests in prim_file_SUITE for windows erts: Fix compiler warning in win_efile.c erts: Skip tests of paths longer than 255 characters as atoms erts: Skip tests of file:set_cwd for too long path on Windows erts: Make file:make_symlink/2 return {error,eperm} on Windows erts: Revert file:set_cwd impl for windows erts: Ignore reduntant slashes in windows paths fix file_SUITE:cur_dir_0 for long windows paths erts: Fix file_SUITE:make_del_dir for long paths erts: Fix long windows paths for compressed files erts: Use GetFullPathNameW to construct abs paths from relative ones erts: Fix file driver to handle long paths on windows Conflicts: erts/emulator/drivers/win32/win_efile.c
2014-03-21zlib: Fix adler32_combine/4 and crc32_combine/4Björn Gustavsson
Since our config.h is included in each source file in the zlib directory, we must make sure that config.h is also included every time zlib functions are called to ensure that definitions of types are consistent. zlib_drv.c did not include config.h, which caused problems on a MacOS X Leopard system. What happened was that HAVE_UNISTD_H was not defined when zlib.h was included. When unistd.h is not known to exist, the type z_off_t will be set to a long (32 bits on this platform). But when the zlib source files were compiled, HAVE_UNISTD_H was defined, unistd.h would be included, and z_off_t would be set to off_t (64 bits; defined in unistd.h). As a result of the mismatch, calls to the adler32_combine() and crc32_combine() would pass only 32 bits in the len2 argument when 64 bits were expected.