History log of /haiku/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp
Revision Date Author Comments
# e4efd92e 27-Feb-2024 Jérôme Duval <jerome.duval@gmail.com>

ipv4 & ipv6: implement connect() by setting the socket's peer address

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


# 03821765 29-Jan-2024 Augustin Cavalier <waddlesplash@gmail.com>

IPv4: Overall MTU is 65535 (0xFFFF).

If the route supports a greater MTU, we need to
clamp it.

The loopback reports an MTU greater by one byte
(65536), and if we don't clamp it here, TCP will
try to send packets actually that large (and fail.)


# 17aa6d01 26-Jan-2024 Augustin Cavalier <waddlesplash@gmail.com>

IPv4: Make header fields go out of scope when no longer usable.

There was a comment indicating where this happened, but then
there was a use of one of them after this point. Fix that,
and add { } around their use to prevent this from happening again.


# 2903a69d 20-Sep-2023 Augustin Cavalier <waddlesplash@gmail.com>

network/ipv4: Fix NULL dereference in multicast-send.

Fixes the KDL in #18585.
While at it, add a missing NULL check and fix a leak.


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

ipv4: bind() should return EADDRNOTAVAIL when the address isn't available

"EADDRNOTAVAIL: The specified address is not available from the local machine."

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


# ce08f03c 01-Apr-2023 Augustin Cavalier <waddlesplash@gmail.com>

kernel & add-ons: Adjustments to use DoublyLinkedList::InsertBefore.

The Insert(before, element) function has been marked deprecated since
2010, but still had many usage and kept accumulating more. It's long
past time we got rid of all them and actually deprecated the function
itself.

Insert(before, element) just calls InsertBefore, so no functional change.


# 41faeb1d 27-May-2022 Augustin Cavalier <waddlesplash@gmail.com>

net_interface & datalink: Fix MTU handling.

The device is what actually controls the MTU, and it has its own
field for this, so having a second one just meant the MTU never
got updated after startup.

Remove the "mtu" field from the interface, use the "device->mtu" directly,
and then actually invoke device->module->set_mtu when updating.


# 116794af 04-Dec-2020 Jérôme Duval <jerome.duval@gmail.com>

ipv4: reenable multicast

tested between two Haiku VMs with iperf.

Change-Id: Id9d3865f2c9f8ed6c79d0ece53f51c781c77b771
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3453
Reviewed-by: Rene Gollent <rene@gollent.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# b6e85f80 29-Nov-2020 Jérôme Duval <jerome.duval@gmail.com>

ipv4 & ipv6: remove_trailer() uses a positive size as parameter

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


# c144c17f 25-Nov-2020 Jérôme Duval <jerome.duval@gmail.com>

ipv4: fix 64-bit trace warnings

Change-Id: I4124c4fc5f4cf54369eeb08ee9d1fa70600a94e5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3421
Reviewed-by: Rene Gollent <rene@gollent.com>


# 6e3ed1d2 25-Nov-2020 Jérôme Duval <jerome.duval@gmail.com>

ipv4: restrict multicast socket options to raw und datagram streams

Change-Id: Id55cfa0266ba6754340bd1ce43e8016579bd7c45
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3420
Reviewed-by: Rene Gollent <rene@gollent.com>


# bd337347 25-Nov-2020 Jérôme Duval <jerome.duval@gmail.com>

ipv4: add getsockopt IP_MULTICAST_IF

also fix setsockopt

Change-Id: Idb8fafbe7aa9931af82ebccdc4d2e487f9c0eeb1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3419
Reviewed-by: Rene Gollent <rene@gollent.com>


# 6b1c3825 25-Nov-2020 Jérôme Duval <jerome.duval@gmail.com>

ipv4: add option for multicast_loopback

no effect, multicast is disabled anyway.

Change-Id: Ic7ca0d169dae5eb7cd34a658908eed5d0d149d08
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3417
Reviewed-by: Rene Gollent <rene@gollent.com>


# 15b8d49d 21-Nov-2020 Jérôme Duval <jerome.duval@gmail.com>

ipv4: have IP_MULTICAST_TTL accept 1-byte buffers

this is a common length for this socket option. also denies values greater als 255.

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


# 07af264a 02-Dec-2018 Murai Takashi <tmurai01@gmail.com>

