History log of /haiku/src/add-ons/kernel/network/stack/net_socket.cpp
Revision Date Author Comments
# 28129607 14-Mar-2024 Augustin Cavalier <waddlesplash@gmail.com>

network: Remove unnecessary WeakReferenceable::PrivatePointer checks.

These aren't needed anymore after the last commit.


# 783aa308 24-Nov-2023 Augustin Cavalier <waddlesplash@gmail.com>

network/stack: Clean up socket_receive.

* Reshuffle variable declarations, most are placed much
closer to first usages now.

* Turn a confusingly worded comment into an ASSERT(),
and remove another one that was outdated.

* Fix some minor code style problems.

* Make the copying logic more consistent between first
and then subsequent copies.

* Make it possible for B_BAD_ADDRESS (EFAULT) to be
returned. This is not listed in POSIX, but as per
online sources, at least Linux does do this.

Change-Id: Idcfbed30531c1ab4796c4ee37f7f4ce8078e535b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7147
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 2926dfaa 24-Nov-2023 Augustin Cavalier <waddlesplash@gmail.com>

network/stack: Fix handling of MSG_TRUNC in socket_receive.

This is a Linux extension (which at least FreeBSD has also
adopted.) It's used in the Haiku port of libpcap (where it's
a necessity) and wpa_supplicant (where it wasn't, and I
removed it.) It seems that we've had it for quite some time.

Fixes tcpdump following addition of flag checks.


# 459fa41f 23-Nov-2023 Augustin Cavalier <waddlesplash@gmail.com>

network/stack: Get rid of socket_readv and socket_writev.

These have not been used in years (maybe since the redesign of the
network stack?). Only socket_writev had an implementation, which was
mostly just an incomplete version of socket_send.

Scatter/gather I/O is already supported via msghdr's msg_iov/len fields,
so this is redundant anyway.

Change-Id: If41c4f4ee021856f6db49c7cb95422a9c1aa7700
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7127
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 973f6d33 22-Nov-2023 Augustin Cavalier <waddlesplash@gmail.com>

network: Migrate SIGPIPE generation into the socket module.

This removes the burden of determining whether to and then
actually sending SIGPIPE from the protocol modules, meaning
the MSG_NOSIGNAL flag can now be implemented entirely in
the socket module and not even passed further down the chain.

Change-Id: I9ba976c4aff60d533cb4b390bbba1560c0de423f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7124
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# da2f2c65 22-Nov-2023 Augustin Cavalier <waddlesplash@gmail.com>

network/stack: Mask off MSG_NOSIGNAL at the top of socket_receive.

Fixes WebKitGTK spinning endlessly and spawning lots of
short-lived worker processes following the addition of
flag checks and EOPNOTSUPP to the various socket modules.

Change-Id: I6d944b4d0235eea9e8a9333645fcb531805f340f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7123
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# b761f925 09-Aug-2023 Jérôme Duval <jerome.duval@gmail.com>

unix: respect MSG_DONTWAIT on recvmsg

fix #18548

Change-Id: I33f502c2a376be6dbdf913f9613aab9d4c5a3644
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6802
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 34874537 06-Aug-2023 Jérôme Duval <jerome.duval@gmail.com>

unix: respect MSG_DONTWAIT on sendmsg()

fix bug #18539

Change-Id: Id21362028287d1cbdac469226e6b52f4547a276f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6796
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 4313795d 02-Jul-2023 Trung Nguyen <trungnt282910@gmail.com>

network/stack: socketpair for non-stream sockets

`socketpair` should skip the `listen` and `accept` step for
non-stream sockets. This allows the implementation to work for
UNIX domain datagram sockets.

Change-Id: I81ba826d605b77be5a4ec9046ea4c6bd556a35a0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6618
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 740f3ca4 15-May-2023 Jérôme Duval <jerome.duval@gmail.com>

net_socket: binding on the same socket should return an error

Change-Id: I7b948435f6e4009d9c11d2163172ad0ab6484e1d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6458
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# fc13358a 14-May-2023 Jérôme Duval <jerome.duval@gmail.com>

net_socket: getpeername: IsConnected() when parent is not set

this fixes a test in libuv

Change-Id: I3002f9c44794ff3f8215ebc000fefa0f90b80279
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6455
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 9c1af36c 06-May-2023 Jérôme Duval <jerome.duval@gmail.com>

tcp: report disconnected events for tcp

* FIONREAD shouldn't report errors, only EINVAL when listening
* read available data in closing and closing-wait states
* fix #18327

Change-Id: Idd53a043a72ef6c7b282ea669895ff2e947adbb4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6420
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 679a91d1 03-Jun-2022 Augustin Cavalier <waddlesplash@gmail.com>

network/stack: Simplify access to msg_iov in socket_send.

As the TODO comment noted, msg_iov has already been copied to the kernel
at this point (it is done in the syscall handler), so we do not need to
use the user memory access functions.

(I verified that the iovecs passed from userland are indeed copied to
the kernel, but I did not find anything that actually posts more than
a single iov, so this is not tested especially thoroughly.)


# 5847cd11 24-Apr-2022 Jérôme Duval <jerome.duval@gmail.com>

net_stack: don't write notify listen sockets

bug #17714

Change-Id: I91f6340bcda142b5eea12c0739b36e2f90af8ad3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5247
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 779ab335 09-Dec-2020 X512 <danger_mail@list.ru>

use .IsSet() instead if .Get() != NULL

Change-Id: Ia2b7a719fd398e78cc3b11d4f7b02cb81179f65f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3488
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 36aafa56 04-Dec-2020 X512 <danger_mail@list.ru>

fix build after CObjectDeleter interface change

Change-Id: I76e217abcd13c22c4d68170e07333cdde4d7a891
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3461
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 5c63c64b 25-Mar-2020 Leorize <leorize+oss@disroot.org>

net_socket: getpeername now only works on connected socket

Per POSIX.1-2008, getpeername() shall fails if the socket is not
connected.

Fixes #15081

