History log of /haiku/src/add-ons/kernel/network/protocols/ipv4/ipv4_address.cpp
Revision Date Author Comments
# 81521280 21-Mar-2020 X512 <danger_mail@list.ru>

Fix clang warning "mismatched-tags"

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


# d6a17b61 14-Feb-2011 Rene Gollent <anevilyak@gmail.com>

Slight simplification, no functional change.



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


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

* Made sure is_empty_address() also detects AF_UNSPEC addresses as empty.
* The is_empty_address() function of AF_UNIX did not deal correctly with empty
addresses.


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


# ab1a4bef 12-Apr-2010 Oliver Tappe <zooey@hirschkaefer.de>

cleaning up after myself 4 years later:
* remove matches_broadcast_address slot in address module, as it
doesn't exist anywhere
* automatic whitespace cleanup



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


# 56f097eb 12-Apr-2010 Oliver Tappe <zooey@hirschkaefer.de>

Applying patch by Atis Elsts:
* fix connecting to INADDR_ANY work for tcp (effectively will
connect to INADDR_LOOPBACK)
* add same behaviour to udp
* move some ipv4-specific code out of tcp into ipv4 address module
* bind() and connect() now reject addresses from non-matching
families
* myself: minor cleanup in udp.cpp with respect to 80 chars limit
Closes #5716 - many thanks!


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


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

* Our INADDR_* and IN_CLASS* macros were mostly wrong - they are supposed to
be in host endian order.
* Adapted ipv4 code that automatically finds a netmask to this change.
* Cleanup.


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


# 5193237f 15-Apr-2009 Oliver Tappe <zooey@hirschkaefer.de>

fixing #3712:
* Since r30000, a net_socket is not zeroed anymore, which in turn
leaves its two addresses (local and peer) in an uninitialized,
but correct state - marking their state with ss_len == 0.
However, this state was not properly detected in some ipv4-address
functions, especially not the one that creates a hash value from
those two addresses.
This basically caused UDP to stop working, as here the peer address
(as opposed to TCP) is usually not explicitly initialized.
Adjusting the ipv4-address functions accordingly fixes the problem,
such that DHCP (and the rest of UDP) should now work again.


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


# b5a5aebc 28-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a set_to_defaults() function to the address module: it can be used
to retrieve the default settings for the netmask/broadcast depending on the
specified address/netmask.
* interface_protocol_control() now uses this to reset the broadcast/netmask
to their default values on SIOCSIFADDR resp. the former only on
SIOCSIFNETMASK.
* This fixes bug #1861.


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


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

added 'udp_endpoints' debugger command.


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


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

small cleanups in UDP

- don't set_to_empty_address, instead consider NULL to be the empty address and use is_empty_address().
- most ipv4 address module calls already consider NULL to be the empty address, ipv4_hash_address_pair didn't, fixed.


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


# 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


# d6a17b61aa96b86ffd3132c282e50e40551cbcbd 14-Feb-2011 Rene Gollent <anevilyak@gmail.com>

Slight simplification, no functional change.



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


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

* Made sure is_empty_address() also detects AF_UNSPEC addresses as empty.
* The is_empty_address() function of AF_UNIX did not deal correctly with empty
addresses.


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


# ab1a4bef4f205a95a19424f85c38b4e5de65f37f 12-Apr-2010 Oliver Tappe <zooey@hirschkaefer.de>

cleaning up after myself 4 years later:
* remove matches_broadcast_address slot in address module, as it
doesn't exist anywhere
* automatic whitespace cleanup



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


# 56f097ebd91d9b6369407d2bbfcc19718788d182 12-Apr-2010 Oliver Tappe <zooey@hirschkaefer.de>

Applying patch by Atis Elsts:
* fix connecting to INADDR_ANY work for tcp (effectively will
connect to INADDR_LOOPBACK)
* add same behaviour to udp
* move some ipv4-specific code out of tcp into ipv4 address module
* bind() and connect() now reject addresses from non-matching
families
* myself: minor cleanup in udp.cpp with respect to 80 chars limit
Closes #5716 - many thanks!


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


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

* Our INADDR_* and IN_CLASS* macros were mostly wrong - they are supposed to
be in host endian order.
* Adapted ipv4 code that automatically finds a netmask to this change.
* Cleanup.


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


# 5193237f1f52684a7f2c3dd5db552e65d2ca2943 15-Apr-2009 Oliver Tappe <zooey@hirschkaefer.de>

fixing #3712:
* Since r30000, a net_socket is not zeroed anymore, which in turn
leaves its two addresses (local and peer) in an uninitialized,
but correct state - marking their state with ss_len == 0.
However, this state was not properly detected in some ipv4-address
functions, especially not the one that creates a hash value from
those two addresses.
This basically caused UDP to stop working, as here the peer address
(as opposed to TCP) is usually not explicitly initialized.
Adjusting the ipv4-address functions accordingly fixes the problem,
such that DHCP (and the rest of UDP) should now work again.


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


# b5a5aebc909a141cd5baf1f1a44c72724dd3204e 28-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a set_to_defaults() function to the address module: it can be used
to retrieve the default settings for the netmask/broadcast depending on the
specified address/netmask.
* interface_protocol_control() now uses this to reset the broadcast/netmask
to their default values on SIOCSIFADDR resp. the former only on
SIOCSIFNETMASK.
* This fixes bug #1861.


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


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

added 'udp_endpoints' debugger command.


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


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

small cleanups in UDP

- don't set_to_empty_address, instead consider NULL to be the empty address and use is_empty_address().
- most ipv4 address module calls already consider NULL to be the empty address, ipv4_hash_address_pair didn't, fixed.


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


# 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