ipv4: Fix PVS 2464

Fix using local variable within a loop with a same name
as a variable controlling this loop.

Change-Id: Ie920807a56e51b32844ac13ff1d8c564466d3a83
Reviewed-on: https://review.haiku-os.org/751
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 19d8e4f7 19-Mar-2017 Alexander Andreev <carzil@yandex.ru>

ipv4/6: fixed crossing link fields from different hash tables.

Signed-off-by: Axel Dörfler <axeld@pinc-software.de>


# ad4d57f1 19-Aug-2012 Rene Gollent <anevilyak@gmail.com>

Fix multicast double free issue in IPv4.

- IPv4 had the same problem as v6. Most likely this was an oversight
when converting from a C to a C++ module. Might help with #6736 and
#8894.


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

* Fixed a bug in deciding whether or not an IP level broadcast should be
accepted. This should have been the reason for Duggan's problem with DHCP
as part of bug #6454.
* Stippi's router seems to answer DHCP requests with broadcasts to the future
broadcast IP address. Luckily, it's also a link layer broadcast, so we let
the upper protocols decide what to do with it, depending on that; this could
also be done depending on the existence of any unconfigured networks.
* This should fix Stippi's DHCP problems, and therefore bug #6454 - in any
case, this will be the last try before my vacation :-)


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


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

* Now sets the net_buffer::index field before forwarding a buffer to the next
layer.
* Converted the hash used to the BOpenHashTable instead of khash.
* Fixed remaining GCC4 warnings.


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


# 9d433190 26-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Now we should also support link layer and INADDR_BROADCAST broadcasts again
correctly.
* This should finally fix ticket #6454, but I keep it open until it's confirmed.


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


# 4c6e53f6 25-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* IPv4 must always set the net_buffer::interface_address on incoming buffers; it
didn't do that for broadcasts - this is still not a full solution as it won't
work for link layer broadcasts, but this should fix most DHCP problems.
* IPv4 multicast doesn't do that yet.
* Only send ICMP errors if it hasn't been a link layer broadcast.


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


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

* Fixed CID 1511: protocol could be NULL.


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


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

* Automatic whitespace cleanup, no functional change.


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


# 081dd39e 06-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Further improved debug output.


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


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

* Finished groundwork on ICMP by introducing a completely protocol agnostic
error mechanism.


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


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

* Renamed net_datalink_module::send_data() to send_routed_data(), and
send_datagram() to send_data().
* Renamed DatagramSocket::SocketEnqueue() to EnqueueClone(), SocketDequeue()
to Dequeue().
* Ordered the methods in ProtocolUtilities.h according to their declaration.


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


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

* Replaced more occurences of EOPNOTSUPP with B_NOT_SUPPORTED.


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


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

* Only allow raw sockets for root.


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


# d72a2493 29-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* Replaced ENODEV with B_DEVICE_NOT_FOUND.


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


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

* ipv4_error_received() also needs to fill in the buffer's address, and
protocol, and cut off its IPv4 header before forwarding the buffer to the
upper layers.
* Some minor cleanup.


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


# 74a4c33f 21-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented a way to preserve header data while passing along a buffer to the
upper layers: you use the store_header() function to mark the header you want
to preserve. All subsequent remove_header() calls won't claim the actual
data, but only move the node start around.
* This header can then be restored by restore_header(). However, a call to
prepend_data() will destroy the stored header. Also, if remove_header() cuts
off a whole node, restoring the header won't succeed anymore.
* Discarded the no longer needed net_buffer::network_header field.
* Also discarded the hoplimit field which temporarily breaks the IPv6 build
until Atis reworks it.
* IPv4 now also dumps the IP header in the send path if debug output is enabled.
* icmp_error_reply() might be called so early that the net_buffer's addresses
do not point to the reply address; this is now detected, and the addresses are
taken out of the IP header in that case.
* Improved dumping the net_buffer to also include its address, and flags.


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


# 0a0bed1c 21-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* Improved debug output; ipv4 will now dump the whole header if TRACE_IPV4 is defined.


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


# fcea1b16 21-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* ICMP now removes its header before passing the error on to the upper levels.
* Therefore, IPv4 no longer needs to mess with that (incorrectly, anyway).
* Removed unused include, turned off ICMP debug output.


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


