Commit Graph

728 Commits

Author SHA1 Message Date
Axel Dörfler
965abdebd5 * BufferQueue::Free() no longer will return negative values. As is, the max
bytes restriction is only a soft limit. This fixes stalling TCP connections
  because everything received would be out of window once this happened.
* Added a TODO to look into TCP's window management - it doesn't seem to be
  right.
* Fixed build with tracing turned on.
* Made the fNumber member of tcp_sequence private.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35468 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-15 13:27:26 +00:00
Axel Dörfler
10cb62616f * Fixed destruction order of lock/reference that could lead to access already
deleted memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35467 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-15 13:23:48 +00:00
Axel Dörfler
4e32bf0954 * Simplified code a bit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35271 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-24 12:15:31 +00:00
Ingo Weinhold
e54d40e826 There's no reason for allocating with CACHE_DONT_SLEEP. The only thing that
would get us is that the allocations could fail when they wouldn't need to.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35242 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-22 20:01:26 +00:00
Ingo Weinhold
86c794e5c1 slab allocator:
* Implemented a more elaborated raw memory allocation backend (MemoryManager).
  We allocate 8 MB areas whose pages we allocate and map when needed. An area is
  divided into equally-sized chunks which form the basic units of allocation. We
  have areas with three possible chunk sizes (small, medium, large), which is
  basically what the ObjectCache implementations were using anyway.
* Added "uint32 flags" parameter to several of the slab allocator's object
  cache and object depot functions. E.g. object_depot_store() potentially wants
  to allocate memory for a magazine. But also in pure freeing functions it
  might eventually become useful to have those flags, since they could end up
  deleting an area, which might not be allowable in all situations. We should
  introduce specific flags to indicate that.
* Reworked the block allocator. Since the MemoryManager allocates block-aligned
  areas, maintains a hash table for lookup, and maps chunks to object caches,
  we can quickly find out which object cache a to be freed allocation belongs
  to and thus don't need the boundary tags anymore.
* Reworked the slab boot strap process. We allocate from the initial area only
  when really necessary, i.e. when the object cache for the respective
  allocation size has not been created yet. A single page is thus sufficient.

other:
* vm_allocate_early(): Added boolean "blockAlign" parameter. If true, the
  semantics is the same as for B_ANY_KERNEL_BLOCK_ADDRESS.
* Use an object cache for page mappings. This significantly reduces the
  contention on the heap bin locks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35232 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-21 23:10:52 +00:00
Michael Lotz
2416d6ae42 anevilyak+mmlr:
accept() is supposed to return B_WOULD_BLOCK when SO_NONBLOCK is set.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35154 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 04:31:35 +00:00
Oliver Ruiz Dorantes
9760dcae20 - Move bluetooth net_device module to a independent module HCI, remake API interfaces
- Move functionality for assembling ACL/events packets of the driver to this module
- Move h2generic driver to c++ (not style)
- Pass checkstyle.py to all commited files.
Fixes:
- Wrong condition for finishing l2cap packet segmentation.
- Place NetBuffersPrependers in a inner scope to avoid Sycing twice in destructor.
- Avoid keeping trace of l2cap responses of any other kind of thread.
- Do not free net_buffers of for Frame containers.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35117 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-17 15:46:36 +00:00
Axel Dörfler
7108ab1ff9 * copy_meta_data() also copied the size of the buffer, which wasn't such a good
idea. Splitting large buffers no longer causes KDL.
* merge_buffer() now maintains the size of the source buffer while removing its
  nodes.
* The paranoia checks run through again now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35073 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-14 16:35:41 +00:00
Axel Dörfler
bedf29cacd * Fixed build with tracing turned on.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35072 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-14 16:31:24 +00:00
Axel Dörfler
41e2ba1437 * Added missing check after an allocation.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35054 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-13 17:19:14 +00:00
Oliver Tappe
4e45de0e5f * when connect()ing an UDP socket, we need to set the local address to the
default address of the outgoing interface as a side-effect


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34989 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-10 15:26:46 +00:00
Axel Dörfler
2e095ebca8 * Removed an assert that will now always trigger (due to the DoublyLinkedList
changes).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34878 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-03 19:12:01 +00:00
Axel Dörfler
f8288ec75c * 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
2009-12-15 17:40:14 +00:00
Axel Dörfler
82aa4a0f4e * Replaced the remaining AF_DLI references with AF_LINK.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34487 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-04 09:34:35 +00:00
Axel Dörfler
751ce9e228 * Removed the interface fallback from the datalink module's is_local_address().
* Instead, added a new function is_local_link_address() which returns the
  interface with the matching link level address, and can additionally test
  for unconfigured interfaces.
