History log of /haiku/src/add-ons/kernel/network/stack/stack.cpp
Revision Date Author Comments
# afeee285 06-Mar-2024 Jérôme Duval <jerome.duval@gmail.com>

network/stack: fix trace build

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


# 71522c93 18-Nov-2023 François Revol <revol@free.fr>

net: Rename IFT_TUN to IFT_TUNNEL as on BSD

We already use their value, let's use the name too.

Change-Id: I5afbd69923ae3b5e702dfb935a709c3069de5365
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7146
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: François Revol <revol@free.fr>


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

network: Overhaul TUN/TAP subsystem.

* Rename the "tun" network device to "tunnel". FreeBSD calls theirs
"tuntap" but speaks of both TUN and TAP devices as interfaces for
tunnels. The other BSDs seem to do likewise.

* Fold the "tun" driver into the "tunnel" network device. The
network device now publishes entries in devfs when interfaces
are created, and unpublishes them when interfaces are destroyed.

This removes the need for the driver and device to communicate
through a file descriptor, and thus allows the receive queue
to be totally eliminated, massively simplifying that logic.

* Use standard net-stack FIFOs instead of TCP BufferQueue, which is
specialized to TCP's needs in far too many ways. Thanks to the
previous commit adding support for interrupting semaphore waits,
we can use the FIFO wait mechanisms, too.

* Restructure the TAP logic, and generate MAC addresses more like
Linux does.

* Actually set type = IFT_TUN, and use the "loopback" frame handler
instead of the "ethernet" frame handler. This allows significant
cleanup of the header handling logic.

* In TUN mode, reject packets that don't look like IP packets.

* Delete "tunconfig"; it was mostly stubs and is now unnecessary.

TUN mode tested and confirmed as working by kallisti5 with OpenVPN.
TAP mode partially tested, but not yet confirmed as working.

Fixes #18673.

Change-Id: Ibd803139474e8db556a4f567901da15ee4083621
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7143
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


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

network/stack: Enumerate TUN after loopback.


# 47f43bcc 16-Jun-2023 Swangeon <swangeon@gmail.com>

network/tun: rewritting tun driver and tun module for modern code base

Change-Id: Idf7ab6d2aa2b4f8cb4893053b531d2eae7418427
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6608
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


# f1f04fa6 28-Oct-2018 Augustin Cavalier <waddlesplash@gmail.com>

network/stack: Correct deinitialization order.

DeleteChains() needs the chain locks and domains, so those need to
be uninitialized after them. This now matches the constructor's
deinitialization order.

Fixes a panic exposed by the previous commit.


# 4dfbf1d0 01-Jan-2016 Augustin Cavalier <waddlesplash@gmail.com>

network/stack: #if 0 out ppp_frame datalink protocol.

Forgot to do this in previous push.


# e3724c38 04-Jan-2014 mshlyn <linlongzhou@163.com>

PPP: Port to the new stack.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>

This is a squash of the 42 commits by @mshlyn, as I couldn't find a
way to break them into logical chunks. I did not include these in the build,
as it appears that they only partially work anyway, and much more cleanup is
still needed. However, this is a huge improvement on what was in the tree
before, which looked horrendous and didn't even compile (as it was designed
for the old stack).

Mostly fixes #812.


# c4718ea9 12-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Missing std::nothrow on new

Forgot to add this when migrating to BOpenHashTable.


# d4aabe75 09-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Network stack: migrate to BOpenHashTable


# e4a05be4 07-Jan-2013 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Use close_module_list() to free the list.
There are a pair of Coverity CIDs for these two.


# 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.


# 3f7e748f 17-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Made the code a bit more robust against faulty use.


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


# 61729d93 28-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* Reworked the complete stack to allow more than one address per network
interface - this caused quite a number of changes.
* Network interfaces, and its addresses are now reference counted (not yet
complete, though, InterfaceAddresses need to hold references to their
interface as well).
* There are two known regressions of this commit that I will fix later:
- you cannot remove interfaces anymore
- IPv4 multicast was broken anyway, but now it's disabled, too.
* Moved a device_interfaces.cpp|h out of interfaces.cpp.
* The datalink layer chain is now instantiated per domain per interface,
not just per interface anymore.
* When a buffer reaches the network layer, it has no known interface yet, ie.
the ipv4|6|whatever modules need to set this manually.
* Added more debug output, and some new debugger commands, the control option
is now printed in clear text.
* Added hash_address() function to the address modules. Added "const" to
set_to_defaults() where needed.
* Fixed net_buffer's restore header functions offset use as reported by Atis.
* Improved buffer dump output, use the domain module to print the address if
available.
* Moved net_buffer::type into the union, as it's not needed by the upper layers
anymore.
* Moved IPv6 specific code from {add|remove}_default_route() to where it
belongs, but disabled it for the time being.
* Completely discarded useless ipv4_datagram module.
* Added ping6 to the build.


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


