History log of /haiku/src/add-ons/kernel/network/datalink_protocols/arp/arp.cpp
Revision Date Author Comments
# 1029af17 01-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

Add missing includes following previous commit.

All these files were making use of headers included indirectly
through AutoLock.h that are now no longer following the previous commit.


# 14b0498c 16-Nov-2018 Michael Lotz <mmlr@mlotz.ch>

arp: Trim the reply buffer to the filled length.

We reuse the incoming request buffer to send our reply. We did however
not trim that buffer to the length we actually filled out, allowing
any extraneous incoming data to remain in that buffer and be sent back.


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

Missing std::nothrow on new

Forgot to add this when migrating to BOpenHashTable.


# 18d67546 10-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Remove leftover varialbe declaration.

Thanks to Oliver for watching.


# d1644d7e 10-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Fix another misuse of BOpenHashTable::Iterator

* This ioctl is used only in the arp command, but still we should keep
it working
* Similar to the problem in elf.cpp, this relied on entry being set to
NULL when trying to iterate after the last element.


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

ARP: convert to BOpenHashTable

* Replaced the hash function as it wasn't really useful. It seems better
to use the full in_addr_t as a hash as it is a 32bit value. Shuffling it
like the previous hash function did can only increase the number of
collisions.
* BOpenHashTable lacks the "range" parameter to the hash function, so we
can't know which bits from the hash are actually going to be used.


# 077c84eb 05-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: atomic_*() functions rework

* No need for the atomically changed variables to be declared as
volatile.
* Drop support for atomically getting and setting unaligned data.
* Introduce atomic_get_and_set[64]() which works the same as
atomic_set[64]() used to. atomic_set[64]() does not return the
previous value anymore.


# 54490bbd 08-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* sockaddr_dl::sdl_e_type is now always stored in network order.


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


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

* On change_address(), arp_remove_local_enty() must not switch to the address
that caused the change (but that has not actually been changed yet).
* Also, it will now reset the INADDR_ANY local address in case there is no
other address configured. This should help with automatic configuring after
deletion of an interface address (though it doesn't seem to work yet for
some other reason, at least in VMware).


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


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

* Also initialize the arp_protocol::local_address field, spotted by Atis,
thanks!


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


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

* Turns out it wasn't such a bright idea to reset the protocol in
arp_update_entry() for known entries, as it also uses that to update the
timestamp.


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


# 07ad8bb6 05-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* We need to call arp_remove_local_entry() from arp_change_address() even if the
old address is NULL for anything but SIOCAIFADDR. Hopefully, this fixes the
problem Rene is seeing.
* Make sure that arp_entry::protocol is not NULL before using it. This is
necessary because of the possibility to manually set ARP entries.
* Further improved debug output.
* Minor cleanup.


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


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

* Improved debug output.


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


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

* Introduced a datalink layer (2) independent way of specifying the packet
type one wants to receive. Changed ipv6_datagram to use that (but note that
it currently does not compile).
* Header cleanup.


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


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

* Applied next work in progress patch by Atis that takes into account most of
my comments so far. Thanks!


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


# 82aa4a0f 04-Dec-2009 Axel Dörfler <axeld@pinc-software.de>

* 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


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

* 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


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

* 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


# 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


# 801591db 29-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Added an atomic_pointer_set() template function to util/atomic.h.
* Made the pointers const.
* Changed how the ARP module maintains its arp_entry::request_buffer: it
now uses the atomic_pointer*() functions to make sure there is no race
condition, and it's deleted only once.
* Getting an ARP entry would return uninitialized data, if the entry hadn't
been resolved yet.


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


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

Partial solution to a race condition between arp_timer() and
arp_update_entry(). While arp_timer() was sending the last request
arp_update_entry() could be called (caused by an incoming reply) and
free the request buffer, which arp_timer() would free a moment later
again. The problem is not completely solved, since a duplicate reply can
still cause a double free. Checked in mainly for Axel's reading
pleasure. :-)


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


# 372952df 30-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

* We now cache the local hardware address in the protocol object. This allows
us to not have to look it up in arp_send_data(), and also to have more than
one uninitialized interface around (ie. set to INADDR_ANY), and still have
the ARP layer act correctly.
* arp_update_entry() now allows entries that link to INADDR_ANY to be updated
at will. This fixes trying to bring more than one uninitialized interface up.
* Some cleanup.


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


# b17ea3a3 19-Jul-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

axeld:
Calm down ARP tracing.


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


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

added join_multicast/leave_multicast to datalink protocols, preparing for full multicast support.


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


# f56b0aa0 16-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

fixed arp's ClearQueue when an entry is rejected.


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


# 624c52d8 15-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

ARP now queues packets while resolving a destination instead of blocking on send_data(). This fixes several issues:

- TCP now behaves correctly when receiving new connections as its SYN/ACK is queued, or if lost correctly retransmitted when the peer resends a SYN.
- The first ICMP Replies from an external on-link host pinging Haiku are no longer lost.
- Reduced the number of ARP messages Haiku needs to generate until resolving an entry.


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


# 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


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

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


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


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

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


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


# 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


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

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


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


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

* Fixed the test for equality when a known ARP reply came in - you should no longer
see the "ARP entry updated with different address" message.
* sockaddr_dl::sdl_data is now unsigned (uint8_t instead of char).


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


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

* ARP no longer tries to resolve the target address in case of a link-level broadcast
(indicated by MSG_BCAST).
* ARP should now be able to resolve addresses with an unconfigured interface as well.
* datalink_is_local_address() now uses interfaces without an address as a fallback
in case no more specific interface could be found.


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


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

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


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


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

Missing std::nothrow on new