Change-Id: Iafaed09df26f47b10efc2ceed6dfa2852857d39a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2549
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# a03ed4fa 01-May-2020 Jérôme Duval <jerome.duval@gmail.com>

udp: set is_connected flag on our socket once connected.

Change-Id: Ie5fcc5152af813d74d33c20ed7c3e81f9e828518
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2548
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 4835a173 29-Apr-2020 waddlesplash <waddlesplash@gmail.com>

Revert "net_socket: getpeername now only works on connected socket"

This reverts commit 04fac889f75b32790b39753276f33b6b756fc779.

Reason for revert: Breaks Qt, the behavior is incorrect it seems.

Change-Id: I09d35c214c899d0c06d7780b13db795fb2a3393a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2538
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 04fac889 25-Mar-2020 Leorize <leorize+oss@disroot.org>

net_socket: getpeername now only works on connected socket

Per POSIX.1-2008, getpeername() shall fails if the socket is not
connected.

With this change, it's no longer possible to retrieve the peer from
connectionless protocols such as UDP, even if a peer is assigned to them
via connect(). The same behavior can be replicated among
POSIX-compatible operating systems such as Linux.

Fixes #15081

Change-Id: Ia5631971200959a3d3815332ff1969c4b4dd289b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2421
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# a9e97bc0 27-Dec-2019 Zotyamester <szatmary.zoltan1222@gmail.com>

Remove 'always true' if statements (PVS 547)

Change-Id: I8d50e0ca48b48e4ce5091efee65949c6d65099a3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2057
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>


# 54a43526 24-Feb-2019 François Revol <revol@free.fr>

Coding Style Police

Change-Id: I93ebe389dbc685f4277cf32c4d0a6d529c81a354


# 447b98e4 23-Feb-2019 François Revol <revol@free.fr>

net_socket: Fix deferencing NULL+8 in KDL commands

Change-Id: I50d4dab27699614b0bfc977e10d6d11cbb5f79fa


# c29a7780 25-Sep-2018 Leorize <alaviss@users.noreply.github.com>

net_socket: getsockname() now works with unnamed sockets

getsockname() now set the socket family and zero all other fields
of sockaddr if an unnamed socket is passed as an argument. This allows
retrieving the socket family from an unnamed socket.

This change is compatible with POSIX and appears to aligns with
Linux, FreeBSD, DragonflyBSD and OpenBSD behaviors.

Fixes #14312

Change-Id: I55dbf4d6738399941bef71e6b3d7201cf78876df
Reviewed-on: https://review.haiku-os.org/594
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# f1e8af17 03-Dec-2017 Augustin Cavalier <waddlesplash@gmail.com>

net_socket: control op should be uint32.

Where it is called from stack_interface_ioctl, the parameter
is already a uint32 there.

Fixes #13826.


# 571a4030 29-Apr-2016 Jérôme Duval <jerome.duval@gmail.com>

net_socket: check underflow condition happening on x86_64.

* move the test for the availability of the add_anillary_data function in the
protocol out of the loop, as suggested by Axel.
* fix #12737.


# 2d5706f7 30-May-2015 Hamish Morrison <hamishm53@gmail.com>

net_socket: notify of socket errors immediately when selected


# ed9f4719 25-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix FIONREAD related issues

* Network stack socket module: socket_control(): The FIONREAD argument
is int, not ssize_t.
* Net kit: getsockopt(): R5_SO_FIONREAD: Fix ioctl() argument. Was
taking a pointer of what already was a pointer to the buffer.
* libedit: el_gets(): The FIONREAD argument is int, not long.


# 6d796a84 10-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed up network stack and drivers for x86_64.

* Various compilation fixes.
* Fixes to the FreeBSD compatibility layer (from comparing the x86-
specific bits with the equivalent amd64 sources in FreeBSD).
* Compile all the Ethernet drivers except for sis900 and wb840, these
require a bit more work to fix (will file a ticket soon). Tested
ipro1000 and rtl81xx, no issues.


# 6c5757ee 22-Sep-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Check if the socket has been created successfully.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42766 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a8e3ae78 22-Sep-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Switch to BWeakReference class. Hope this does not break anything. Calling virtual destructur on a struct
should work fine, right?



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42764 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 756b64fd 16-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed the obsolescent [B]Reference[able] API and replaced the remaining
uses. Fixes the gcc 2 acpi build.
* Renamed WeakReferenceable::{Add,Remove}Reference() to
{Acquire,Release}Reference() for consistency.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39871 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 89bf19cc 27-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Made an uint32 out of net_socket::bound_to_device.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38395 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1e4feb53 27-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Added some optional debug output.
* Check for errors using != instead of < - the functions are not supposed to
return anything above B_OK.
* Use the stack-wide ENABLE_DEBUGGER_COMMANDS instead of our own local solution.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38386 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dc660d32 04-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Call put_domain_protocols() without having the socket locked. This fixes bug
#5210.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37895 a95241bf-73f2-0310-859d-f6bbb57e9c96


# edf10183 02-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Removed a superfluous check.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37851 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ca215dfe 02-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Replaced more occurences of EOPNOTSUPP with B_NOT_SUPPORTED.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37847 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 845a29a0 02-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* B_SELECT_{READ|WRITE|ERROR} are no flags fields, so they cannot be or'ed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37834 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 988d8d40 23-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* If an error is notified, also forward the even to read/write.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37713 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f8288ec7 15-Dec-2009 Axel Dörfler <axeld@pinc-software.de>

* Made sure the sockaddr::sa_len field is set correctly for sendto(), and
connect().
* This fixes not working connections whenever the incoming sa_len field happened
to be zero.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34669 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 78888c44 15-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

Applied patch by Ma Jie adding functionality needed by mDNSResponder:
* added new protocol method process_ancillary_data_no_container() that does not
need a container to fill the cmsghdr data.
* Added support for the IP_RECVDSTADDR option using this call.
* Implemented support for IP_MULTICAST_IF.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31585 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f54023cf 28-May-2009 Michael Lotz <mmlr@mlotz.ch>