* Merged the two versions of fill_sockaddr_in() together in ipv4.cpp.
* ipv4 now uses the new is_local_link_address() function to figure out whether
  the received packet should be processed or not. This should fix a few DHCP
  issues with multiple and configured interfaces as recently explained on the
  mailing list.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34466 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 14:31:39 +00:00
Axel Dörfler
207f71773b * The ethernet deframing used the wrong family for its reported source and
destination address (AF_DLI instead of AF_LINK).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34465 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 14:25:45 +00:00
Oliver Ruiz Dorantes
375ddaad85 - Style, mostly spacing, after passing checkstyle
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34430 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 20:58:44 +00:00
Oliver Ruiz Dorantes
31f8763031 - Proper implementation of accept/bind l2cap socket interface
- Add more debug info for the KDL debug command
- Request channel pointer also for non l2cap signal frames
- Add locks for packet queues



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34333 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-28 20:03:15 +00:00
Oliver Ruiz Dorantes
cf3d8a746f - Remove keeping list of connections per device
- Start to move some common code from the driver layer (not yet used)
- Style



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34332 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-28 19:50:09 +00:00
Axel Dörfler
abf272eedb * Cleanup, looks better this way.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33909 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-05 19:40:52 +00:00
Axel Dörfler
6e48ebf446 * "next" & "previous" could be NULL, but were still referenced - based on
Oliver's patch for bug #4896 which this one fixes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33908 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-05 19:29:24 +00:00
Axel Dörfler
f4ee0103a2 * Replaced ENABLE_DEBUGGER_COMMANDS with ENABLE_STATS.
* Added new ENABLE_DEBUGGER_COMMANDS that enables the new "net_buffer" KDL
  command to dump a net buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33893 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-05 11:40:33 +00:00
Oliver Ruiz Dorantes
ee739a2777 Tab for spaces
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33712 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-21 18:10:12 +00:00
Michael Lotz
baddb6942c Check for user buffers and properly use user_memcpy() in that case. Fixes #4770.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33564 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-10-13 00:13:08 +00:00
Oliver Ruiz Dorantes
a58b3b3235 Implement a bit further the sockets interface
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33320 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-09-27 19:07:24 +00:00
Stephan Aßmus
5147963dcd headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than
Tracker's OpenHashTable.h which it should eventually replace. We've renamed the
class to BOpenHashTable and changed the interface slightly so that HashTableLink
became superfluous.
Adapted all the code that used it. Since the OpenHashTables no longer clash,
this should fix the GCC4 build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31791 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 00:39:12 +00:00
Axel Dörfler
78888c44da 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
2009-07-15 11:53:29 +00:00
Axel Dörfler
2dd3063164 * Fixed getsockopt(), patch by Ma Jie - it would always assume IP_MULTICAST_TTL.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31396 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-03 16:54:23 +00:00
Axel Dörfler
65b5dd5064 * DatagramSocket::InitCheck() returned the sem_id instead of a status_t, causing
pings to fail (raw socket initialization) after r31079.
* Further cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31238 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-25 16:01:11 +00:00
Axel Dörfler
e5c5e337e4 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31079 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-17 10:00:26 +00:00
Axel Dörfler
9871124eb2 * Added missing hooks with a description of what's missing for clarity.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31077 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-17 09:32:30 +00:00
Axel Dörfler
f8daaadc80 * Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31008 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-11 08:48:40 +00:00
Axel Dörfler
09173f8089 * Applied a patch by Lukasz that already collected dust on my HD - sorry
Lukasz!
* It makes split_buffer() more efficient by avoiding making a copy of the
  original buffer.
