Yu Watanabe
956dbf361b
network: warn if dynamic gateway is specified but corresponding protocol is disabled
2020-10-15 07:07:46 +09:00
Yu Watanabe
22d37e5df6
network: introduce network_adjust_dhcp()
2020-10-15 07:06:58 +09:00
Yu Watanabe
3773eb5485
network: introduce network_adjust_ipv6_accept_ra()
2020-10-15 07:06:36 +09:00
Yu Watanabe
c27abcf4fb
network: when Gateway=_dhcp4, set several properties based on lease if they are not explicitly specified
...
Before this commit, event when Gateway=_dhcp4 or _ra is set, the
route was configured with 'protocol static', and other properties
specified by RouteTable=, RouteMTU=, or etc, were ignored.
This commit makes set the route protocol based on the protocol the
gateway address is obtained, and apply other settings if it is not
explicitly specified in the [Route] section.
2020-10-15 07:06:23 +09:00
Yu Watanabe
5bb80a4603
network: determine a [Route] section will be used or not by gateway family instead of route family
...
By this commit, user can configure dynamic IPv6 Gateway with IPv4
destination.
2020-10-15 07:06:03 +09:00
Yu Watanabe
c3d679c43f
network: when Gateway=_dhcp, assume gateway family based on other settings
2020-10-15 07:05:58 +09:00
Yu Watanabe
b8caa4ef34
network: rename Gateway=_dhcp6 -> Gateway=_ipv6ra
2020-10-15 07:04:02 +09:00
Yu Watanabe
1a3a6309a7
network: rename gateway_from_dhcp -> gateway_from_dhcp_or_ra
...
As for IPv6 case gateway is given by RA.
2020-10-15 06:58:53 +09:00
Yu Watanabe
fd8f865c9f
Merge pull request #17342 from yuwata/network-dhcp-ipv4-acd-fixes
...
network: fixes several issues in IPv4 DAD for DHCP4
2020-10-14 23:12:41 +09:00
Zbigniew Jędrzejewski-Szmek
540e0bad3e
Merge pull request #17316 from yuwata/network-address-ipv4-peer-issue-17304
...
network: directly compare with in_addr element for IPv4 case
2020-10-14 15:02:14 +02:00
Yu Watanabe
dfc637d0ff
Merge pull request #17341 from yuwata/sd-dhcp-client-fix-eexist-issue-16964
...
sd-dhcp: make sd_dhcp_client_set_request_option() not return -EEXIST
2020-10-14 18:55:39 +09:00
Yu Watanabe
0e569a439a
network: start dynamic addressing clients like DHCP after setting netdevs
...
The function link_acquire_conf() may make the link state 'configuring'
when DHCP6 PD is enabled. Previously link_acquire_conf() was called
before link_enter_join_netdev(), and thus the assertion in the function
might be triggered.
Fixes #17329 .
2020-10-14 10:52:02 +02:00
Yu Watanabe
5431227400
network: update MAC address in IPv4ACD client for DHCP4
2020-10-14 15:38:29 +09:00
Yu Watanabe
a7df5cae54
network: also stop IPv4ACD client in link_stop_clients()
2020-10-14 15:38:29 +09:00
Yu Watanabe
66f507e1ba
network: stop IPv4ACD client for DHCPv4 when lease is exprired
2020-10-14 15:38:29 +09:00
Yu Watanabe
10fa21c0dc
network: move IPv4ACD client for DHCPv4 from Network to Link object
...
A .network file may matches multiple interfaces.
2020-10-14 15:38:29 +09:00
Yu Watanabe
8ff85383b4
network: voidify link_stop_clients() in link_enter_failed()
2020-10-14 15:38:29 +09:00
Yu Watanabe
4eb6a826b8
network: drop unused condition
2020-10-14 13:02:46 +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
Frantisek Sumsal
d46b79bbe0
tree-wide: drop if braces around single line expressions as well
2020-10-09 15:11:55 +02:00
Frantisek Sumsal
d7a0f1f4f9
tree-wide: assorted coccinelle fixes
2020-10-09 15:02:23 +02:00
Zbigniew Jędrzejewski-Szmek
081b300976
networkd: add assert to appease coverity
...
The code was OK, but not obviously so. Let's add an assert to help a
human or nonhuman reader figure it out.
Coverity CID#1433224.
2020-10-09 08:14:54 +02:00
Yu Watanabe
ceea6c1aff
network: introduce IPV4_ADDRESS_FMT_STR macro
...
This also moves ADDRESS_FMT_VAL() macro to networkd-address.h, and
renames it to IPV4_ADDRESS_FMT_VAL().
2020-10-08 02:51:23 +09:00
Yu Watanabe
d442bb3728
network: make Gateway= in [Route] section accept an empty string
2020-10-08 02:51:23 +09:00
Yu Watanabe
d306d1d0ca
network: introduce Gateway=_dhcp4 and _dhcp6, and deprecate "_dhcp"
...
Fixes #17249 .
2020-10-08 02:51:23 +09:00
Yu Watanabe
f9bb333832
network: manage multipath routes separately
2020-10-08 02:51:23 +09:00
Yu Watanabe
2fe1d557e5
sd-netlink: introduce rtattr_read_nexthop()
2020-10-08 02:51:23 +09:00
Yu Watanabe
d6ad41e27d
network: free Route object when route_remove() fails
...
When route_remove() succeeds, the Route object will be freed later by
manager_rtnl_process_route().
2020-10-08 02:51:23 +09:00
Yu Watanabe
423c249c2e
network: constify arguments
2020-10-08 02:51:23 +09:00
Yu Watanabe
6dd5398137
network: support IPv4 route with IPv6 gateway
2020-10-08 00:06:19 +09:00
Yu Watanabe
ad208fac73
network: also manage routes without RTA_OIF attribute
2020-10-07 15:22:10 +02:00
Yu Watanabe
fd7701bf31
network: ignore Scope= for IPv6 routes as it will not be used
2020-10-07 15:22:10 +02:00
Yu Watanabe
8973df5c42
network: set default priority for IPv6 routes
...
See inet6_rtm_newroute() in kernel's net/ipv6/route.c.
2020-10-07 15:22:09 +02: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
2ffd6d73f9
network: check feature is enabled in xxx_configure()
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
acc9fc2f51
network: drop unused function
2020-10-07 02:50:51 +09:00
Yu Watanabe
5e0534f1c1
network: move sysctl related functions to networkd-sysctl.c
2020-10-07 02:50:51 +09:00
Yu Watanabe
be9363ccab
network: introduce radv_update_mac()
2020-10-07 02:50:51 +09:00