Propagate error codes in FIONREAD. Fixes bug #3973.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30896 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2ae482f5 17-May-2009 Michael Lotz <mmlr@mlotz.ch>

Implement the FIONREAD ioctl for sockets. We already supported it in userland
but the kernel part was missing. It is used to query for the buffer size that
can be retrieved using recv(). It returns the same value we use for the read
select().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30786 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9431509f 30-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed broken socket_get_next_stat() that was responsible for bug #3830.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30500 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6f440aed 24-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* net_socket_module_info::acquire_socket() now returns whether or not the
socket could be acquired, ie. when its reference count is 0, it cannot be
acquired anymore. This requires the protocol to do proper locking, though.
* The TCP EndpointManager now checks the return value of acquire_socket(), and
only returns the endpoint if that succeeded.
* This fixes bug #2197.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30363 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 22e78d6e 15-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Another error found by Romain: the socket's mutex could be destroyed twice
in socket_create(). Thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30201 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7caa5d43 16-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Now gets the net_socket module in init_stack() to make sure it's initialized
as long as the stack is loaded.
* This fixes another regression from moving the socket API into the kernel.
* Thanks to Romain for reporting this!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30198 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ddd83030 16-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Added "is_in_socket_list" member to determine whether the socket is in the
sSocketList or not (to see if it has to be removed when the socket is
deleted).
* This fixes the bug reported by Romain when trying to open an unsupported
protocol (like AF_INET6). Thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30188 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8aa910b9 08-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Added missing SO_TYPE.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30032 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6fc2d92b 08-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed the buggy GCC4 work-around.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30017 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9b4cfa9d 07-Apr-2009 François Revol <revol@free.fr>

This fixed gcc4 build (overloaded == operator...) though I'm not sure it's what was meant. Please check.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30008 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 42d0ef6f 07-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* dump_socket() now also prints the actual parent again (not just its
WeakPointer).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30003 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 11112327 07-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Sockets now inherit from WeakReferenceable.
* This fixes the problem when a socket changes something with regards to its
parent.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30000 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ab134c0a 06-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* socket_delete() now also supports deleting children that still have a parent;
added a potentially dangerous TODO, though (will look into this tomorrow).
* Improved output of the KDL command, and also include the child sockets in the
list.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29986 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 293e82ab 06-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Added KDL commands to inspect sockets ("socket", and "sockets").


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29984 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b32dfac5 06-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Now uses DoublyLinkedList instead of the struct list C stuff.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29981 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 77817877 04-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28500 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 27e0dea9 11-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Actually implemented the SO_BINDTODEVICE socket option I added some time ago.
* This makes it possible to select a specific device, even if no interface
has been configured for it yet. To make it work, each interface now has a
private direct route which will be returned if a socket is bound to a device.
* This will be used for example in DHCP to make it work when more than one
adapter is attached.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27983 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2b07b8e0 28-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced all instances of benaphores in the kernel code by mutexes.
* Removed kernel benaphores.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25690 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cdc00dad 02-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added optional {send,read}_data_no_buffer() hooks to the protocol
module interface. They directly operate on iovecs and thus allow
protocols that don't need it to avoid the creation of a net_buffer.
* Adjusted the socket module to support the new hooks. If they are
present, they will be chosen over the old hooks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25299 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 49e00d1f 02-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved the container management for ancillary data from the net_buffer
module to the stack module. There's a dedicated struct
ancillary_data_container, now. One can just set the container on a
net_buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25292 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e9488bd9 29-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed bogus select notifications in socket_close(). This is really
not necessary, since the VFS makes sure (or should at least) that all
events are deselected when close() is called. ~0 isn't a valid event
anyway.
* Removed delete_select_sync_pool() in socket_free(). It's not
necessary, since the select_sync_pool is auto-destroyed when the last
event has been deselected (which the VFS should take care of).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25265 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5843f17c 23-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

When splitting the send request into multiple buffers, we must
succeed after we have successfully sent the first buffer, even if not a
single byte of some following buffer could be sent. We should probably
even succeed whatever the error code -- not sure what is the reason
for only doing that for B_WOULD_BLOCK and B_INTERRUPTED.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25121 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 97cdbb54 12-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for sending/receiving ancillary data. The protocol modules
have two more optional hooks for attaching supplied ancillary data to a
net_buffer and for processing received ancillary data. Not sure, if that
is flexible enough for all kinds of ancillary data, but it is for
SCM_RIGHTS and also should for SCM_CRED[ENTIAL]S (if we ever decide to
implement one of those) -- don't know any other types on other protocol
levels.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24941 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 75015ff5 11-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed THREAD_FLAGS_IOCTL_SYSCALL to THREAD_FLAGS_SYSCALL,
syscall_restart_ioctl_is_restarted() to syscall_restart_is_restarted,
IoctlSyscallFlagUnsetter to SyscallFlagUnsetter, and
IoctlSyscallRestartWrapper to SyscallRestartWrapper, as they are no
longer only used for ioctl().
* Removed unused syscall_restart_ioctl_handle_post().
* Made SyscallRestartWrapper a lot fancier. Instead of storing a
reference to the result value, it stores the value itself, and it
features all the interesting operators that make it appear like that
value. This simplifies the use of the class quite a bit.
* THREAD_FLAGS_SYSCALL is now set for all socket function and the
read[v](), write[v]() syscalls.
* Added is_syscall() function and net_stack hook to the net stack.
* Removed "kernel" parameter from all net_stack_interface and net_socket
module hooks. They aren't need any longer, since is_syscall() can be
used instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24914 a95241bf-73f2-0310-859d-f6bbb57e9c96


