Commit Graph

237 Commits

Author SHA1 Message Date
Yu Watanabe 2a236f9fc0 network: ignore broadcast address for /31 or /32 addresses
As they do not have broadcast address.
See https://tools.ietf.org/html/rfc3021
2020-12-03 10:23:12 +09:00
Yu Watanabe 05a7023d24 network: fix verification for broadcast address
Fixes a bug caused by fe841414ef.
2020-12-03 10:23:12 +09:00
Yu Watanabe dca63b5b46
Merge pull request #17474 from yuwata/network-drop-link-deserialization-logic
network: drop link deserialization logic
2020-11-27 09:08:01 +09:00
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Timo Rothenpieler b8162cd200 network: store full hardware address in Link struct
This passes the legacy ethernet address to functions in a lot of places,
which all will need migrated to handle arbitrary size hardware addresses
eventually.
2020-10-28 14:44:43 +01:00
Yu Watanabe 7b829a7b3b network: do not serialize/deserialize addresses
The link state file is always removed when networkd is stopping. So,
the deserialization logic does not work. Moreover, the ADDRESSES=
entry is not used by sd-network, so serialization is also not necessary.
2020-10-28 18:15:57 +09:00
Yu Watanabe 3def88503a network: set previous DHCP4 address in link->addresses_foreign
Previously, the address was taken from the state file, but DHCP4_ADDRESS=
entry was dropped by 46986251d6.
Moreover, the link state file is always removed when networkd is
stopping. Let's take the address from the list of enumerated addresses.
2020-10-28 15:44:05 +09:00
Yu Watanabe 9c914c0401
Merge pull request #17357 from yuwata/network-dhcp6-pd-announce-17353
network: add an option to control announcement of delegated prefix
2020-10-23 12:57:58 +09:00
Yu Watanabe 8a08bbfc98 network: drop static prefixes and static route prefixes earlier if IPv6PrefixDelegation=no or dhcpv6 2020-10-19 10:09:38 +09:00
Yu Watanabe 7abe175c00 network: also unref IPv4 ACD clients in Address objects
This should not change any behavior, as currently link_free_engines() is
always called after all addresses are dropped. But the function may be
used in other places in the future. So, let's also stop the clients.
2020-10-15 08:11:32 +09:00
Yu Watanabe a391901eb2 network: drop unnecessary conditions
sd_ipv4acd_stop() and sd_ipv4ll_stop() are idempotent.
2020-10-15 07:40:13 +09:00
Yu Watanabe c6a7531e0e network: voidify sd_ipv4acd_stop() at one place 2020-10-15 07:39:40 +09:00
Yu Watanabe 84add3cd2b network: drop conditions to check existence of each engine 2020-10-15 07:38:45 +09:00
Yu Watanabe b1476b5210 network: constify arguments 2020-10-13 20:30:38 +09:00
Yu Watanabe fe841414ef network: read peer address, label, broadcast from rtnl message
Then, Address objects in Network and Link can be easily compared by
address_equal().
2020-10-13 20:30:35 +09:00
Yu Watanabe 9b9c5fff16 network: directly compare with in_addr element for IPv4 case
When peer address is set, address_compare_func() (or address_equal())
does not work in link_is_static_address_configured(), as an Address object
stored in a Link does not contain peer addresses. So, we need to also
compare with in_addr element for IPv4 case.