# 8d1485fa 19-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

Work in progress commit by Atis Elsts (I'm posting his ChangeLog comments
directly here), I made only a few style changes:
* introduced 'has_broadcast_address' field in
struct net_address_module_info
- REVIEW: the name, and the status of this field for UNIX and L2CAP
families
* ipv6 address family support
* ipv6 address printing
* ipv6 protocol support
* ipv6 multicast support
- TODO: add and remove multicast routes in a more proper way
- TODO: support MLD
* ipv6 datalink protocol support
* icmpv6 protocol support (EchoRequest and EchoResponse messages)
* ipv6 neigbor discovery protocol support
(Advertisement and Solicitation messages)
- TODO: only the very basic support is present,
the protocol state machine is by no means completed
- TODO: replying to Solicitation does not work too good ATM
(visible, when pinging Haiku from outside)
* added Jenkin's hash algorith
* minor changes in existing IPv4 code - cleanup function
ipv4_get_loopback_address(), written by myself
* add tests: raw, udp, tcp/udp, mullicast sender
* add 'hoplimit' field in struct net_buffer
- TODO: this is just a hack, more generic approach would be better.
* add 'receive_data' function pointer in
struct net_datalink_protocol_module_info
- TODO: this is also more like a hack, to support information
passing from ICMPv6 to IPv6_datagram level.


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


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

* struct family now uses a DoublyLinkedList instead of a struct list.
* Added but commented out adding/removing chains to its family: this would allow
the stack to unload protocol modules as soon as they are no longer needed.
However, it currently does not work yet (double lock, we need a recursive lock
here to allow this).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30199 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


# e6dd439f 09-Dec-2008 Axel Dörfler <axeld@pinc-software.de>

* Work-in-progress of a network notification implementation.
* Compiles, but doesn't work at all yet. For those who wonder: the networking
notifications are put into a separate module, so that the network stack can
be unloaded without losing connection, IOW user applications will continue
to retrieve notifications when the stack is loaded again.


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


# 491da20d 19-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a is_timer_running() function.


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


# 9e8be8bb 15-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a net_timer::flags field, and used it to implement the new
wait_for_timer() function.
* Moved the internal Fifo class into utility.cpp - we should probably just
remove it again.
* Fixed uninit_timers() so that it would even work in combination with the
timer thread if there are timers left to be scheduled.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26980 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


# 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


# 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


# 05849428 17-Feb-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

axeld + bonefish:
* Added syscall restart support for connect(), accept(), send(), recv(),
which are implemented via ioctl()s. The actual restart support is done
in the net stack driver's ioctl() hook. Lower layers need to correctly
deal with socket timeouts, though, for which the stack module provides
support functions.
* TCPEndpoint::_WaitForEstablished() does abort now when an error
occurred earlier, so that trying to connect to an unused port fails
immediately, as it should.
* Fixed and refactored TCP connection reset handling. The new
TCPEndpoint::_HandleReset() does the job. Got rid of
TCPEndpoint::fError.
* Fixed sequence numbers for SYNC/FINI packets.
* The former two fix the problem that connections wouldn't be closed
correctly and could even be reused when trying to connect again (as
was reproducible with svnserve + svn).
* Some style cleanup in CPEndpoint.h.



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


# 157da1cd 22-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* net_buffer is a module, so it shouldn't have its initializers called
indirectly by the stack - they are now again usable separately as well.
* Minor cleanup.


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


# 969885b8 23-May-2007 Hugo Santos <hugosantos@nowhere.fake>

loop: no longer requires a reader thread, it delivers directly to the device's receive queue


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


# 457b03ec 26-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

net_buffer is the first user of the new slab allocator, let's see how it goes.


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


# 658a5506 13-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

use module_dependencies to load the required modules by udp, tcp, ipv4, icmp and arp.


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


# d438fa4c 12-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

added buffer, datalink and socket module references to the stack module so we don't have to load them in each other module.


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


# bfb45f71 12-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

introduced a new helper class DatagramSocket which provides a consistent base interface and functionality for the implementation of datagram-based sockets.

- made the ipv4 raw, udp and link protocols use DatagramSocket.


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


# eaf51721 08-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

introduced an ipv4_datagram datalink_module to handle the registration of the IPv4 reader instead of doing it in the ARP module.


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


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

introduced fifo_socket_enqueue_buffer which clones the buffer, enqueues it to the fifo and notifies the socket.

- changed the link, ipv4 and udp modules to use fifo_socket_enqueue_buffer


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


# 9206bb37 04-Apr-2007 Axel Dörfler <axeld@pinc-software.de>