# df50f7a9 10-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed the way the socket functions work:
- The net_stack driver is no longer used. Instead we have a kernel
module which is directly used by syscall implementations in the
kernel. I.e. we no longer tunnel those functions through ioctls, but
have normal syscalls.
- Removed the superfluous net starter module.
- Implemented the FDTYPE_SOCKET type file_descriptors, that is sockets
are no longer vnode based.
- Adjusted libnetwork (the socket function implementations)
accordingly.
- Adjusted netstat accordingly.
* Socket module:
- Implemented socketpair().
- Added "kernel" parameter to the control hook. Quite a few more hooks
would actually need the parameter, but I didn't change those yet,
since that would probably also require changes to the protocol
module interface.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24908 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0db772c9 21-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* When deleting a socket, we also need to delete all of its children.
* This fixes a KDL I often seen when launching firefox.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24046 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6f58064f 07-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* Added flags field in net_protocol_module_info; there is currently a single
defined flag: NET_PROTOCOL_ATOMIC_MESSAGES.
* socket_send() now honours NET_PROTOCOL_ATOMIC_MESSAGES and returns either
EMSGSIZE if the data to be send is larger than net_socket::send::buffer_size,
or divides the data in appropriately sized chunks.
* This fixes sending >=64K over a TCP socket at once (TCP would just have
returned an error in that case).
* TCP now overrides the default send buffer size (to 32768 for now).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23915 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 15ab0bcf 21-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* int32_t, uint32_t are now of type "int", and no longer of type "long".
This should help to reduce the number of warnings imported code will throw
during compilation (helps a lot with tcpdump, for example).
* Since long is 64 bit on 64 bit platforms, we might want to think about doing
that change for the Haiku types int32 and uint32 as well.
* Fixed several occurences of hidden type problems.
* Fixed build of the stack and TCP under BeOS.
* Fixed incorrect typedef in socket_interface.h.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22643 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 636bfc08 02-Oct-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed fs/vfs_select.cpp to wait_for_objects.cpp and got rid of
vfs_select.h, respectively moved most of it into the new kernel
private header wait_for_objects.h.
* Added new experimental API functions wait_for_objects[_etc](). They
work pretty much like poll(), but also for semaphores, ports, and
threads.
* Removed the "ref" parameter from notify_select_events() and the
select_sync_pool functions as well as from fd_ops::fd_[de]select(). It
is no longer needed. The FS interface select() hook still has it,
though -- the VFS will always pass 0.
* de]select_fd() take a select_info* instead of a select_sync* + ref
pair, now. Added respective functions for semaphores, ports, and
threads.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22416 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f5a92f59 04-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21550 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 79a0d252 22-May-2007 Hugo Santos <hugosantos@nowhere.fake>

net_buffer: preparing for better metadata management


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21210 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45b5203b 08-May-2007 Hugo Santos <hugosantos@nowhere.fake>

network stack: getsockopt/setsockopt are no longer optional for protocols, as suggested by Axel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21085 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 73f1548b 30-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

some getsockopt/setsockopt and multicast fixes.

* allow an ipv4 bind() to a multicast address.
* bumped getsockopt/setsockopt kernel driver buffers to 256 bytes to at least handle structures which take one sockaddr_storage.
* convert generic multicast delta API names to IPv4 ones before handling the specific option.
* changed ipv4_getsockopt/ipv4_setsockopt a bit as the code gcc 2.95 was generating was a bit too funky.
* properly pass setsockopt/getsockopt to handling protocols.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20939 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 57967505 29-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

fixed getsockopt/setsockopt callchains. also fixed the cleanup of multicast filters.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20923 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 66a4a428 25-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

added Recv-Q/Send-Q output to netstat.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20819 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2445c00e 19-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

some internal reorganization of getsockopt()/setsockopt() handling. TCP is now able to fully use the application requested sender/receiver buffer sizes for improved performance.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20764 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8107b194 09-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

Fixed some more TCP issues.

- Properly flag sockets using non-blocking connects() when in SYN SENT.
- and when in LISTEN, we should use the socket's connection queue size.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20631 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a5e90266 05-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

copy back the source address even when the data is truncated


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20586 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 485a82e6 05-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

as per the Open Group Specification, MSG_TRUNC should be set in flags whenever the packet is truncated


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20583 a95241bf-73f2-0310-859d-f6bbb57e9c96


# abe1ec18 05-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

properly support MSG_TRUNC. we don't even have to trim the buffer, just try to fill the user buffers as much as possible


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20582 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 17b77c3b 05-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

consolidate all RECV/SEND ioctls into a single RECEIVE/SEND pair

- changed the socket module to use thew new RECEIVE/SEND in all forms of recv() and send()
- changed libnetwork to use the new RECEIVE/SEND
- remove transfer_args processing from strace since the structure was removed


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20581 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c96b101d 04-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

net_socket: make recvfrom() use recvmsg() and sendto() use sendmsg() for code reusal


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20565 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 72455333 04-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

some fixes to recvmsg() and sendmsg()


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20563 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dae7f8ea 04-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

initial recvmsg and sendmsg implementations


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20562 a95241bf-73f2-0310-859d-f6bbb57e9c96


# de8a7c26 08-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

* Introduced a reader_thread member to the private net_device_interface.
* When shutting down an interface, we now wait until its reader thread is gone, too;
this is necessary in case the kernel unloads the networking stack before the reader
thread had a chance to exit.
* Added some debug output to net_socket in case you ask for unknown options.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19741 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4684dfec 31-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

socket_connected() now notifies waiting selects().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19662 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 79608a2d 18-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

* Moved some private members of net_socket into the new net_socket_private structure.
* Added an "owner" field that stores the team which created the socket (for netstat only);
we would need a different storage for SIGURG if we ever want to support that.
* Improved netstat address output: now prints "*" instead of INADDR_ANY.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19562 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8dfd7ea7 18-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

* Implemented a basic infrastructure for a netstat command.
* Started a netstat command.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19560 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5869c1e7 04-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

* sending now detect partial writes and does not return an error in that case.
* writev() now also calls bind() if needed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19428 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f4b92156 04-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