Forgot to add this when migrating to BOpenHashTable.


# 18d6754608850fe01e1a2060b50c057cd7aa5e05 10-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Remove leftover varialbe declaration.

Thanks to Oliver for watching.


# d1644d7e4fdc62dd671d792278f744d476a110df 10-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Fix another misuse of BOpenHashTable::Iterator

* This ioctl is used only in the arp command, but still we should keep
it working
* Similar to the problem in elf.cpp, this relied on entry being set to
NULL when trying to iterate after the last element.


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

ARP: convert to BOpenHashTable

* Replaced the hash function as it wasn't really useful. It seems better
to use the full in_addr_t as a hash as it is a 32bit value. Shuffling it
like the previous hash function did can only increase the number of
collisions.
* BOpenHashTable lacks the "range" parameter to the hash function, so we
can't know which bits from the hash are actually going to be used.


# 077c84eb27b25430428d356f3d13afabc0cc0d13 05-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: atomic_*() functions rework

* No need for the atomically changed variables to be declared as
volatile.
* Drop support for atomically getting and setting unaligned data.
* Introduce atomic_get_and_set[64]() which works the same as
atomic_set[64]() used to. atomic_set[64]() does not return the
previous value anymore.


# 54490bbd5026c6de84f0cfe1fc841b1a07924700 08-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* sockaddr_dl::sdl_e_type is now always stored in network order.


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


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

* On change_address(), arp_remove_local_enty() must not switch to the address
that caused the change (but that has not actually been changed yet).
* Also, it will now reset the INADDR_ANY local address in case there is no
other address configured. This should help with automatic configuring after
deletion of an interface address (though it doesn't seem to work yet for
some other reason, at least in VMware).


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


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

* Also initialize the arp_protocol::local_address field, spotted by Atis,
thanks!


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


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

* Turns out it wasn't such a bright idea to reset the protocol in
arp_update_entry() for known entries, as it also uses that to update the
timestamp.


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


# 07ad8bb60ebc1bd8d88e0ec4b1c0475e89f4a333 05-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* We need to call arp_remove_local_entry() from arp_change_address() even if the
old address is NULL for anything but SIOCAIFADDR. Hopefully, this fixes the
problem Rene is seeing.
* Make sure that arp_entry::protocol is not NULL before using it. This is
necessary because of the possibility to manually set ARP entries.
* Further improved debug output.
* Minor cleanup.


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


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

* Improved debug output.


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


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

* Introduced a datalink layer (2) independent way of specifying the packet
type one wants to receive. Changed ipv6_datagram to use that (but note that
it currently does not compile).
* Header cleanup.


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


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

* Applied next work in progress patch by Atis that takes into account most of
my comments so far. Thanks!


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


# 82aa4a0f4eb05d13d34dd932566cc2feb8d922e8 04-Dec-2009 Axel Dörfler <axeld@pinc-software.de>

* 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


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

* 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


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

* 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


# 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


# 801591dbdea634316f6ff0b0fd0b18f5eaafee6b 29-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Added an atomic_pointer_set() template function to util/atomic.h.
* Made the pointers const.
* Changed how the ARP module maintains its arp_entry::request_buffer: it
now uses the atomic_pointer*() functions to make sure there is no race
condition, and it's deleted only once.
* Getting an ARP entry would return uninitialized data, if the entry hadn't
been resolved yet.


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


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

Partial solution to a race condition between arp_timer() and
arp_update_entry(). While arp_timer() was sending the last request
arp_update_entry() could be called (caused by an incoming reply) and
free the request buffer, which arp_timer() would free a moment later
again. The problem is not completely solved, since a duplicate reply can
still cause a double free. Checked in mainly for Axel's reading
pleasure. :-)


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


# 372952dffc350486d4c4a81f9234a9aeb2648414 30-Nov-2007 Axel Dörfler <axeld@pinc-software.de>

* We now cache the local hardware address in the protocol object. This allows
us to not have to look it up in arp_send_data(), and also to have more than
one uninitialized interface around (ie. set to INADDR_ANY), and still have
the ARP layer act correctly.
* arp_update_entry() now allows entries that link to INADDR_ANY to be updated
at will. This fixes trying to bring more than one uninitialized interface up.
* Some cleanup.


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


# b17ea3a37c997a42528702cdc33a1f1d0334158c 19-Jul-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

axeld:
Calm down ARP tracing.


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


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

added join_multicast/leave_multicast to datalink protocols, preparing for full multicast support.


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


# f56b0aa00d294096961102baa10ac3cc7a36aefd 16-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

fixed arp's ClearQueue when an entry is rejected.


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


# 624c52d8b79439bb992a5847eefb10d20a132ac3 15-Apr-2007 Hugo Santos <hugosantos@nowhere.fake>

ARP now queues packets while resolving a destination instead of blocking on send_data(). This fixes several issues:

- TCP now behaves correctly when receiving new connections as its SYN/ACK is queued, or if lost correctly retransmitted when the peer resends a SYN.
- The first ICMP Replies from an external on-link host pinging Haiku are no longer lost.
- Reduced the number of ARP messages Haiku needs to generate until resolving an entry.


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


# 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


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

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


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


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

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


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


# 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


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

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


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


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

* Fixed the test for equality when a known ARP reply came in - you should no longer
see the "ARP entry updated with different address" message.
* sockaddr_dl::sdl_data is now unsigned (uint8_t instead of char).


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


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

* ARP no longer tries to resolve the target address in case of a link-level broadcast
(indicated by MSG_BCAST).
* ARP should now be able to resolve addresses with an unconfigured interface as well.
* datalink_is_local_address() now uses interfaces without an address as a fallback
in case no more specific interface could be found.


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


# 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