* Minor cleanup, and coding style changes by myself.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31007 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-11 08:30:40 +00:00
imker
fd070b419d Looks like ethernet_set_promiscuous() call should use ETHER_SETPROMISC ioctl instead of ETHER_GETADDR one.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30999 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-09 18:18:54 +00:00
Michael Lotz
f54023cf37 Propagate error codes in FIONREAD. Fixes bug #3973.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30896 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-28 16:03:50 +00:00
Oliver Tappe
b788c037f3 * Fixed incorrect use of IN_MULTICAST in ipv4: the macro must be invoked
on an address in host-byte-order, not network-byte-order.
  Basically this caused failure for all IP-traffic to any IP-address
  where the last byte & 0xF0 == 0xe0.
Now we can surf www.pcre.org again ;-)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30870 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-26 21:34:42 +00:00
Ingo Weinhold
48f1a5b4c9 Patch by Eric Petit: A read select() should not block when there's not data
available anymore and the remote end has been write-shut-down. Fixes #3536.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30846 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-24 22:13:12 +00:00
Michael Lotz
2ae482f582 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
2009-05-18 01:13:44 +00:00
Axel Dörfler
9431509f5c * 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
2009-04-30 11:59:11 +00:00
Axel Dörfler
6f440aed2c * 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
2009-04-24 10:12:30 +00:00
Axel Dörfler
a87124634a * Our INADDR_* and IN_CLASS* macros were mostly wrong - they are supposed to
be in host endian order.
* Adapted ipv4 code that automatically finds a netmask to this change.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30299 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-21 19:21:52 +00:00
Axel Dörfler
22e78d6e65 * 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
2009-04-16 12:51:49 +00:00
Axel Dörfler
4e5191e9c1 * 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
2009-04-16 11:11:37 +00:00
Axel Dörfler
7caa5d430c * 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
2009-04-16 10:54:07 +00:00
Axel Dörfler
32537299cb * The "net_timer" command was never removed, causing sort_debugger_commands()
to hang when entering KDL, after having unloaded the stack.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30197 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 10:50:38 +00:00
Axel Dörfler
7722096951 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30195 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-16 10:31:48 +00:00
Axel Dörfler
ddd8303099 * 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
2009-04-16 08:37:00 +00:00
Oliver Tappe
5193237f1f fixing #3712:
* Since r30000, a net_socket is not zeroed anymore, which in turn
  leaves its two addresses (local and peer) in an uninitialized,
  but correct state - marking their state with ss_len == 0. 
  However, this state was not properly detected in some ipv4-address
  functions, especially not the one that creates a hash value from
  those two addresses.
  This basically caused UDP to stop working, as here the peer address
  (as opposed to TCP) is usually not explicitly initialized.
  Adjusting the ipv4-address functions accordingly fixes the problem,
  such that DHCP (and the rest of UDP) should now work again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30175 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-15 15:37:50 +00:00
Axel Dörfler
0e9ddc9350 * The initial ARP entry for interfaces without an address were never removed.
* arp_update_local() was called without holding the sCacheLock, but did not take
  care about locking either. Now the caller has to lock.
* Updating the local ARP entry is now done while holding the sCacheLock the
  whole time, thus it's now atomic to the outside.
* Fixed a potential deadlock: the arp_entry destructor must not be called with
  the sCacheLock being held as long as there is a potential timer running.
* Fixed a potential double delete in case the arp_entry destructor was called
  with a pending ARP_STATE_REMOVE_FAILED or ARP_STATE_STALE. Now, we set the
  new flag ARP_FLAG_REMOVED to check for that condition (it's now set when an
  entry is removed from the hash).
* arp_start_resolve() would leak non-functional ARP entries around when
  something went wrong during the initialization. It will now remove them via
  their timer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30167 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-15 10:29:33 +00:00
Axel Dörfler
a96e91db3b * Added TRACE macro to see what timers are set/cancelled.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30166 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-15 10:21:58 +00:00
Axel Dörfler
b4a57bf88b * Now makes sure the timer is properly shutdown when deleting the arp_entry.
* This fixes a crashing bug that could be triggered when switching IP addresses
  often.
* Also added a TODO about another possible crashing problem I won't look into
  today anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30165 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-14 21:24:43 +00:00
Ingo Weinhold
efd536ff89 * Cleared up a misconception in the notification mechanism. We already had
methods that used an "event mask" field. There was no need to introduce
  a "flags" field for the same purpose.
