Commit Graph

82 Commits

Author SHA1 Message Date
Hugo Santos 624c52d8b7 ARP now queues packets while resolving a destination instead of blocking on send_data(). This fixes several issues:
- TCP now behaves correctly when receiving new connections as its SYN/ACK is queued, or if lost correctly retransmitted when the peer resends a SYN.
 - The first ICMP Replies from an external on-link host pinging Haiku are no longer lost.
 - Reduced the number of ARP messages Haiku needs to generate until resolving an entry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20712 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-15 21:00:12 +00:00
Hugo Santos 6a60618094 glued the multicast filter handling to the receive path: we are now capable of receiving multicast frames in datagram sockets.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20695 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-15 07:31:04 +00:00
Hugo Santos 6c501a4085 support RFC 3678's Protocol-Independent setsockopt()s for IPv4 multicast.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20691 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-15 03:07:28 +00:00
Hugo Santos 46527f6806 initial steps towards IPv4 Multicast Filter Delta API (RFC 3678)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20690 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-15 02:44:01 +00:00
Hugo Santos 49f3c71e21 respect SO_BROADCAST for received and sent datagrams.
- check if the destination address is specified in IPv4's SendData()
 - minor cleanups to IPv4's TRACE()s.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20681 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-13 21:33:13 +00:00
Hugo Santos 658a550639 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
2007-04-13 14:37:48 +00:00
Hugo Santos 57e2a3d584 only deliver frames to IPv4 raw sockets of the specified protocol.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20675 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-13 04:20:39 +00:00
Hugo Santos d438fa4c12 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
2007-04-13 03:06:36 +00:00
Hugo Santos bfb45f717c 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
2007-04-13 00:55:32 +00:00
Jérôme Duval b342ed59fb gcc4 is picky with in-template symbols, they must be qualified
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20668 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-12 18:17:31 +00:00
Hugo Santos 6c35350908 moved address selection logic to a new 'get_buffer_route'.
- IPv4 now assumes the addresses it is supplied in send_routed_data are already the appropriate ones.
 - made the Data(), operator* and operator-> methods in NetBufferFieldReader const so we can use them in the same expression as the constructor.
 - fixed an issue with UDP where the wrong source address could be used in the calculating the checksum.
 - changed ipv4_print_address to use the more common 0.0.0.0 format.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20660 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-11 22:24:12 +00:00
Hugo Santos 87001e059c some NetBufferUtility revamp.
- introduced base NetBufferFieldReader which deals with obtaining a continuguous field to deal with.
 - renamed Detach() to Sync() to better express the fact that we may be writing to the buffer.
 - Fixed IPv4's and ICMP's checksum calculation as it assumed the underlying header was contiguous.
 - ICMP is now able to reply to ICMP Echo Requests which were split across data nodes.
 - in split_buffer(), make sure we were able to trim() the new buffer before damaging the original one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20657 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-11 16:40:40 +00:00
Hugo Santos af56b5b233 fixed add_tcp_header() as it wasn't considering the possibility that prepending data would not result in a contiguous buffer. This would result in wrong checksums for apparent no reason.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20643 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-10 19:04:13 +00:00
Hugo Santos 8107b19403 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
2007-04-10 05:28:56 +00:00
Hugo Santos e53357d57a Prepared net_device_monitor to accept device removal events.
- Introduced public net_device_monitor.
 - Changed the link protocol to maintain a lock per instance instead of inside the FIFO. Now all of the link instance data is protected.
 - Adapted the link protocol to use net_device_monitor.
 - Introduced a private Fifo class which doesn't maintain it's own lock.
  - Maybe we should add something like a public net_protocol_implementation which maintains a fifo and a benaphore? With the fifo using the structure's lock instead of maintaining it's own.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20614 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-08 09:15:52 +00:00