Don't hold the socket's lock when calling socket_read_avail() or socket_send_avail().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19423 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 94fb808a 30-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* socket_spawn_pending() forgot to set the socket's parent field.
* socket_recv[from]() now accept a NULL buffer in case there was nothing to read.
* the tcp_tester's server thread now actually reads the data it receives.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19400 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 41c67263 30-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Moved the starting of the network stack into the driver (from the socket module)
to allow other protocols (like TCP) using the socket module.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19399 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7c0541c1 25-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Build fix; I obviously forgot to compile the stack itself after the changes :-/


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19368 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a6271189 24-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Added support for setting/getting: SO_NONBLOCK, SO_RCVTIMEO, SO_SNDTIMEO,
SO_RCVLOWAT, and SO_SNDLOWAT.
Lowered the default buffer size to be within the uint16 size.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19367 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ead36a7e 11-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

The pending/connected connection lists were not initialized.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19258 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b70a062d 11-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* Separated create_socket() and the call to the protocol's open() function - open()
is not supposed to be called for accepted sockets, only for those created via
a call the userland socket() function.
* Renamed net_socket_module_info::socket() to open_socket() to make this distinction
a bit clearer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19254 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d2021d57 10-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* Took Philippe's hints into account - we now do some locking in socket_spawn_pending() :-)
* Also take the max backlog into account as set by listen() - but reserve a little
extra room for never completing connections, and that listen(..., 0) always accepts
at least a single connection (as the BSDs do).
* Spawned connections won't accept new connections, so SO_ACCEPTCONN must be cleared.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19248 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 44b3faaa 10-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

socket_accept() now checks for SO_ACCEPTCONN before calling the protocol's
accept function to enforce valid codepaths (you need to call listen() before
accept()).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19247 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1a0e92a3 09-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented backlog/pending connection support to the sockets - while currently
only TCP needs this, other stream oriented protocols might too, in the future.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19236 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ee50138f 06-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

Now notifies all pending selects when closing the socket.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19018 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a7028ce6 06-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* Implemented select support for sockets and notifications, not yet tested, though;
this closes ticket #811.
* Added notification support to IPv4 and UDP.
* Implemented reading out SO_ERROR.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19017 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 340cd7be 10-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* socket_getsockopt() now supports all boolean SO_* options as well.
* socket_listen() now sets the SO_ACCEPTCONN flag if it succeeds.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18476 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 943cedf7 10-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

setsockopt() now understands all boolead options.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18475 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c22d69bf 08-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* Completed the previous commit and merger of the team/network/new_stack branch.
* Removed ppp_up and pppcontrol from the image for now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18457 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2d5706f792a9cc4f5d8bd19561ded3941f5099ab 30-May-2015 Hamish Morrison <hamishm53@gmail.com>

net_socket: notify of socket errors immediately when selected


# ed9f4719f7f22477353f0c09c4ed4db8857c6d57 25-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix FIONREAD related issues

* Network stack socket module: socket_control(): The FIONREAD argument
is int, not ssize_t.
* Net kit: getsockopt(): R5_SO_FIONREAD: Fix ioctl() argument. Was
taking a pointer of what already was a pointer to the buffer.
* libedit: el_gets(): The FIONREAD argument is int, not long.


# 6d796a84bd484ccc4fb072a29c663b660180ae51 10-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed up network stack and drivers for x86_64.

* Various compilation fixes.
* Fixes to the FreeBSD compatibility layer (from comparing the x86-
specific bits with the equivalent amd64 sources in FreeBSD).
* Compile all the Ethernet drivers except for sis900 and wb840, these
require a bit more work to fix (will file a ticket soon). Tested
ipro1000 and rtl81xx, no issues.


# 6c5757eedb36fdd43e79d0f457e2f254425a235d 22-Sep-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Check if the socket has been created successfully.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42766 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a8e3ae78c9780541136e3631b59adb8f2aa1f388 22-Sep-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Switch to BWeakReference class. Hope this does not break anything. Calling virtual destructur on a struct
should work fine, right?



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42764 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 756b64fd836dad5b63f41f0b01f8cedfec795f9d 16-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed the obsolescent [B]Reference[able] API and replaced the remaining
uses. Fixes the gcc 2 acpi build.
* Renamed WeakReferenceable::{Add,Remove}Reference() to
{Acquire,Release}Reference() for consistency.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39871 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 89bf19ccde93f9bcf3f965abdcdcac26f519d9b9 27-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Made an uint32 out of net_socket::bound_to_device.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38395 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1e4feb533eef449723a829eb8cc9d704358daff6 27-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Added some optional debug output.
* Check for errors using != instead of < - the functions are not supposed to
return anything above B_OK.
* Use the stack-wide ENABLE_DEBUGGER_COMMANDS instead of our own local solution.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38386 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dc660d32efa4957ad3ab2b394498d051c25d58fd 04-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Call put_domain_protocols() without having the socket locked. This fixes bug
#5210.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37895 a95241bf-73f2-0310-859d-f6bbb57e9c96


# edf1018372be202f7c489c9b9a9b49021e0c3551 02-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Removed a superfluous check.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37851 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ca215dfe683e040f0a44917f26cef0d7d439e59a 02-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Replaced more occurences of EOPNOTSUPP with B_NOT_SUPPORTED.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37847 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 845a29a0548e12d405ca6ba3d86d9d5e5ee19e30 02-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* B_SELECT_{READ|WRITE|ERROR} are no flags fields, so they cannot be or'ed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37834 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 988d8d4088db4b7d73bd1f8641a53b20f3a411a3 23-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* If an error is notified, also forward the even to read/write.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37713 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f8288ec75c70a031af1c778fc16664e69dad0ec5 15-Dec-2009 Axel Dörfler <axeld@pinc-software.de>

* Made sure the sockaddr::sa_len field is set correctly for sendto(), and
connect().
* This fixes not working connections whenever the incoming sa_len field happened
to be zero.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34669 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 78888c44da518b5a28135c7b3e79013e283789d4 15-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