# aea00dc3 21-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* deliver_multicast() now returns whether or not it delivered the buffer,
instead of always returning B_OK.
* deliver_multicast() now takes the protocol restriction of a raw socket into
account.
* raw_receive_data() now correctly returns whether a buffer was delivered (due
to the protocol restriction, this wasn't the case before).
* ipv4_receive_data() leaked all multicast buffers.
* Some minor cleanup.


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


# 1978fb81 20-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* First part of ICMP support: this is based on the work by Ivo Vachkov (GSoC
2007), and Yin Qiu (GSoC 2008). And even though I needed to rewrite pretty
much all of it because of the countless bugs and problems it had, it still
shares the same architectural problems of introducing a domain dependent
error mechanism to the upper layers, and needing the
net_buffer::network_header hack. This I will rework later.
* net_buffer's append_size(), and prepend_size() will now gracefully handle
buffers without a data node.


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


# bedf29ca 14-Jan-2010 Axel Dörfler <axeld@pinc-software.de>

* Fixed build with tracing turned on.


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


# 751ce9e2 03-Dec-2009 Axel Dörfler <axeld@pinc-software.de>

* 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


# abf272ee 05-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Cleanup, looks better this way.


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


# 6e48ebf4 05-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* "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


# 5147963d 26-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

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


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

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


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


# 2dd30631 03-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* 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


# 65b5dd50 25-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* 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


# e5c5e337 17-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Minor cleanup.


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


# 9871124e 17-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* 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


# b788c037 26-May-2009 Oliver Tappe <zooey@hirschkaefer.de>

* 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


# 372087dd 12-Oct-2008 Oliver Tappe <zooey@hirschkaefer.de>

* fixed sending of IP-level broadcasts

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


# 14eaa7b6 19-Jul-2008 Oliver Tappe <zooey@hirschkaefer.de>

* 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


# 276aa463 24-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# cbeac988 02-Jun-2008 Axel Dörfler <axeld@pinc-software.de>

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


# 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


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

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


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


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

IPv4 now uses module_dependencies, it mustn't put the stack module manually anymore.
This fixes unloading of the stack (some fixes to the module code that let you
determine this kind of bugs earlier will be committed next).


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


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

axeld+bonefish: Got rid of the ParentType in the HashTableDefinition; it doesn't really
belong there.


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


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

net_buffer: preparing for better metadata management


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


# 2b1c2dd3 01-May-2007 Hugo Santos <hugosantos@nowhere.fake>

when 0 is specified as the interface index with the generic multicast delta API, the stack should select an interface for the application.


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


# ab7e05a3 01-May-2007 Hugo Santos <hugosantos@nowhere.fake>

also dump filter mode and sources in 'ipv4_multicast'.


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


# bbcf6596 01-May-2007 Hugo Santos <hugosantos@nowhere.fake>

select the default interface to be used for multicast through a routing table query.


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


# 8465a069 30-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

added a ValueIterator to MultiHashTable to present a limited view in result of Lookup()s.


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


# 8aa4c7e3 01-May-2007 Hugo Santos <hugosantos@nowhere.fake>

prepared the ipv4 multicast code for full multicast support.


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


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

some getsockopt/setsockopt and multicast fixes.

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


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


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

added 'ipv4_multicast' debugger command.


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


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

ipv4: changed the multicast filter to use an hash table to keep source states.


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


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

use OpenHashTable in IPv4's MulticastGroups.


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


# 53f23f85 25-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

partially rewrote TCP's endpoint manager. Fixes #1173


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


# 8a819b17 19-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

retrieve the incoming interface on the domain_receive_adapter(). This should fix potential issues with packets addressed to the IP broadcast address, such as in with some DHCP implementations.


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


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

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


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


# 1408d1f0 15-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

introduced datalink's send_datagram to perform route and source address selection and dispatch the datagram to appropriate domain/protocol.


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


# 342824b6 15-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

fixed the reception of multicast frames by RAW sockets.


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


# 6a606180 15-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

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


# 4229d709 14-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

made UDP's send_data call into IPv4's, so we can handle of the datagram stuff in one place.


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


# 62987844 14-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

made IPv4's send path be multicast aware.

