aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded
AgeCommit message (Collapse)Author
2019-02-01[socket-nif] nosup expection of win32 and type(s) replacementsMicael Karlberg
The nif callback functions (nif_open) now instead cause an 'nosup' exception if called (instead of badarg). The basic type uint16_t, uint32_t and int32_t (C99) replaced "own" (that is, defined by "us") types Uint16, Uint32 and Sint32. The point of this is that our Windows build system seems to be a bit lacking when it comes to types... Removed "some stuff" that was if-defed. Different solution when win32 support for sockets has been improved. Make sure the socket_*.c util modules are not included in the building for windows. OTP-15526
2019-01-29[socket-nif] The otp rcvbuf option updatedMicael Karlberg
Its now possible to set a rcvbuf (otp) option value of {N :: pos_integer(), BufSz :: pos_integer()}. This value is used for type stream and protocol tcp, when calling the function recv with length = 0 (zero). The second value, BufSz, is the actual size of the receive buffer used when calling the socket recv function, and the first value, N, is the max number of possible reads that will be performed (at most), even if there is more data to read. This is limit the effect of DoS attacks. OTP-15497
2019-01-21[socket-nif] Add support for otp option fdMicael Karlberg
Add a way to *get* the file descriptor (fd) of a socket. Useful mostly for debugging. OTP-15528
2018-12-14[socket-nif] Message interface between socket.erl and nif updatedMicael Karlberg
Previously the "message interface" between the functions in socket.erl and the nif-code (socket_nif.c) was "ad hoc". This has now been changed so that we have a unified message {'$socket', SockRef | undefined, Tag, Info} This also has the added advantage of preparing the code for when we start using the new select-fucntions (with which its possible to specify your own message). This will be used in order to get around our eterm "leak" (we will use a simple counter, maintained in the nif, instead of the [Recv|Send|Acc]Ref we generate in the erlang code today. OTP-14831
2018-11-06[socket-nif|test] Add UDP ping-pong test casesMicael Karlberg
Added ping-pong test cases for UDP, small and medium, using the sendto/recvfrom and sendmsg/recvmsg functions. OTP-14831
2018-11-05[socket-nif] Add "partial success" to sendmsgMicael Karlberg
The sendmsg function attempts to send *one message*. But its possible for the underlying software to fail to send the *entire* message. So, instead of retrying itself, as send does, the sendmsg function will now instead return with {ok, Remaining}, leaving it to the caller to decide what to do. OTP-14831
2018-10-30[socket-nif] Add a send and receive chunks test caseMicael Karlberg
The send and recv test case triggered a two bugs. One was that there was no re-selecting when only a portion of the data was received (which meant that we stopped reading). Also, the wrong 'current' (writer) was reset when demonitor current reader after a successful read (which meant that future readers would never have been monitored). OTP-14831
2018-10-09[socket-nif|doc] Add preliminary doc for the function supportsMicael Karlberg
Added preliminary documentation for the function socket:supports/0,1,2,3. It still does not generate proper doc for supports/3 (the last arg, Opt, don't get a type). OTP-14831
2018-10-09[socket-nif] The supports function now also handles sctp and ipv6Micael Karlberg
The supports function now also handles testing for SCTP and IPv6 support. Basic test at the moment, but better then nothing. OTP-14831
2018-10-08[socket-nif] Add the options for socket, ip and ipv6 for supportsMicael Karlberg
Add the options for level socket (full), ip and ipv6 to the supports function. OTP-14831
2018-10-05[socket-nif] Add first three socket (socket) options to supportsMicael Karlberg
Added the first three socket (level socket) options to the supports function(s). OTP-14831
2018-10-05[socket-nif] Add *preliminary* new function supports/0,1Micael Karlberg
2018-10-04[socket-nif] Socket option 'SO_DOMAIN' not avalable on all platformsMicael Karlberg
Internally in the socket module we accessed domain, type and protocol for an open socket. But as it turns out, domain (family) is not actually available as a socket option on all platforms. FreeBSD in this case. So, since we store these values in the socket descriptor anyway, we switch to use these values for our internal use instead. OTP-14831
2018-09-28[socket-nif] Add support for socket (level otp) buffer optionsMicael Karlberg
Add support for otp level socket options rcvbuf, rcvctrlbuf and sndctrlbuf. These options define default sizes for these buffers. The 'rcvbuf' is used when receiving messages when calling the recv, recvfrom and recvmsg functions. The 'rcvctrlbuf' is used for the control message header info when calling the recvmsg function. The 'sndctrlbuf' is used for the control message header info when calling the sendmsg function. OTP-14831
2018-09-20[socket-nif] Add proper send timeout handlingMicael Karlberg
Added proper send timeout handling. Made use of the enif_select(mode = cancel) feature. Each time a timeout expires, the "active" send (the surrent write select) has to be cancelled. OTP-14831
2018-09-19[socket-nif] Add proper connect and accept timeout handlingMicael Karlberg
Added proper connect and accept timeout handling. Made use of the enif_select(mode = cancel) feature. Each time a timeout expires, the previous operation (connect or accept) has to be cancelled (actually its the select operation that has to be cancelled). Only partial implementation of cancel for now (connect and accept). More to follow... OTP-14831
2018-09-18[socket-nif] Post rebase updateMicael Karlberg
2018-09-18[socket-nif] Cleanup and guardsMicael Karlberg
Some cleanup and also added a guard to sendmsg to ensure that only ctrl (cmsg hdr) with actual content will be "sent down". OTP-14831
2018-09-18[socket-nif] CMsgHdr and various doc related changesMicael Karlberg
Updated the (send) cmsghdr type and the handling of it (in the nif code). Still not tested! Removed the is_loaded nif function. Tried to get fix the doc build problem (socket.erl *i think*), which causes socket.html generation to fail with: "cannot find module exporting type" To solve this I tried to run dialyzer on preloaded, and ran into problems with enc_setopt_value. Update various specs and types to "solve" this (which did not work). Updated the nif-stub functions to make dialyzer happy.
2018-09-18[socket-nif] Add support for (recvmsg) control message ipv6_pktinfoMicael Karlberg
Added support for (recvmsg) control message ipv6_pktinfo, for level = ipv6 and type = pktinfo. This is enabled by setting the socket option: recvpktinfo for level ipv6. Not yet tested! OTP-14831
2018-09-18[socket-nif] Add more data types (with doc) and (C) debugMicael Karlberg
Add more debug printouts for the new sendmsg. Also added new (erlang) types with doc. OTP-14831
2018-09-18[socket-nif] Add preliminary support for sendmsgMicael Karlberg
Added function sendmsg/2,3,4. Actually worked on the first try. Something must be wrong... Still no supported cmsghdr's (only support headers where the data part is already a binary, which therefor does not require any processing). So if the cmsghdrs actually work is unclear. OTP-14831
2018-09-18[socket-nif] Processing of more cmsg headersMicael Karlberg
Added processing or more cmsg headers (for more options). Now (also) supports: socket:timestamp. Also various fixes and cleanups. For some reason calling getopt(Sock, 0, {13, int}) (or similar) fails with badarg even though the nif-function (nif_getopt) actually returns a valid value (for instance: {ok, 0}). OTP-14831
2018-09-18[socket-nif] Add support for recvmsgMicael Karlberg
Added preliminary support for function recvmsg. At the moment this only works on *nix (Windows has another function, WSARecvMsg, which has a slightly different API). Also we have "no" cmsg decode at the moment (just level and type). OTP-14831
2018-09-18[socket-nif] Add support for socket (level ip) option sendsrcaddrMicael Karlberg
Added support for ip level socket option SENDSRCADDR. This option requires sendmsg to actually use, so we cannot test this fully at the moment. OTP-14831
2018-09-18[socket-nif] Add support for socket (level ip) option recvorigdstaddrMicael Karlberg
Added support for ip level socket option RECVORIGDSTADDR. This option requires recvmsg to actually use, so we cannot test this fully at the moment (although both set and get works). OTP-14831
2018-09-18[socket-nif] Updated socket typeMicael Karlberg
Updated the socket type. No longer store "stuff" that can be retrieved by other means (domain, type and protocol). OTP-14831
2018-09-18[socket-nif] Add support for socket (level ip) option retoptsMicael Karlberg
Added support for ip level socket option RETOPTS. OTP-14831
2018-09-18[socket-nif] Add support for socket (level ip) option transparentMicael Karlberg
Added support for ip level socket option TRANSPARENT. OTP-14831
2018-09-18[socket-nif] Add support for socket (level ip) option pktinfoMicael Karlberg
Added support for ip level socket option PKTINFO. This option requires sendmsg and/or recvmsg to actually use, so we cannot test this fully at the moment (although both set and get works). OTP-14831
2018-09-18[socket-nif] Add support for socket (level ip) option hdrinclMicael Karlberg
Added support for ip level socket option HDRINCL. As this option is raw only, it has not yet been tested! OTP-14831
2018-09-18[socket-nif] Add support for socket (level ip) option msfilterMicael Karlberg
Added support for ip level socket option MSFILTER. This option has not been tested *in any way*... OTP-14831
2018-09-18[socket-nif] Add support for socket (level ipv6) option recverrMicael Karlberg
Added support for the IPv6 socket option RECVERR. To actually make use of this option, we need the recvmsg function, which we don't have yet. Baby steps. OTP-14831.
2018-09-18[socket-nif] Add support for socket (level ip) option recverrMicael Karlberg
Added support for the IP socket option RECVERR. To actually make use of this option, we need the recvmsg function, which we don't have yet. Baby steps. OTP-14831.
2018-09-18[socket-nif] Add support for socket (level ipv6) option addrformMicael Karlberg
Added support for the IPv6 socket option ADDRFORM. Only allowed for IPv6 sockets that are connected and bound to a v4-mapped-on-v6 address. OTP-14831.
2018-09-18[socket-nif] Add support for socket (level ipv6) option router_alertMicael Karlberg
Added support for the IPv6 socket option ROUTER_ALERT. Only supported for raw sockets. OTP-14831.
2018-09-18[socket-nif] Add support for socket (level ipv6) option unicast_hopsMicael Karlberg
Added support for the IPv6 socket option UNICAST_HOPS. OTP-14831.
2018-09-18[socket-nif] Add support for socket (level ipv6) option flowinfoMicael Karlberg
Added support for the IPv6 socket option(s) FLOWINFO. The option returns with einval when calling setsockopt, so either you need to be a privileged user to update, or its not actually possible to update this option (even though it says nothing about that in the man page. It only talks about set). This is the same behaviour as with DSTOPTS. Needs furher checking. OTP-14831.
2018-09-18[socket-nif] Add support for socket (level ipv6) option dstoptsMicael Karlberg
Added support for the IPv6 socket option(s) DSTOPTS. The option returns with einval when calling setsockopt, so either you need to be a privileged user to update, or its not actually possible to update this option (even though it says nothing about that in the man page. It only talks about set). This is the same behaviour as with RTHDR and HOPLIMIT. On FreeBSD, it says that HOPOPTS requires superuser privileges. Needs furher checking. OTP-14831.
2018-09-18[socket-nif] Add support for socket (level ipv6) option authhdr & hopoptsMicael Karlberg
Added support for the IPv6 socket option(s) AUTHHDR and HOPOPTS. Its possible that the option is AUTHHDR is obsolete. It says so in the include files and when trying to get it (getsockopt) it returns with enoprotoopt. The option HOPOPTS returns with einval when calling setsockopt, so either you need to be a privileged user to update, or its not actually possible to update this option (even though it says nothing about that in the man page. It only talks about set). This is the same behaviour as with RTHDR and HOPLIMIT. On FreeBSD, it says that HOPOPTS requires superuser privileges. Needs furher checking. OTP-14831.
2018-09-18[socket-nif] Add support for socket (level ipv6) option rthdrMicael Karlberg
Added support for the IPv6 socket option RTHDR. On FreeBSD this option requires superuser privileges to update. There is no mention of this on linux, but its still not possible to update (einval), so I assume that its the same there. OTP-14831.
2018-09-18[socket-nif] Add support for socket (level ipv6) option recvpktinfoMicael Karlberg
Added support for the IPv6 socket option RECVPKTINFO. This option is called PKTINFO on FreeBSD, so that value will also be accepted. OTP-14831.
2018-09-18[socket-nif] Add support for socket (level ipv6) option multicast_loopMicael Karlberg
Added support for the IPv6 socket option MULTICAST_LOOP. OTP-14831.
2018-09-18[socket-nif] Add support for socket (level ipv6) option multicast_ifMicael Karlberg
Added support for the IPv6 socket option MULTICAST_IF. OTP-14831.
2018-09-18[socket-nif] Add support for socket (level ipv6) option multicast_hopsMicael Karlberg
Added support for the IPv6 socket option MULTICAST_HOPS. OTP-14831.
2018-09-18[socket-nif] Updated types for [recv|send]msgMicael Karlberg
Updated and added types for the sendmsg and recvmsg functions. OTP-14831
2018-09-18[socket-nif] Add support for socket (level ip) option recvoptsMicael Karlberg
Added support for ip level socket option RECVOPTS. OTP-14831
2018-09-18[socket-nif] Add support for socket (level ip) option freebindMicael Karlberg
Added support for ip level socket option FREEBIND. Note that there is an option available on FreeBSD called IP_BINDANY, which seems to have similar properties (FREEBIND is *not* available on FreeBSD). There are some restrictions for this option though (which is not mentioned in the Linux man page). OTP-14831
2018-09-18[socket-nif] Add support for socket (level socket) option timestampMicael Karlberg
Added support for socket level socket option TIMESTAMP. OTP-14831
2018-09-18[socket-nif] Add support for socket (level socket) option(s) [rcv|snd]lowatMicael Karlberg
Added support for socket level socket option RCVLOWAT and SNDLOWAT. These are both a little strange, at least on Linux. See the man pages for more info. For instance, sndlowat cannot be set on Linux. OTP-14831