Applied patch by Ma Jie adding functionality needed by mDNSResponder:
* added new protocol method process_ancillary_data_no_container() that does not
need a container to fill the cmsghdr data.
* Added support for the IP_RECVDSTADDR option using this call.
* Implemented support for IP_MULTICAST_IF.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31585 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f54023cf37881aa7859b9717576821676211e07c 28-May-2009 Michael Lotz <mmlr@mlotz.ch>

Propagate error codes in FIONREAD. Fixes bug #3973.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30896 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2ae482f58221463e2b58752696085d0881fecda7 17-May-2009 Michael Lotz <mmlr@mlotz.ch>

Implement the FIONREAD ioctl for sockets. We already supported it in userland
but the kernel part was missing. It is used to query for the buffer size that
can be retrieved using recv(). It returns the same value we use for the read
select().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30786 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9431509f5c1c661a6f6f4665198f5d3b24826d9d 30-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed broken socket_get_next_stat() that was responsible for bug #3830.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30500 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6f440aed2ce4661713c3ac19a16bfdceaeccbeb4 24-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* net_socket_module_info::acquire_socket() now returns whether or not the
socket could be acquired, ie. when its reference count is 0, it cannot be
acquired anymore. This requires the protocol to do proper locking, though.
* The TCP EndpointManager now checks the return value of acquire_socket(), and
only returns the endpoint if that succeeded.
* This fixes bug #2197.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30363 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 22e78d6e65fb5321d86a906c4e2a761cb0c0db4d 15-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Another error found by Romain: the socket's mutex could be destroyed twice
in socket_create(). Thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30201 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7caa5d430cc528b48b62888aeb7fd445f712d8cd 16-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Now gets the net_socket module in init_stack() to make sure it's initialized
as long as the stack is loaded.
* This fixes another regression from moving the socket API into the kernel.
* Thanks to Romain for reporting this!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30198 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ddd8303099fe840501790b342b027ba344b1071a 16-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Added "is_in_socket_list" member to determine whether the socket is in the
sSocketList or not (to see if it has to be removed when the socket is
deleted).
* This fixes the bug reported by Romain when trying to open an unsupported
protocol (like AF_INET6). Thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30188 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8aa910b94c650c7a53823fe3c13d40813cc2fd2a 08-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Added missing SO_TYPE.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30032 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6fc2d92bd301bda6584a00c6f5bd7680ec433ca8 08-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed the buggy GCC4 work-around.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30017 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9b4cfa9d3b27c8068753791e77ed110ed0cb438a 07-Apr-2009 François Revol <revol@free.fr>

This fixed gcc4 build (overloaded == operator...) though I'm not sure it's what was meant. Please check.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30008 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 42d0ef6fe4ff6cb2da56d87494af94afbaa8f420 07-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* dump_socket() now also prints the actual parent again (not just its
WeakPointer).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30003 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1111232758bd76e4ce4e7f6daddd7334249db818 07-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Sockets now inherit from WeakReferenceable.
* This fixes the problem when a socket changes something with regards to its
parent.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30000 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ab134c0a9a545b324e2ce88728e60bb1d49dfa23 06-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* socket_delete() now also supports deleting children that still have a parent;
added a potentially dangerous TODO, though (will look into this tomorrow).
* Improved output of the KDL command, and also include the child sockets in the
list.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29986 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 293e82ab1d0c95fb1a157911f40fb652e3368905 06-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Added KDL commands to inspect sockets ("socket", and "sockets").


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29984 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b32dfac5f4460ccb498d2584ba16f29b9b9f543a 06-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Now uses DoublyLinkedList instead of the struct list C stuff.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29981 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 77817877ce62981aaa259eb1af16754ca972ba89 04-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28500 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 27e0dea9f0bbc7db87e04d09fa707f8790575918 11-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Actually implemented the SO_BINDTODEVICE socket option I added some time ago.
* This makes it possible to select a specific device, even if no interface
has been configured for it yet. To make it work, each interface now has a
private direct route which will be returned if a socket is bound to a device.
* This will be used for example in DHCP to make it work when more than one
adapter is attached.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27983 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2b07b8e0f1a7f1e76f31db24a21a42cbb01d7b9c 28-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced all instances of benaphores in the kernel code by mutexes.
* Removed kernel benaphores.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25690 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cdc00dadfc37de5c4c37a45e90ec2e61633d7f60 02-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added optional {send,read}_data_no_buffer() hooks to the protocol
module interface. They directly operate on iovecs and thus allow
protocols that don't need it to avoid the creation of a net_buffer.
* Adjusted the socket module to support the new hooks. If they are
present, they will be chosen over the old hooks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25299 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 49e00d1f99fa525355674427039e360eb96c574b 02-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved the container management for ancillary data from the net_buffer
module to the stack module. There's a dedicated struct
ancillary_data_container, now. One can just set the container on a
net_buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25292 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e9488bd9e62d599cc4905ff3a1af0fdb9932be04 29-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed bogus select notifications in socket_close(). This is really
not necessary, since the VFS makes sure (or should at least) that all
events are deselected when close() is called. ~0 isn't a valid event
anyway.
* Removed delete_select_sync_pool() in socket_free(). It's not
necessary, since the select_sync_pool is auto-destroyed when the last
event has been deselected (which the VFS should take care of).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25265 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5843f17cb8553357042a00ebbf28256498778b8d 23-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