- also added IP_MULTICAST_TTL support.


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


# d3be4145 14-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

initial IPv4 multicast receive path.


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


# 6c501a40 14-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

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


# 46527f68 14-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

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


# 49f3c71e 13-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

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


# 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


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

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


# 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


# 6c353509 11-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

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


# 87001e05 11-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

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


# 7664bcb5 09-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

A couple more TCP fixes.

- ipv4_bind() was broken when binding to addresses not INADDR_ANY, as it wasn't copying the address to the socket, fixed.
- fixed a small issue in TCP's BindToEphemeral where the correct address might not have been bound to the socket.
- some assorted TCP wait lists fixes.
- fixed TCP's Connect() over the loopback interface, we might already be ESTABLISHED after _SendQueue() returns.
- fixed the amount of time we wait in TCP's Accept().


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


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

send buffer size is irrelevant for UDP, instead check if the fed buffer is larger than the maximum payload UDP supported. Do the same in IPV4.


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


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

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


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


# 51541d38 01-Apr-2007 Axel Dörfler <axeld@pinc-software.de>

You also have to recompute the checksum in case the source address was updated,
patch by Hugo Santos.


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


# ea2de1a1 25-Mar-2007 Axel Dörfler <axeld@pinc-software.de>

* If the IP_HDRINCL option is used, ipv4_send_routed_data() now checks if the source
address is set, and changes this if not; this makes traceroute work on Haiku.
Patch by Hugo Santos.
* Minor cleanup.


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


# 6de46a80 24-Mar-2007 Axel Dörfler <axeld@pinc-software.de>

Rearranged ipv4_control() a bit, and fixed a bug that would always return B_BAD_VALUE
on setsockopt() for all options. Thanks to Hugo Santos for pointing this out.


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


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

The IPv4 protocol now stores all domain receiving protocols, and only put them away on uninit.
This should speed up packet retrieval a lot.


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


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

Added support for IP_TOS and IP_TTL options.


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


# 4818d3b6 06-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

IPv4 send_routed_data() can now also work with a route whose address is NULL; this
is useful for bringing up (and using) an unconfigured interface. Specifically, DHCP
will be using this method to get the broadcast out.


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


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

Calmed down net_buffer and IPv4 a bit.


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


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

* 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


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

Minor cleanup.


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


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

* 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


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

* 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


# 5450af82 13-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented fragmenting IP packets - not yet tested, though.


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


# 08d8ae0c 12-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

Made the ipv4_send_routed_data() function a bit more safe to use (now checks if the
route passed in is valid).


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


# 0054baf8 27-Sep-2006 Andrew Galante <agalante@nowhere.fake>

A few bugfixes to prepend_size and append_size so they don't create unnecessary empty nodes. Minor cleanup to ipv4.cpp.

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


# 891a127f 17-Sep-2006 Marcus Overhagen <marcusoverhagen@gmail.com>

various gcc 4 related build fixes


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


# 9515b3f2 10-Aug-2006 Andrew Galante <agalante@nowhere.fake>

Extra error checking in init

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


# ad4d57f14b01abc88a09dc4bdedd1b35258741df 19-Aug-2012 Rene Gollent <anevilyak@gmail.com>

Fix multicast double free issue in IPv4.

- IPv4 had the same problem as v6. Most likely this was an oversight
when converting from a C to a C++ module. Might help with #6736 and
#8894.


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

* Fixed a bug in deciding whether or not an IP level broadcast should be
accepted. This should have been the reason for Duggan's problem with DHCP
as part of bug #6454.
* Stippi's router seems to answer DHCP requests with broadcasts to the future
broadcast IP address. Luckily, it's also a link layer broadcast, so we let
the upper protocols decide what to do with it, depending on that; this could
also be done depending on the existence of any unconfigured networks.
* This should fix Stippi's DHCP problems, and therefore bug #6454 - in any
case, this will be the last try before my vacation :-)


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


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

* Now sets the net_buffer::index field before forwarding a buffer to the next
layer.
* Converted the hash used to the BOpenHashTable instead of khash.
* Fixed remaining GCC4 warnings.


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


# 9d4331902caac05ca23bc6f4d27342acce15f202 26-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Now we should also support link layer and INADDR_BROADCAST broadcasts again
correctly.
* This should finally fix ticket #6454, but I keep it open until it's confirmed.


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