* Changed ETHER_GET_LINK_STATE ethernet driver interface, added ETHER_SET_LINK_STATE_SEM.
* The device interface list now uses class DoublyLinkedList instead of struct list.
* Implemented SIOC[SG]IFMEDIA for setting (not supported by any device yet), and
retrieving the device media information.
* Fixed a locking bug in list_domain_interfaces().
* Added new stack function device_link_changed() that should be called in case the
link state (media) changed.
* The ethernet device module now spawns a thread and will periodically check the media
state of all ethernet devices that support this (if any).
* Minor cleanup.


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


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

Calmed down the networking stack a lot - since it basically works, there is no
reason to slow it down with debug output that much; this will also help investigating
some issues where you just aren't interested in most of the output.


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


# 2bd388f6 29-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Added two more utility functions to the timer service:
* cancel_timer() cancels a timer, and returns true if the timer was running
* is_timer_active() determines if the timer is currently running or not.


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


# 9f0c924a 14-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented loopback device - currently crashes the kernel pretty fast, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19065 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


# 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


# c4718ea973dc20d96ddf1c8b164ed5ca514b8ca5 12-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Missing std::nothrow on new

Forgot to add this when migrating to BOpenHashTable.


# d4aabe75c3fc1cdf93871ab15c12e02eb6761200 09-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Network stack: migrate to BOpenHashTable


# e4a05be459682b52c22686731413b6a26be13ff7 07-Jan-2013 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Use close_module_list() to free the list.
There are a pair of Coverity CIDs for these two.


# 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.


# 3f7e748f91a34408f4669fb6907d5acb1bb6c739 17-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Made the code a bit more robust against faulty use.


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


# 61729d9323a555b9025ef6ebeb85dc1627f8acf7 28-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* Reworked the complete stack to allow more than one address per network
interface - this caused quite a number of changes.
* Network interfaces, and its addresses are now reference counted (not yet
complete, though, InterfaceAddresses need to hold references to their
interface as well).
* There are two known regressions of this commit that I will fix later:
- you cannot remove interfaces anymore
- IPv4 multicast was broken anyway, but now it's disabled, too.
* Moved a device_interfaces.cpp|h out of interfaces.cpp.
* The datalink layer chain is now instantiated per domain per interface,
not just per interface anymore.
* When a buffer reaches the network layer, it has no known interface yet, ie.
the ipv4|6|whatever modules need to set this manually.
* Added more debug output, and some new debugger commands, the control option
is now printed in clear text.
* Added hash_address() function to the address modules. Added "const" to
set_to_defaults() where needed.
* Fixed net_buffer's restore header functions offset use as reported by Atis.
* Improved buffer dump output, use the domain module to print the address if
available.
* Moved net_buffer::type into the union, as it's not needed by the upper layers
anymore.
* Moved IPv6 specific code from {add|remove}_default_route() to where it
belongs, but disabled it for the time being.
* Completely discarded useless ipv4_datagram module.
* Added ping6 to the build.


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


# 8d1485fa06b26cb13b0417e3cdafd5b45520a567 19-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

Work in progress commit by Atis Elsts (I'm posting his ChangeLog comments
directly here), I made only a few style changes:
* introduced 'has_broadcast_address' field in
struct net_address_module_info
- REVIEW: the name, and the status of this field for UNIX and L2CAP
families
* ipv6 address family support
* ipv6 address printing
* ipv6 protocol support
* ipv6 multicast support
- TODO: add and remove multicast routes in a more proper way
- TODO: support MLD
* ipv6 datalink protocol support
* icmpv6 protocol support (EchoRequest and EchoResponse messages)
* ipv6 neigbor discovery protocol support
(Advertisement and Solicitation messages)
- TODO: only the very basic support is present,
the protocol state machine is by no means completed
- TODO: replying to Solicitation does not work too good ATM
(visible, when pinging Haiku from outside)
* added Jenkin's hash algorith
* minor changes in existing IPv4 code - cleanup function
ipv4_get_loopback_address(), written by myself
* add tests: raw, udp, tcp/udp, mullicast sender
* add 'hoplimit' field in struct net_buffer
- TODO: this is just a hack, more generic approach would be better.
* add 'receive_data' function pointer in
struct net_datalink_protocol_module_info
- TODO: this is also more like a hack, to support information
passing from ICMPv6 to IPv6_datagram level.


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


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

* struct family now uses a DoublyLinkedList instead of a struct list.
* Added but commented out adding/removing chains to its family: this would allow
the stack to unload protocol modules as soon as they are no longer needed.
However, it currently does not work yet (double lock, we need a recursive lock
here to allow this).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30199 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


# e6dd439f7c1c4b5e8b83362d93f891237e6a7d8a 09-Dec-2008 Axel Dörfler <axeld@pinc-software.de>