When splitting the send request into multiple buffers, we must
succeed after we have successfully sent the first buffer, even if not a
single byte of some following buffer could be sent. We should probably
even succeed whatever the error code -- not sure what is the reason
for only doing that for B_WOULD_BLOCK and B_INTERRUPTED.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25121 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 97cdbb548e22a4e467360b8e7d850f13ab5ff9be 12-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for sending/receiving ancillary data. The protocol modules
have two more optional hooks for attaching supplied ancillary data to a
net_buffer and for processing received ancillary data. Not sure, if that
is flexible enough for all kinds of ancillary data, but it is for
SCM_RIGHTS and also should for SCM_CRED[ENTIAL]S (if we ever decide to
implement one of those) -- don't know any other types on other protocol
levels.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24941 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 75015ff525050d1d716f499732c566956c6078ad 11-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed THREAD_FLAGS_IOCTL_SYSCALL to THREAD_FLAGS_SYSCALL,
syscall_restart_ioctl_is_restarted() to syscall_restart_is_restarted,
IoctlSyscallFlagUnsetter to SyscallFlagUnsetter, and
IoctlSyscallRestartWrapper to SyscallRestartWrapper, as they are no
longer only used for ioctl().
* Removed unused syscall_restart_ioctl_handle_post().
* Made SyscallRestartWrapper a lot fancier. Instead of storing a
reference to the result value, it stores the value itself, and it
features all the interesting operators that make it appear like that
value. This simplifies the use of the class quite a bit.
* THREAD_FLAGS_SYSCALL is now set for all socket function and the
read[v](), write[v]() syscalls.
* Added is_syscall() function and net_stack hook to the net stack.
* Removed "kernel" parameter from all net_stack_interface and net_socket
module hooks. They aren't need any longer, since is_syscall() can be
used instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24914 a95241bf-73f2-0310-859d-f6bbb57e9c96


# df50f7a9b4b0bbe77413d722875b0a346c61d527 10-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed the way the socket functions work:
- The net_stack driver is no longer used. Instead we have a kernel
module which is directly used by syscall implementations in the
kernel. I.e. we no longer tunnel those functions through ioctls, but
have normal syscalls.
- Removed the superfluous net starter module.
- Implemented the FDTYPE_SOCKET type file_descriptors, that is sockets
are no longer vnode based.
- Adjusted libnetwork (the socket function implementations)
accordingly.
- Adjusted netstat accordingly.
* Socket module:
- Implemented socketpair().
- Added "kernel" parameter to the control hook. Quite a few more hooks
would actually need the parameter, but I didn't change those yet,
since that would probably also require changes to the protocol
module interface.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24908 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0db772c9371eaaf42affeb38a2386fb9589fc0c9 21-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* When deleting a socket, we also need to delete all of its children.
* This fixes a KDL I often seen when launching firefox.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24046 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6f58064f104ef231faed3c2259885065c4242eaa 07-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* Added flags field in net_protocol_module_info; there is currently a single
defined flag: NET_PROTOCOL_ATOMIC_MESSAGES.
* socket_send() now honours NET_PROTOCOL_ATOMIC_MESSAGES and returns either
EMSGSIZE if the data to be send is larger than net_socket::send::buffer_size,
or divides the data in appropriately sized chunks.
* This fixes sending >=64K over a TCP socket at once (TCP would just have
returned an error in that case).
* TCP now overrides the default send buffer size (to 32768 for now).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23915 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 15ab0bcf01ef7bd7323d9b2da55906bafbb40fd3 21-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* int32_t, uint32_t are now of type "int", and no longer of type "long".
This should help to reduce the number of warnings imported code will throw
during compilation (helps a lot with tcpdump, for example).
* Since long is 64 bit on 64 bit platforms, we might want to think about doing
that change for the Haiku types int32 and uint32 as well.
* Fixed several occurences of hidden type problems.
* Fixed build of the stack and TCP under BeOS.
* Fixed incorrect typedef in socket_interface.h.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22643 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 636bfc08aeaaa7f1bab813c5aa2e8e666b40ec64 02-Oct-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed fs/vfs_select.cpp to wait_for_objects.cpp and got rid of
vfs_select.h, respectively moved most of it into the new kernel
private header wait_for_objects.h.
* Added new experimental API functions wait_for_objects[_etc](). They
work pretty much like poll(), but also for semaphores, ports, and
threads.
* Removed the "ref" parameter from notify_select_events() and the
select_sync_pool functions as well as from fd_ops::fd_[de]select(). It
is no longer needed. The FS interface select() hook still has it,
though -- the VFS will always pass 0.
* de]select_fd() take a select_info* instead of a select_sync* + ref
pair, now. Added respective functions for semaphores, ports, and
threads.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22416 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f5a92f59e47a71647d76851c70fc543ed6b1f9d3 04-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21550 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 79a0d25245275ef5f65afd610279dc9befffd65e 22-May-2007 Hugo Santos <hugosantos@nowhere.fake>

net_buffer: preparing for better metadata management


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21210 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45b5203b786a318040f09aafd9b7d86877d30fe9 08-May-2007 Hugo Santos <hugosantos@nowhere.fake>

network stack: getsockopt/setsockopt are no longer optional for protocols, as suggested by Axel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21085 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 73f1548be1fc6bc5bca6fe7ef4d8514588da8ca3 30-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

some getsockopt/setsockopt and multicast fixes.

* allow an ipv4 bind() to a multicast address.
* bumped getsockopt/setsockopt kernel driver buffers to 256 bytes to at least handle structures which take one sockaddr_storage.
* convert generic multicast delta API names to IPv4 ones before handling the specific option.
* changed ipv4_getsockopt/ipv4_setsockopt a bit as the code gcc 2.95 was generating was a bit too funky.
* properly pass setsockopt/getsockopt to handling protocols.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20939 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 57967505c2947a442e0a1185ab7a3930786787cc 29-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

fixed getsockopt/setsockopt callchains. also fixed the cleanup of multicast filters.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20923 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 66a4a428020db4e26cda68ffe4b3dd6f1bed88c2 25-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

added Recv-Q/Send-Q output to netstat.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20819 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2445c00e6420e2b365cba47c758b66fc04e75f59 19-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

some internal reorganization of getsockopt()/setsockopt() handling. TCP is now able to fully use the application requested sender/receiver buffer sizes for improved performance.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20764 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8107b1940338a62198e77f9d4c9007f048f00915 09-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

Fixed some more TCP issues.

- Properly flag sockets using non-blocking connects() when in SYN SENT.
- and when in LISTEN, we should use the socket's connection queue size.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20631 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a5e902668881dc45ecff2cf7c1dd8ab8b626a8ed 05-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

copy back the source address even when the data is truncated


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20586 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 485a82e6138d43169c89cf93d5789e4d6c912204 05-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