# 4c6e53f60110acdffece47baaa7568010de40823 25-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* IPv4 must always set the net_buffer::interface_address on incoming buffers; it
didn't do that for broadcasts - this is still not a full solution as it won't
work for link layer broadcasts, but this should fix most DHCP problems.
* IPv4 multicast doesn't do that yet.
* Only send ICMP errors if it hasn't been a link layer broadcast.


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


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

* Fixed CID 1511: protocol could be NULL.


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


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

* Automatic whitespace cleanup, no functional change.


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


# 081dd39e94773c0b614dcee35942dd9efc35bb2e 06-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Further improved debug output.


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


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

* Finished groundwork on ICMP by introducing a completely protocol agnostic
error mechanism.


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


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

* Renamed net_datalink_module::send_data() to send_routed_data(), and
send_datagram() to send_data().
* Renamed DatagramSocket::SocketEnqueue() to EnqueueClone(), SocketDequeue()
to Dequeue().
* Ordered the methods in ProtocolUtilities.h according to their declaration.


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


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

* Replaced more occurences of EOPNOTSUPP with B_NOT_SUPPORTED.


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


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

* Only allow raw sockets for root.


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


# d72a2493e6eff7a91868b567965fe5ec45c4865c 29-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* Replaced ENODEV with B_DEVICE_NOT_FOUND.


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


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

* ipv4_error_received() also needs to fill in the buffer's address, and
protocol, and cut off its IPv4 header before forwarding the buffer to the
upper layers.
* Some minor cleanup.


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


# 74a4c33fdacc43ae6e4eb3bbd647a711eed4d2de 21-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented a way to preserve header data while passing along a buffer to the
upper layers: you use the store_header() function to mark the header you want
to preserve. All subsequent remove_header() calls won't claim the actual
data, but only move the node start around.
* This header can then be restored by restore_header(). However, a call to
prepend_data() will destroy the stored header. Also, if remove_header() cuts
off a whole node, restoring the header won't succeed anymore.
* Discarded the no longer needed net_buffer::network_header field.
* Also discarded the hoplimit field which temporarily breaks the IPv6 build
until Atis reworks it.
* IPv4 now also dumps the IP header in the send path if debug output is enabled.
* icmp_error_reply() might be called so early that the net_buffer's addresses
do not point to the reply address; this is now detected, and the addresses are
taken out of the IP header in that case.
* Improved dumping the net_buffer to also include its address, and flags.


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


# 0a0bed1c7bb2ec8227154b943cfda4a8c97c32a8 21-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* Improved debug output; ipv4 will now dump the whole header if TRACE_IPV4 is defined.


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


# fcea1b1665d2048833de13c30b72ed15aa67d2b3 21-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* ICMP now removes its header before passing the error on to the upper levels.
* Therefore, IPv4 no longer needs to mess with that (incorrectly, anyway).
* Removed unused include, turned off ICMP debug output.


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