* Renamed protected DefaultNotificationService methods (removed "_" prefix).
* Adjusted the code providing a notification service accordingly.
* Changed the event message several notification services generated by renaming
  the "opcode" field to "event".
* Implemented the TEAM_ADDED event and also added a TEAM_EXEC event.
* Added notifications for threads and images.
* Added visitor-like iteration functions for teams, threads, and images.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30126 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-11 21:45:25 +00:00
Axel Dörfler
8aa910b94c * Added missing SO_TYPE.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30032 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 15:24:45 +00:00
Axel Dörfler
6fc2d92bd3 * Fixed the buggy GCC4 work-around.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30017 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-08 07:57:32 +00:00
François Revol
9b4cfa9d3b 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
2009-04-07 20:51:01 +00:00
Axel Dörfler
42d0ef6fe4 * 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
2009-04-07 17:41:46 +00:00
Axel Dörfler
1111232758 * 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
2009-04-07 16:07:15 +00:00
Axel Dörfler
68dd93a652 * Fixed TCPEndpoint::Listen() never setting the backlog on its socket, causing
only a single pending connection to be accepted at once.
* Fixed discarding endpoints that still had a parent, but were closed before
  they could be accepted (or even established). Previously, these were never
  deleted, slowly filling up the socket's backlog.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29987 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-07 00:18:40 +00:00
Axel Dörfler
ab134c0a9a * 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
2009-04-07 00:15:52 +00:00
Axel Dörfler
293e82ab1d * 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
2009-04-06 22:45:58 +00:00
Axel Dörfler
b32dfac5f4 * 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
2009-04-06 21:18:29 +00:00
Axel Dörfler
865dbe341e * This should fix the tcp build when tracing is turned on.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29961 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-06 09:37:40 +00:00
Axel Dörfler
c21f81c11a bonefish + axeld:
* There was one incorrect check in BufferQueue::Get() that happened because
  the wrong operator was used due to the uint32 cast operator.
* Consequently, we removed the uint32 cast operator, and changed the code
  to deal with this. Fortunately, no other bugs were observed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29928 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-05 12:00:36 +00:00
Axel Dörfler
bda94e2e25 * Locking order dictates that this lock is an inner lock, and shouldn't
be used everywhere.
* This also fixes a panic when deleting interfaces (an already deleted
  lock was unlocked).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29902 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-04 16:23:42 +00:00
Axel Dörfler
0a5c6763e3 * Now it works.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29899 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-04 14:43:48 +00:00
Axel Dörfler
e6a9468e2c * Improved tracing.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29898 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-04 14:38:10 +00:00
Axel Dörfler
3093705388 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29870 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-04-02 16:54:11 +00:00
Axel Dörfler
51755cf832 * Added DefaultNotificationService and DefaultUserNotificationService
implementations that can be used by subsystems that want to have a pretty
  standard service. Only the latter is really complete, though.
* The notification manager is now available earlier in the boot process.
* Added notifications to teams/ports (only add/remove).
* The network notification implementation is now using the
  DefaultUserNotificationService.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29543 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-15 10:21:56 +00:00
Axel Dörfler
b82ed10b05 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29387 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-03 14:13:23 +00:00
Axel Dörfler
26153d0f67 * The net_domain's lock is now a recursive lock.
* Fixed all route locking problems, of which there were numerous
  ({add|remove}_route(), and list_routes() did not lock at all). Added
  lock assertions in functions that don't do the locking themselves.
* A route will now be removed from the list in remove_route(), not in
  put_route_internal(). Before, a route could easily be removed twice, causing
  remove_route() to release references it did not own. This fixes bug #2706.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29386 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-03 14:04:57 +00:00
Axel Dörfler
b11680b741 * Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29384 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-03 10:39:55 +00:00
Stephan Aßmus
61252f516c * Fixed the build and ticket #3515 (multi-line string).
* Automatic white space cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29383 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-03 08:53:47 +00:00
Oliver Ruiz Dorantes
11d36ea03d - Add bluetooth kernel addons to build
- keep alphabetic order in network protocols



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29382 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-02 21:24:37 +00:00
Oliver Ruiz Dorantes
61c28fd543 Add new bluetooth components to the bluetooth optional package
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29379 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-02 18:24:24 +00:00
Axel Dörfler
3c13a5f5b3 * Renamed net_device_interface::rx_lock to receive_lock.
* Cleanup, improved comments, removed useless ones.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29232 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-16 11:13:28 +00:00
Axel Dörfler
86a0cf15e4 * You can now use SIOCGIFFLAGS on the AF_LINK level as well.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29231 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-16 11:05:25 +00:00
Axel Dörfler
f964cf0772 * No longer leaks the EndpointManagers at unload.
* Now uses an array instead of a doubly linked list to find the endpoint
  manager for a domain.