as per the Open Group Specification, MSG_TRUNC should be set in flags whenever the packet is truncated


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20583 a95241bf-73f2-0310-859d-f6bbb57e9c96


# abe1ec18ac0e70d36b0cc595fc176ea4dd9df818 05-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

properly support MSG_TRUNC. we don't even have to trim the buffer, just try to fill the user buffers as much as possible


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20582 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 17b77c3b928bee0a1d3daf0022c5157fd7146570 05-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

consolidate all RECV/SEND ioctls into a single RECEIVE/SEND pair

- changed the socket module to use thew new RECEIVE/SEND in all forms of recv() and send()
- changed libnetwork to use the new RECEIVE/SEND
- remove transfer_args processing from strace since the structure was removed


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20581 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c96b101d4d7b2efd9c64004f20b9ef810bf8284f 04-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

net_socket: make recvfrom() use recvmsg() and sendto() use sendmsg() for code reusal


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20565 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7245533300ddb71bf1ad854a1e64c92d10294c70 04-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

some fixes to recvmsg() and sendmsg()


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20563 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dae7f8ea467af95879f02fbc4d7dc4d804fea799 04-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

initial recvmsg and sendmsg implementations


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20562 a95241bf-73f2-0310-859d-f6bbb57e9c96


# de8a7c2680a0c9a7bf106f376fb9e5bc0935604e 08-Jan-2007 Axel Dörfler <axeld@pinc-software.de>

* Introduced a reader_thread member to the private net_device_interface.
* When shutting down an interface, we now wait until its reader thread is gone, too;
this is necessary in case the kernel unloads the networking stack before the reader
thread had a chance to exit.
* Added some debug output to net_socket in case you ask for unknown options.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19741 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4684dfec2d1f5dd2a1064ce8768a15e782a9ad64 31-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

socket_connected() now notifies waiting selects().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19662 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 79608a2de794aaba387e90c9daeed3bdced0dfde 18-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

* Moved some private members of net_socket into the new net_socket_private structure.
* Added an "owner" field that stores the team which created the socket (for netstat only);
we would need a different storage for SIGURG if we ever want to support that.
* Improved netstat address output: now prints "*" instead of INADDR_ANY.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19562 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8dfd7ea7bf7714ff094a69f120771e6c6465262e 18-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

* Implemented a basic infrastructure for a netstat command.
* Started a netstat command.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19560 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5869c1e7f35f31a32ffd44a378400e42893e857a 04-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

* sending now detect partial writes and does not return an error in that case.
* writev() now also calls bind() if needed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19428 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f4b9215615558e9a627a1f4a13b40e5e85d34378 04-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

Don't hold the socket's lock when calling socket_read_avail() or socket_send_avail().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19423 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 94fb808a48e8a9a15392df0a309ee118c6b828f2 30-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* socket_spawn_pending() forgot to set the socket's parent field.
* socket_recv[from]() now accept a NULL buffer in case there was nothing to read.
* the tcp_tester's server thread now actually reads the data it receives.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19400 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 41c67263593f5155d5f44e2c66b16ea430012967 30-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Moved the starting of the network stack into the driver (from the socket module)
to allow other protocols (like TCP) using the socket module.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19399 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7c0541c12f717b103c8ca80e16ac9ed2d09b0393 25-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Build fix; I obviously forgot to compile the stack itself after the changes :-/


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19368 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a62711893694f50860b7f8f4eab3d644840f789f 24-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Added support for setting/getting: SO_NONBLOCK, SO_RCVTIMEO, SO_SNDTIMEO,
SO_RCVLOWAT, and SO_SNDLOWAT.
Lowered the default buffer size to be within the uint16 size.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19367 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ead36a7efb8a8db28b838f3fec07524fc96ba459 11-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

The pending/connected connection lists were not initialized.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19258 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b70a062dc55e021d14e6a7a17bed0aff1d2d5214 11-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* Separated create_socket() and the call to the protocol's open() function - open()
is not supposed to be called for accepted sockets, only for those created via
a call the userland socket() function.
* Renamed net_socket_module_info::socket() to open_socket() to make this distinction
a bit clearer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19254 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d2021d5766d139a90b2415fc930247702a670168 10-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

* Took Philippe's hints into account - we now do some locking in socket_spawn_pending() :-)
* Also take the max backlog into account as set by listen() - but reserve a little
extra room for never completing connections, and that listen(..., 0) always accepts
at least a single connection (as the BSDs do).
* Spawned connections won't accept new connections, so SO_ACCEPTCONN must be cleared.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19248 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 44b3faaa198798c44a9f3bd9a98e5ccda2252fe1 10-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

socket_accept() now checks for SO_ACCEPTCONN before calling the protocol's
accept function to enforce valid codepaths (you need to call listen() before
accept()).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19247 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1a0e92a33be1e14561123a9e854d31276b8417fa 09-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented backlog/pending connection support to the sockets - while currently
only TCP needs this, other stream oriented protocols might too, in the future.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19236 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ee50138fcd0d6d4e4139d7c57837139c6fd7f55e 06-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

Now notifies all pending selects when closing the socket.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19018 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a7028ce6802b20c7fea03c8b4defa0770a50b850 06-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* Implemented select support for sockets and notifications, not yet tested, though;
this closes ticket #811.
* Added notification support to IPv4 and UDP.
* Implemented reading out SO_ERROR.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19017 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 340cd7be3a4bc9f78644888d6194d21bd222c946 10-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* socket_getsockopt() now supports all boolean SO_* options as well.
* socket_listen() now sets the SO_ACCEPTCONN flag if it succeeds.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18476 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 943cedf784ca021e80067dc978c09a5f31c0e44a 10-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

setsockopt() now understands all boolead options.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18475 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c22d69bf1f5f60f7ebddd79108a53c8f97f300fe 08-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* Completed the previous commit and merger of the team/network/new_stack branch.
* Removed ppp_up and pppcontrol from the image for now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18457 a95241bf-73f2-0310-859d-f6bbb57e9c96