# aea00dc3bcf831cc364f4f2d41bd39028375dfef 21-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* deliver_multicast() now returns whether or not it delivered the buffer,
instead of always returning B_OK.
* deliver_multicast() now takes the protocol restriction of a raw socket into
account.
* raw_receive_data() now correctly returns whether a buffer was delivered (due
to the protocol restriction, this wasn't the case before).
* ipv4_receive_data() leaked all multicast buffers.
* Some minor cleanup.


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


# 1978fb81ee336190191a317ad0fb413e8044f2fd 20-Jul-2010 Axel Dörfler <axeld@pinc-software.de>

* First part of ICMP support: this is based on the work by Ivo Vachkov (GSoC
2007), and Yin Qiu (GSoC 2008). And even though I needed to rewrite pretty
much all of it because of the countless bugs and problems it had, it still
shares the same architectural problems of introducing a domain dependent
error mechanism to the upper layers, and needing the
net_buffer::network_header hack. This I will rework later.
* net_buffer's append_size(), and prepend_size() will now gracefully handle
buffers without a data node.


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


# bedf29cacd9a3bb3eea2b6afc7c98258e86f75df 14-Jan-2010 Axel Dörfler <axeld@pinc-software.de>

* Fixed build with tracing turned on.


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


# 751ce9e228a278970a492fead1ecedbfab453d2c 03-Dec-2009 Axel Dörfler <axeld@pinc-software.de>

* 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


# abf272eedb9aa23e9bf21c74028a278787e596cf 05-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* Cleanup, looks better this way.


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


# 6e48ebf44688edfb0dc5a0571e9e320e60d3df42 05-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* "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


# 5147963dcd57fefa4f63c484eb88e9eaf4002976 26-Jul-2009 Stephan Aßmus <superstippi@gmx.de>

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


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

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


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


# 2dd3063164442d611fce2af6d6fd2ecd535faea9 03-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* 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


# 65b5dd506434be335f769b95531fafa1f184a6fb 25-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* 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


# e5c5e337e460603bf3026cda34d67bee09ec7ab4 17-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Minor cleanup.


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


# 9871124eb2ceffad94e7c5bb54b9dd25250f8cb1 17-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* 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


# b788c037f361768f279aa7f8e91c7c65dbd5de0d 26-May-2009 Oliver Tappe <zooey@hirschkaefer.de>

* 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


# 372087dde5986d518f2a74d8c81f3910c4141462 12-Oct-2008 Oliver Tappe <zooey@hirschkaefer.de>

* fixed sending of IP-level broadcasts

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


# 14eaa7b61daa48bbe71e8db119aff667eaf95ebc 19-Jul-2008 Oliver Tappe <zooey@hirschkaefer.de>

* 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


# 276aa463efb0cc5b6562c46b540c01df679f77ba 24-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# cbeac9882f4b0a7c544b45243df7b8cd43a6a821 02-Jun-2008 Axel Dörfler <axeld@pinc-software.de>

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


# 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


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

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


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


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

IPv4 now uses module_dependencies, it mustn't put the stack module manually anymore.
This fixes unloading of the stack (some fixes to the module code that let you
determine this kind of bugs earlier will be committed next).


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


# 84052230379abf8e556e20e499d9a6040157f4a6 31-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

axeld+bonefish: Got rid of the ParentType in the HashTableDefinition; it doesn't really
belong there.


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


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

net_buffer: preparing for better metadata management


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


# 2b1c2dd349b8d96486de50054793bce91b489d1c 01-May-2007 Hugo Santos <hugosantos@nowhere.fake>

when 0 is specified as the interface index with the generic multicast delta API, the stack should select an interface for the application.


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


# ab7e05a39ba3901dbde96b19b70ed1414513111e 01-May-2007 Hugo Santos <hugosantos@nowhere.fake>

also dump filter mode and sources in 'ipv4_multicast'.


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


# bbcf6596ece04698d4260b27d6e6e109489f6a6d 01-May-2007 Hugo Santos <hugosantos@nowhere.fake>

select the default interface to be used for multicast through a routing table query.


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


# 8465a069104e40de35a4a56225b26ca5ba5c74f9 30-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

added a ValueIterator to MultiHashTable to present a limited view in result of Lookup()s.


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


# 8aa4c7e3701d51a64961dd68d2ff74ee4d3374b2 01-May-2007 Hugo Santos <hugosantos@nowhere.fake>

prepared the ipv4 multicast code for full multicast support.


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


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

some getsockopt/setsockopt and multicast fixes.

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


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


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

added 'ipv4_multicast' debugger command.


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


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

ipv4: changed the multicast filter to use an hash table to keep source states.


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


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

use OpenHashTable in IPv4's MulticastGroups.


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


# 53f23f85a2725c8fc31c7a874256084c7c623d86 25-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

partially rewrote TCP's endpoint manager. Fixes #1173


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


# 8a819b17e4ebb40461954432b6b8cfb29946b32f 19-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

retrieve the incoming interface on the domain_receive_adapter(). This should fix potential issues with packets addressed to the IP broadcast address, such as in with some DHCP implementations.


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


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

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


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


# 1408d1f0ce8555b9b94037e6f1c9c530afe753b6 15-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

introduced datalink's send_datagram to perform route and source address selection and dispatch the datagram to appropriate domain/protocol.


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


# 342824b6da071c33f2c14b3551c5067855f865bb 15-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

fixed the reception of multicast frames by RAW sockets.


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


# 6a60618094d288e845e7384ec6ab5b4e63f742e5 15-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

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


# 4229d7091edcd319ba893a3816e5a077871218cc 14-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

made UDP's send_data call into IPv4's, so we can handle of the datagram stuff in one place.


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


# 629878443b1b3d87008938c7f2f133e0cf43a033 14-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

made IPv4's send path be multicast aware.

- also added IP_MULTICAST_TTL support.


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


# d3be4145727574faf2834aab6d3c85a2edfc8c4b 14-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

initial IPv4 multicast receive path.


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


# 6c501a4085f9f397f2865e80df1242404c8f7066 14-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

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


# 46527f6806b3d52282de36566581fd567d839839 14-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

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


# 49f3c71e21b3b4f09905bf967b84e909fa24cd2b 13-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

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


# 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


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

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


# 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


# 6c35350908905903b5c150154b0da9698ca8943a 11-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

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


# 87001e059c8012ef40c462709833b5ae4212fb4a 11-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

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


# 7664bcb5c42ce2e8b1324de100aeabba4cfac81f 09-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

A couple more TCP fixes.

- ipv4_bind() was broken when binding to addresses not INADDR_ANY, as it wasn't copying the address to the socket, fixed.
- fixed a small issue in TCP's BindToEphemeral where the correct address might not have been bound to the socket.
- some assorted TCP wait lists fixes.
- fixed TCP's Connect() over the loopback interface, we might already be ESTABLISHED after _SendQueue() returns.
- fixed the amount of time we wait in TCP's Accept().


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


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

send buffer size is irrelevant for UDP, instead check if the fed buffer is larger than the maximum payload UDP supported. Do the same in IPV4.


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


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

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


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


# 51541d38f5ab535e4e62d54c748b483d56bd2aa7 01-Apr-2007 Axel Dörfler <axeld@pinc-software.de>

You also have to recompute the checksum in case the source address was updated,
patch by Hugo Santos.


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


# ea2de1a1151e4455328f745a3b67f0ea177a78bb 25-Mar-2007 Axel Dörfler <axeld@pinc-software.de>

* If the IP_HDRINCL option is used, ipv4_send_routed_data() now checks if the source
address is set, and changes this if not; this makes traceroute work on Haiku.
Patch by Hugo Santos.
* Minor cleanup.


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


# 6de46a80050cba47acc0378df90efadb86a5a153 24-Mar-2007 Axel Dörfler <axeld@pinc-software.de>

Rearranged ipv4_control() a bit, and fixed a bug that would always return B_BAD_VALUE
on setsockopt() for all options. Thanks to Hugo Santos for pointing this out.


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


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

The IPv4 protocol now stores all domain receiving protocols, and only put them away on uninit.
This should speed up packet retrieval a lot.


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


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

Added support for IP_TOS and IP_TTL options.


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


# 4818d3b627706446f8800f46d344653a9d64f92c 06-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

IPv4 send_routed_data() can now also work with a route whose address is NULL; this
is useful for bringing up (and using) an unconfigured interface. Specifically, DHCP
will be using this method to get the broadcast out.


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


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

Calmed down net_buffer and IPv4 a bit.


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


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

* 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


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

Minor cleanup.


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


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

* 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


# 81435928fb847df2c1906111e2c3408cfcbead7a 15-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

* 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


# 5450af82205578e90df5409295818a7909e0d239 13-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

Implemented fragmenting IP packets - not yet tested, though.


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


# 08d8ae0cff5f3286b40c5eb3827facf96588f77b 12-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

Made the ipv4_send_routed_data() function a bit more safe to use (now checks if the
route passed in is valid).


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


# 0054baf8c918a5e560d606633d1ed81e921c1b81 27-Sep-2006 Andrew Galante <agalante@nowhere.fake>

A few bugfixes to prepend_size and append_size so they don't create unnecessary empty nodes. Minor cleanup to ipv4.cpp.

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


# 891a127fecd553cc2168db11ccc564f5ba38fad6 17-Sep-2006 Marcus Overhagen <marcusoverhagen@gmail.com>

various gcc 4 related build fixes


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


# 9515b3f27d58a4bda6e43c0fa7d2b263428790e8 10-Aug-2006 Andrew Galante <agalante@nowhere.fake>

Extra error checking in init

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