* No longer locks the endpoint managers during TCP processing, which actually
  made all TCP input serialized.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29210 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-15 14:33:41 +00:00
Axel Dörfler
f6874c7b31 * When there was no link, the wrong route was chosen as a candidate when trying
to get a local connection (the first candidate must be used, not the last).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29208 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-15 12:59:34 +00:00
Michael Lotz
d0eaec3086 Fix more operator precedence errors. These do not do what you'd expect at first
sight. The comparison operator takes precedence over the binary ones.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29121 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-01 23:24:55 +00:00
Michael Lotz
fb3e35fcec Fixing all headers/namespaces/name lookup problems that hinder a GCC 4.3.2
build. I sure hope that this doesn't break the build for anyone else.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28992 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-23 03:05:15 +00:00
Axel Dörfler
01b60f3d7e * Fixed one more case of a resulting 0 byte buffer. Also added a test case for
it to the test app. This finally fixes ticket #2594.
* Of course, I neither saw this one before, nor did I accidently reproduce it
  with a test :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28967 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-20 10:38:05 +00:00
Axel Dörfler
93f76bfb7e * Turns out the assert was wrong; since the previous buffer can be adjacent to
the next buffer, it can also cause the new buffer to start at the same
  sequence as the next buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28958 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-19 17:40:20 +00:00
Axel Dörfler
0c1404badd * The check to remove bytes at the beginning happened twice.
* There was an off-by-one error that could well be responsible for bug
  #2594. Haven't tested it yet, though.
* Added an extra assert to make sure that "next" is set correctly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28937 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-18 16:58:04 +00:00
Axel Dörfler
49509985cf * Applied another patch by Adrian: the route used by TCP was never given back.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28892 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-13 12:10:35 +00:00
Axel Dörfler
518720875d * Fixed a few more problems that the test application revealed. This should
also close #2594.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28883 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-11 16:41:08 +00:00
Axel Dörfler
b3cb15e21e * Applied most parts of Adrian's patch in #2594, applied our coding style.
* Cleaned the net_buffer::sequence handling, and fixed a few more problems of
  maintaining it in Add().
* Extended Verify() to check everything that's possible, and call it
  conditionally on several places, depending on DEBUG_BUFFER_QUEUE. It's turned
  on for now which means that any remaining problems should show up when they
  happened.
* Call Dump() from TCPEndpoint::Dump().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28878 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-11 11:47:31 +00:00
François Revol
f861e599f5 typo.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28870 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-11 00:41:30 +00:00
Axel Dörfler
0e5a3fc6c6 * BufferQueue::Get(size_t ...) now always returns successfully if it does not
return an empty buffer. This should avoid losing data in case not everything
  could be appended due to a resource shortage.
* Also, it now assures that fNumBytes and fContiguousBytes are always
  maintained correctly, thanks to Adrian for pointing this out! This should
  fix bug #2594.
* Added extra debug code to BufferQueue::RemoveUntil() so that it checks
  whether or not fContiguousBytes could be maintained correctly (ie. if this
  function is called only as thought).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28859 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-01-08 18:31:22 +00:00
Axel Dörfler
74ff314b2f * It was not possible anymore to remove any flags.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28830 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-28 22:13:19 +00:00
Axel Dörfler
d68ffdedc0 * More or less completed the network notification module - it does not remove
old invalid user listeners yet, though (ie. if a team dies).
* Implemented userland network monitor functions.
* Added a few notifications to the network stack, even though this part isn't
  complete yet (especially notify_interface_changed()).