Hugo Santos 0d5afa4dec 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
2007-04-05 17:56:20 +00:00
Hugo Santos 17b77c3b92 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
2007-04-05 14:26:46 +00:00
Hugo Santos dae7f8ea46 initial recvmsg and sendmsg implementations
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20562 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-04 17:39:43 +00:00
Axel Dörfler 9206bb3779 * 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
2007-04-04 09:41:04 +00:00
Axel Dörfler 1a3ab92b81 * Rewrote ether_driver.h, removed some BONE stuff we don't support at this point;
it might also be a good idea to change the constants to better match the usual
  style.
* Added a BSD-style if_media.h.
* Added interface flags IFF_LINK, IFF_AUTO_CONFIGURED, and IFF_CONFIGURING. The
  former will be set automatically by the stack, the rest will be set by the
  net_server depending on the current state.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20535 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-03 14:42:07 +00:00
Axel Dörfler 79608a2de7 * 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
2006-12-19 03:01:18 +00:00
Axel Dörfler 8dfd7ea7bf * 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
2006-12-19 02:06:07 +00:00
Axel Dörfler 26cbcedb9c Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19436 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-12-06 18:38:38 +00:00
Axel Dörfler bcb0dd2b3b The R5 compatibility is now turned off when the socket functions are used
within the library - theoretically, this mechanism could be extended to
turn the compatibility layer on and off based on the images that call the
functions (allowing to mix R5 and BONE network add-ons in a single executable).
This change fixes R5 networking apps such as Vision, and NetworkTime (both
now seem to work fine under Haiku).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19431 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-12-05 03:03:15 +00:00
Axel Dörfler 2bd388f696 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
2006-11-29 19:09:19 +00:00
Axel Dörfler 224e38e302 Added function to append cloned data from another buffer (to be used by TCP).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-11-25 14:30:54 +00:00
Axel Dörfler 604d21a600 * Added an offset/sequence field to the net_buffer - this can and will be used
by the TCP implementation for its reorder and retransmit queues.
* The ipv4_fragment is no longer needed, as we can use the above field there
  as well - this saves one extra allocation per received fragment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19369 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-11-25 11:29:36 +00:00
Axel Dörfler 3e30cbdb1e Added option to the NetBufferPrepend constructor to prepend an arbitrarily sized
piece of data, instead of the type size.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19335 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-11-20 17:56:17 +00:00
Axel Dörfler d47eebf30b * The select()/deselect() hooks now actually call the socket's request_notification()
and cancel_notification() functions.
* Completey dropped the old select code, as well as any R5 compatibility stuff. If
  we ever need it again, it's still in SVN history.
* The socket module was put in uninit_driver() for no reason.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19256 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-11-11 12:27:30 +00:00
Axel Dörfler b70a062dc5 * 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
2006-11-11 11:56:52 +00:00
Axel Dörfler 1a0e92a33b 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
2006-11-09 18:53:18 +00:00
Axel Dörfler c35b04de31 * Moved the TCPConnection class into its own file.
* Added some missing result checks, mostly for allocations.
* Fixed a wrong precendence with the ?: operator
* Some minor cleanup.
* Renamed sBufferModule to gBufferModule - the header expects it to be a global,
  so it should be named like one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19178 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-11-02 17:27:13 +00:00
Axel Dörfler 81435928fb * Fragmenting IP packets is now working as expected (there were several bugs
in the code before).
* Added a SetTo() method to NetBufferHeader.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19069 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-10-15 09:52:54 +00:00
Axel Dörfler a7028ce680 * 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
2006-10-07 12:32:02 +00:00
Axel Dörfler 153b2845d2 * Added a link from libnet.so to libnetwork.so for R5 compatibility.
* Fixed R5 socket definitions to match their actual definitions.
* libnetwork.so now detects at runtime wether or not R5 compatibility should be
  enabled or not.