Fixes #17304.
2020-10-13 20:30:16 +09:00
Yu Watanabe 13ffa39f8e network: rename network_verify_xxx() -> network_drop_invalid_xxx()
As 'verify' implies a boolean result.
2020-10-07 03:22:03 +09:00
Yu Watanabe 494b6b43cb network: fix masquerade setting logic
Previously, address_establish() took Address object stored in Network
object. And address_release() took Address object stored in Link
object. Thus, address_release() always did nothing.
2020-10-07 03:13:26 +09:00
Yu Watanabe cd1caf30c0 network: always use RT_SCOPE_HOST for IPv4 loopback addresses
For IPv6 case, use RT_SCOPE_HOST only when scope is not explicitly specified.
2020-10-07 03:13:18 +09:00
Yu Watanabe d93d655c40 network: update MAC address in IPv4 ACD clients
When the MAC address of a link is updated, an address on the link may
be under checking address duplication. Or, (currently such code is not
implemented yet, but) address duplication check may be restarted later.
For that case, the IPv4 ACD clients must use the new updated MAC address.
2020-10-07 02:59:34 +09:00
Yu Watanabe 490ccbd5e5 network: configure IPv4 DAD per link address
Previously, IPv4 DAD is configured in each Address object stored in
Network object. If a .network file matches multipe links, then it causes
an assertion. To prevent it, now IPv4 DAD is configured in each Address
object belogs to Link object.
2020-10-07 02:57:58 +09:00
Yu Watanabe 693ec5ca83 network: constify one argument 2020-10-07 02:57:54 +09:00
Yu Watanabe cde1f0e8fc network: introduce address_copy() 2020-10-07 02:54:01 +09:00
Yu Watanabe eaff204f09 network: do not update Address::flags in address_configure() 2020-10-07 02:50:51 +09:00
Yu Watanabe f5ee7d74af network: fix indentation 2020-10-07 02:50:51 +09:00
Yu Watanabe 4cf8500067 network: use sd_event stored in Manager 2020-10-07 02:50:51 +09:00
Yu Watanabe 51f5dfd8ba network: move link_enumerate_ipv6_tentative_addresses() 2020-10-07 02:50:51 +09:00
Yu Watanabe bfbf150ee6 network: manage address pools by OrderedSet 2020-10-07 02:50:50 +09:00
Yu Watanabe ed76f58521 network: move functions related to address pool 2020-10-07 02:50:50 +09:00
Yu Watanabe 093e35334d network: header cleanup 2020-10-07 02:50:50 +09:00
Yu Watanabe 67a58eb378 network: make several functions static 2020-10-07 02:50:50 +09:00
Yu Watanabe aa651e88de network: manage addresses from pool by Set 2020-10-07 02:50:50 +09:00
Yu Watanabe 9cd9fc8f44 network: drop list of static addresses
[Address] sections are managed by both LIST and Hashmap. Let's drop the
list and manage them by OrderedHashmap.
2020-10-07 02:50:50 +09:00
Yu Watanabe 7818f8589a network: make address_free() return NULL 2020-10-07 02:50:50 +09:00
Yu Watanabe 2488e4d934 network: introduce link_stop_ipv4_dad() 2020-10-07 02:50:50 +09:00
Yu Watanabe b87d6a8284 network: move link_configure_ipv4_dad() 2020-10-07 02:50:50 +09:00
Yu Watanabe da4d3a612d network: introduce link_deserialize_addresses() 2020-10-07 02:50:50 +09:00
Yu Watanabe 3b31e2b718 network: introduce link_serialize_addresses() 2020-10-07 02:50:50 +09:00
Yu Watanabe 32400c2ff0 network: introduce network_verify_addresses() 2020-10-07 02:50:50 +09:00
Yu Watanabe 9a0ad16b26 network: update log messages
And drop unnecessary log for in_addr_to_string(), as its result is used
only for the consequent logs.
2020-10-07 02:49:17 +09:00
Yu Watanabe e1fc2c4371 network: move manager_rtnl_process_address() 2020-10-07 02:44:43 +09:00
Yu Watanabe d7fbb9f50c network: introduce link_drop_addresses() 2020-10-07 02:44:43 +09:00
Yu Watanabe f8f2f880d4 network: introduce link_drop_foreign_addresses() 2020-10-07 02:44:43 +09:00
Yu Watanabe 682c65b04c network: introduce link_set_addresses() 2020-10-07 02:44:43 +09:00
Zbigniew Jędrzejewski-Szmek 90e74a66e6 tree-wide: define iterator inside of the macro 2020-09-08 12:14:05 +02:00
Yu Watanabe 50550722e3 network: fix NDisc handling for the case when multiple routers exist
69203fba70 does not consider the case that
multiple routers exist, and causes #16719.

Fixes #16719.
2020-09-08 02:30:04 +09:00
Yu Watanabe 99a2878457 network: expose address_{hash,compare}_func() 2020-09-08 02:30:04 +09:00
Yu Watanabe fb282d4e25 network: only process non-error message 2020-08-08 12:31:12 +09:00
Yu Watanabe ea121d8f25 network: update address infomation even if link is in failed or linger state
As the link may be reconfigured later. If we do not update the address
information, then its setup state or operstate may not be updated
correctly.
2020-07-29 02:05:05 +09:00
Yu Watanabe e55265184b network: do not assume static addresses are configured
link_request_set_routes() is also called when a dynamic address is
configured. At that time, static addresses may not be configured yet.

Fixes #16546.
2020-07-29 02:05:05 +09:00