* Added optional debug output to the notifications module.
* Added the module to the image, it basically works now (tested).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28825 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-27 20:48:28 +00:00
Axel Dörfler
2e71ef292f * Minor cleanup, removed TODO that doesn't make much sense.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28824 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-27 20:41:06 +00:00
Oliver Ruiz Dorantes
8a32045bf6 Fix Null access at request ident, reported by Mika Lindqvist
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28818 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-21 19:14:47 +00:00
Axel Dörfler
e6dd439f7c * 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
2008-12-09 23:16:10 +00:00
Oliver Ruiz Dorantes
a94c1dc58d Style changes
whitespaces remaining... what editor do you use to avoid that?



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28756 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-01 23:09:11 +00:00
Oliver Ruiz Dorantes
5b7fde0fb5 Really scary,
Obviously non tested code
freeing stack allocated object.  

tnx axel



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28755 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-01 23:06:01 +00:00
Oliver Ruiz Dorantes
d8de43897a - Implement ACL Segmentation and Reassembly
- Kernel traces for bluetooth devices
- Register connections helper funcs



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28739 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-27 19:44:19 +00:00
Oliver Ruiz Dorantes
7cc7cada6a - Implement signaling req/rsp
- Deliver Connection Oriented packets
- Complete the l2cap upper layers
- Basic interaction with sockets
- Implement thead at this layer for TX



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28738 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-27 19:12:33 +00:00
Oliver Ruiz Dorantes
94c2ae9320 size does not need to be calculated. Merge configuration parameters only if specified.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28711 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-21 20:10:36 +00:00
Axel Dörfler
77817877ce * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28500 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-04 16:05:38 +00:00
Ingo Weinhold
fad11a1c88 Strongly typed languages ftw.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28338 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-26 16:29:39 +00:00
Ingo Weinhold
801e9bd9f1 Always return what we've got from the socket module (error or number of
bytes received), but not B_OK on success.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28337 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-26 15:52:46 +00:00
Ingo Weinhold
4534a38441 stack_interface_recvfrom(): Incorrect return value check. It's a
ssize_t, not a status_t, so the following setting of the address length
was never invoked, causing recvfrom() to always return the passed in
size.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28334 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-26 11:52:04 +00:00
Ingo Weinhold
1894a0a98b Consistently use KDEBUG. It is always defined and therefore must be
checked with "#if".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28247 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-20 13:06:04 +00:00
Oliver Ruiz Dorantes
b9b8d43c57 Current L2CAP code. Replying ConnectionResponses signals. The style should be more acurate than my previous commits(so use this commit to correct my remaining bad habits). The Code is not completed but need to commit to have a chance to go on from Germany....
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28107 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-14 20:47:20 +00:00
Jérôme Duval
6093698cca No newline at end of file
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28010 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-12 22:21:54 +00:00
Oliver Tappe
372087dde5 * fixed sending of IP-level broadcasts
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27997 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-12 17:00:58 +00:00
Oliver Tappe
60dc5f6109 * fixed receiving of IP-level broadcasts - fixing the rest of
#2065

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27996 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-12 15:39:23 +00:00
Axel Dörfler
f2e72955d8 * datalink_send_datagram() can be called with a NULL protocol which I missed
with the last commit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27984 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-11 22:46:38 +00:00
Axel Dörfler
27e0dea9f0 * 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
2008-10-11 22:10:31 +00:00
Axel Dörfler
ea93f584ad * put_device_interface() accessed "device" which was already freed to get
the module name, possibly causing a crash when you delete an interface.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27950 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-10 18:38:12 +00:00
Axel Dörfler
a3513e7b9a * Fixed possible deadlock when booting over the network. Creating the interface
without having the domain locked seems to be safe AFAICT.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27839 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-02 09:16:50 +00:00
Axel Dörfler
491da20dbf * Added a is_timer_running() function.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27631 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-19 09:11:12 +00:00
Axel Dörfler
8f3c0d9fcc * wait_for_timer() now returns a status code.
* wait_for_timer() now detects if it has been called from within the timer
  execution thread, and will return in error instead of waiting for itself
  forever. This fixes bug #2682.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27620 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-18 12:45:43 +00:00
Axel Dörfler
5d6d0dcfc3 * The timer thread accessed a timer (to delete the TIMER_IS_RUNNING flag) after
it had been removed from the list. Now, I removed the flag again (but kept
  the flags field for now), and solved in a way that doesn't have this problem.