* Work-in-progress of a network notification implementation.
* Compiles, but doesn't work at all yet. For those who wonder: the networking
notifications are put into a separate module, so that the network stack can
be unloaded without losing connection, IOW user applications will continue
to retrieve notifications when the stack is loaded again.


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


# 491da20dbf296d9fdf44ae5fffde54f254059f4d 19-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a is_timer_running() function.


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


# 9e8be8bb9c7c2f02c2b109654c4bdab659654a82 15-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a net_timer::flags field, and used it to implement the new
wait_for_timer() function.
* Moved the internal Fifo class into utility.cpp - we should probably just
remove it again.
* Fixed uninit_timers() so that it would even work in combination with the
timer thread if there are timers left to be scheduled.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26980 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


# 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


# 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


# 058494285aafd433af5618aeb52abd76a4b39c6a 17-Feb-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

axeld + bonefish:
* Added syscall restart support for connect(), accept(), send(), recv(),
which are implemented via ioctl()s. The actual restart support is done
in the net stack driver's ioctl() hook. Lower layers need to correctly
deal with socket timeouts, though, for which the stack module provides
support functions.
* TCPEndpoint::_WaitForEstablished() does abort now when an error
occurred earlier, so that trying to connect to an unused port fails
immediately, as it should.
* Fixed and refactored TCP connection reset handling. The new
TCPEndpoint::_HandleReset() does the job. Got rid of
TCPEndpoint::fError.
* Fixed sequence numbers for SYNC/FINI packets.
* The former two fix the problem that connections wouldn't be closed
correctly and could even be reused when trying to connect again (as
was reproducible with svnserve + svn).
* Some style cleanup in CPEndpoint.h.



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


# 157da1cd6e329a107d5a1fddd644cdab280a779e 22-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* net_buffer is a module, so it shouldn't have its initializers called
indirectly by the stack - they are now again usable separately as well.
* Minor cleanup.


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


# 969885b848f0c40027ab6b13df58b4f656e6274f 23-May-2007 Hugo Santos <hugosantos@nowhere.fake>

loop: no longer requires a reader thread, it delivers directly to the device's receive queue


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


# 457b03ecb40c3317bd31df1f2ef4ff01b38007e8 26-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

net_buffer is the first user of the new slab allocator, let's see how it goes.


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


# 658a550639d1b3ec33c934583d065c81bee46298 13-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

use module_dependencies to load the required modules by udp, tcp, ipv4, icmp and arp.


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


# d438fa4c124c7dd113ccfb6f9badae5d18354af0 12-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

added buffer, datalink and socket module references to the stack module so we don't have to load them in each other module.


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


# bfb45f717c648c5cd68e84c8ca1f805d099ba3c5 12-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

introduced a new helper class DatagramSocket which provides a consistent base interface and functionality for the implementation of datagram-based sockets.

- made the ipv4 raw, udp and link protocols use DatagramSocket.


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


# eaf517212a28192593f4880702b1c23911fe35d0 08-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

introduced an ipv4_datagram datalink_module to handle the registration of the IPv4 reader instead of doing it in the ARP module.


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


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

introduced fifo_socket_enqueue_buffer which clones the buffer, enqueues it to the fifo and notifies the socket.

- changed the link, ipv4 and udp modules to use fifo_socket_enqueue_buffer


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


# 9206bb37797df1a6448d3f1c336e954b4ddb790d 04-Apr-2007 Axel Dörfler <axeld@pinc-software.de>

* Changed ETHER_GET_LINK_STATE ethernet driver interface, added ETHER_SET_LINK_STATE_SEM.
* The device interface list now uses class DoublyLinkedList instead of struct list.
* Implemented SIOC[SG]IFMEDIA for setting (not supported by any device yet), and
retrieving the device media information.
* Fixed a locking bug in list_domain_interfaces().
* Added new stack function device_link_changed() that should be called in case the
link state (media) changed.
* The ethernet device module now spawns a thread and will periodically check the media
state of all ethernet devices that support this (if any).
* Minor cleanup.


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


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

Calmed down the networking stack a lot - since it basically works, there is no
reason to slow it down with debug output that much; this will also help investigating
some issues where you just aren't interested in most of the output.


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


# 2bd388f69679fcc496cb2c376d7ec5ec20be6f72 29-Nov-2006 Axel Dörfler <axeld@pinc-software.de>

Added two more utility functions to the timer service:
* cancel_timer() cancels a timer, and returns true if the timer was running
* is_timer_active() determines if the timer is currently running or not.


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


# 9f0c924a5409f201f489c79bf764f81b18a5cef0 14-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented loopback device - currently crashes the kernel pretty fast, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19065 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


# 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