* All socket functions should now be R5 net_server compatible.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19012 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-10-06 13:07:05 +00:00
Marcus Overhagen 891a127fec various gcc 4 related build fixes
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18876 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-09-17 17:34:22 +00:00
Axel Dörfler 241b048033 * Fixed build of libnetapi.so - it probably won't work for now, though, have a look
at the comment in r5_compatibility.h.
* Intentionally broke source compatibility and removed all that outdated Nettle stuff.
* Also, I took the liberty of making m_init private and rename it to fInit - again, this
  will only affect source compatibility.
* Rewrote NetEndpoint.h
* Fixed quite a few small bugs around the code that I touched, for example in NetAddress,
  SetTo() never set fInit, and therefore could be wrong.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18680 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-08-29 00:19:23 +00:00
Axel Dörfler c22d69bf1f * 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
2006-08-08 13:07:07 +00:00
Axel Dörfler 5adca30a18 Merge of branches/team/network/new_stack - not yet complete as SVN does only support
replacing files when merging when you don't have deleted them manually (for some reason,
it only works as part of the merge operation, and we didn't copy the whole tree to
have "a fresh start" - next time we know better, at least if SVN still suffers from
that same limitation).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18456 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-08-08 12:33:33 +00:00
Jérôme Duval 4e0eae1865 patch from Olivier Coursiere for better error output in ping
change the size parameter type of several functions in sys/socket.h to match POSIX
compat libs and legacy headers keep the original R5 type (though I make a change for this)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17911 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-06-23 12:22:26 +00:00
Waldemar Kornewald 8c85eedc66 Moved the needed headers from private to posix folder. This should hopefully fix the build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15590 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-19 17:42:05 +00:00
Waldemar Kornewald f7a223fa1b Removed unneeded libbind files (were never compiled, anyway).
Moved some headers around and cleaned them up.

Fixed threading code in libbind.so. Don't know why I hadn't noticed this before. Now it is reliable, but uses an even uglier hack.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15585 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-19 13:26:54 +00:00
Waldemar Kornewald c544064d35 Updated BIND resolver library (libbind.so) to version 9.3.1.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15570 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-16 22:38:13 +00:00
Waldemar Kornewald aa782b3ed6 Minor modification to net_stack_driver's header.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15499 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-11 20:09:13 +00:00
Ingo Weinhold 758b1d0e05 Fixes that make Haiku build with gcc 4. Mainly out of the following
categories:
* Missing includes (like <stdlib.h> and <string.h>).
* Linking against $(TARGET_LIBSTDC++) instead of libstdc++.r4.so.
* Local variables shadowing parameters.
* Default parameters in function definitions (as opposed to function
  declarations).
* All C++ stuff (nothrow, map, set, vector, min, max,...) must be imported
  explicitly from the std:: namespace now.
* "new (sometype)[...]" must read "new sometype[...]", even if sometype is
  something like "const char *".
* __FUNCTION__ is no longer a string literal (but a string expression), i.e.
  'printf(__FUNCTION__ ": ...\n")' is invalid code.
* A type cast results in a non-lvalue. E.g. "(char *)buffer += bytes"
  is an invalid expression.
* "friend class SomeClass" only works when SomeClass is known before.
  Otherwise the an inner class with that name is considered as friend.
  gcc 4 is much pickier about scopes.
* gcc 4 is generally stricter with respect to type conversions in C.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14878 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-12 23:27:14 +00:00
Jérôme Duval e970946333 EHOSTDOWN not needed for Haiku
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14761 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 20:09:10 +00:00
Ingo Weinhold 338b8dc301 Merged changes from branch build_system_redesign at revision 14573.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14574 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-29 16:27:43 +00:00
Jérôme Duval 060d9206d9 added some netdebug and netconfig files
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14373 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-13 15:49:30 +00:00
Jérôme Duval 27c7bf1ac1 fix the build
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14286 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-09-30 22:32:01 +00:00
Jérôme Duval 83e02263b7 added a socketpair in libsocket.so with corresponding code in the network stack driver and the network stack
socketpair() in the network stack is empty and still to be implemented for real


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14267 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-09-28 12:21:42 +00:00