* This might have a positive effect on #2682.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27574 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-15 16:51:59 +00:00
Michael Lotz
4e9bf24dd5 CID 26: The status variable was shadowed inside the while loop causing the outer
status to always be B_OK, resulting in an incomplete buffer instead of an error
if the append failed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27469 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-13 00:28:29 +00:00
Stephan Aßmus
8008c36e34 Fixed CID 1272. Looks like _addressLength is allowed to be NULL, but
at function exit, it was still dereferenced.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27460 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-12 17:31:48 +00:00
Axel Dörfler
c5e91552e1 * Now uses the new wait_for_timer() stack function on destruction - this fixes
bug #2143.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26981 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-15 14:47:11 +00:00
Axel Dörfler
9e8be8bb9c * 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
2008-08-15 14:46:16 +00:00
Oliver Ruiz Dorantes
696b8e46f3 Move header to private, is meant to be used by acl component as well
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26903 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-09 20:47:30 +00:00
Oliver Ruiz Dorantes
b48fa68ace Fix bluetooth_server debug window tabs, they were getting out of bounds due the index assignation
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26704 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-31 21:03:17 +00:00
Oliver Ruiz Dorantes
e54b6bb39a Make the local devices register in some module of the Kernel land... for the moment as bridge for l2cap
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26613 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-24 20:41:11 +00:00
Oliver Tappe
9e05183977 * some minor cleanups and clarifications
* dropped tracing of udp-header


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26518 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-19 22:32:51 +00:00
Oliver Tappe
14eaa7b61d * replaced a couple of unconditional dprintf()s with TRACEs
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26517 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-19 22:31:20 +00:00
Oliver Tappe
4d6c666d22 * dropped swapping of addresses when delivering locally via loopback, since
that is neither correct (source and destination are ok as they are) 
  nor does it have any effect (since those values are clobbered by the
  domain module afterwards)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26516 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-19 21:47:03 +00:00
Axel Dörfler
cb9191556c bonefish + axeld:
* Removed the superfluous "flags" parameter from ConditionVariable::Add()
  that we forgot there when we moved the flags field from
  ConditionVariableEntry::Add() to Wait().
* Using this method was therefore not a good idea - only UnixFifo did, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26454 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-16 22:43:50 +00:00
Oliver Ruiz Dorantes
d0651ae6ac Add entity to handle the available LocalDevices from KL
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26201 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 20:25:08 +00:00
Oliver Ruiz Dorantes
ab563fc0a5 Fix mail in header
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26195 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 19:00:39 +00:00
Axel Dörfler
6c63e7a548 * Fixed network boot: stack_interface_recvfrom() crashed when _addressLength
was NULL; now it only dereferences it when "address" is non NULL.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26139 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-26 19:38:43 +00:00
Ingo Weinhold
276aa463ef * Replaced the useless InitCheck() method in {Open,Multi}HashTable (it
always returned B_OK) by a Init() method, which sets the initial size
  and returns an error, if that fails.
* Adjusted code using the classes accordingly. Replaced a few
  InitCheck() methods in the network code by Init().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26127 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-24 22:23:57 +00:00
Axel Dörfler
4122d6c0c0 * Applied patch by Jan Klötzke that prevents the ICMP module to answer broadcast
ping requests, and those before an interface is configured.
* Added comment that explains the consequences.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25995 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-17 16:04:24 +00:00
Oliver Ruiz Dorantes
1b9e61ad87 Remove some reference code
Replace bsd types for haiku ones
-ve-This line, and those below, will be ignored--

M    l2cap/l2cap_command.cpp
M    l2cap/l2cap.h


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25945 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-12 19:53:06 +00:00
Oliver Ruiz Dorantes
c15ecd98ca - Add some core code for the L2CAP layer (l2cap commands)
- Tailor a bit the main module
- Fix definitions in the main header




git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25943 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-12 19:31:29 +00:00
Oliver Ruiz Dorantes
c61dc72f6c - Add some traces
- Register the protocol
- Remove some AF_INET stuff

Although step by step will become the L2CAP protocol implementation, for the moment is just a testing and learning code. 



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25884 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-09 18:51:04 +00:00
Oliver Ruiz Dorantes
3e24801283 L2CAP, without functionality, for the moment my playground in the netstack
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25768 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-02 20:16:00 +00:00
Axel Dörfler
cbeac9882f Patch by Vasilis Kaoutsis:
* FragmentPacket::Reassemble() would return NULL instead of an error when the
  packet was not yet complete.
* This didn't have any actual consequences, though, as Reassemble() was only
  called for a complete fragment set.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25758 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-02 11:10:35 +00:00
Ingo Weinhold
2b07b8e0f1 * 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
2008-05-29 02:08:23 +00:00
Ingo Weinhold
b0f5179aa5 * Changed recursive_lock to use a mutex instead of a semaphore.
* Adjusted code using recursive locks respectively. The initialization
  cannot fail anymore, and it is possible to use recursive locks in the
  early boot process (even uninitialized, if in BSS), which simplifies
  things a little.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25687 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-28 23:12:36 +00:00
Axel Dörfler
1a19981411 * If we don't add a buffer because of FLAG_NO_RECEIVE, we still have to
maintain our fReceiveNext member, or else the other endpoint never gets its
  data acknowledged. This fixes the ssl_closure test of the neon test suite,
  all tests finally go through.
* Use is_writable() in SendData() instead of checking all the states manually.
* Also bail out when the endpoint stops being writable when we were waiting
  for it to become writable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25573 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-20 10:15:14 +00:00
Axel Dörfler
30a396ab42 * Made the endpoint manager wait on bind() if the existing connection is
local, and is about to close.
* This fixes several race conditions with the neon test suite that relied
  on TCP sockets being gone after close, and their port being available again
  (note, that is not what the TCP spec says, anyway, but it makes sense to
  do so, since we already removed the time wait state for local connections).
* The endpoint manager is now using a mutex instead of a semaphore.
* TCPEndpoint::_Close() now notifies the senders/receivers instead of
  _HandleReset().
* Besides ssl_closure(), all tests of the neon test suite seem to pass now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25564 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-19 18:27:10 +00:00
Ingo Weinhold
ec1f43f304 axeld + bonefish:
* Small style changes.
* Currently ifdef'ed out potentially correct changes, that break Neon
  tests which otherwise succeed. Axel will investigate this further.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25530 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-17 18:48:24 +00:00
Ingo Weinhold
25d0a0841f axeld + bonefish:
_WaitForEstablished() must also accept states implying that the state
has been established at some point. Fixes bug #2172.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25526 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-17 11:56:25 +00:00
Ingo Weinhold
5947a3be5a * Fixed read() on a read-shutdown socket. It must never wait.
* Added TODO regarding read/write shutdown.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25515 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-15 21:05:59 +00:00
Ingo Weinhold
8a1852a447 * Corrected the read() behavior on a read-shutdown socket. All the data
that arrived before the shutdown can still be read.
* Debug some more returns.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25514 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-15 20:50:42 +00:00
Ingo Weinhold
af015599ea When sending a file descriptor via SCM_RIGHTS we also need to acquire an
open reference to it. Otherwise the descriptor could be closed while
being on the way. This fixes the ssh login problem with non-root users.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25318 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-05 00:27:34 +00:00
Ingo Weinhold
5d55026291 Added support for SO_PEERCRED for Unix sockets.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25305 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-04 00:32:57 +00:00
Ingo Weinhold
ea035707b3 * Support the new {send,read}_data_no_buffer() protocol hooks to avoid
unnecessary data copies and waste of memory.
* Changed the storage backend to ring_buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25300 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-03 01:14:44 +00:00
Ingo Weinhold
cdc00dadfc * 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
2008-05-03 01:11:21 +00:00
Axel Dörfler
03298f9d20 * The WaitList now always notifies all waiters.
* In SendData(), TCP will now split the buffer into smaller parts if it
  can send data (ie. there is free space in the buffer queue left, but
  not enough to send the whole buffer, and the free space is more than
  the send low water mark of the socket).
* Both of these changes together let TCP now pass the "forwarding" test
  of the OpenSSH suite.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25294 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-02 17:36:28 +00:00
Ingo Weinhold
49e00d1f99 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
2008-05-02 14:37:16 +00:00
Ingo Weinhold
3dba513f4c This fixes the crashes when calling {g,s}etsockopt() on an AF_LINK
socket. Not sure, if there are any cases where there is a next protocol,
though. Please review.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25287 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-02 02:26:58 +00:00