summaryrefslogtreecommitdiff
path: root/src/network/networkd-ndisc.c
Commit message (Collapse)AuthorAgeFilesLines
* network: use monotonic instead of boot time to handle address ↵Yu Watanabe2021-08-091-1/+3
| | | | | | | | creation/update timestamp Follow-up for 25db3aeaf32ba95bad5e765720ebc23c8ef77a99 and 899034ba8167bd16e802cfbea29a9ee85dee5be5. Fixes another issue in #20244.
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* network: fix overflow issue in address lifetime calculationYu Watanabe2021-07-021-2/+4
| | | | | Fixes another issue reported in #20050. See https://github.com/systemd/systemd/issues/20050#issuecomment-872967337.
* network: drop old ndisc configurations after new ones are configuredYu Watanabe2021-07-021-3/+4
| | | | | | | | | | | | | | | | | Previously, `ndisc_remove_old_one()` checked `ndisc_{addresses,routes}_configured` flags, but they are not unset when all addresses or routes are already assigned. After the request queue is implemented, the address or route requests are not processed within the same event of ndisc handler is called, but will processed later when they are ready. So, calling `ndisc_remove_old()` in the event of ndisc handler will remove all addresses and routes previously assigned even they are requested to be updated. This makes `ndisc_remove_old()` do nothing when there exist some requests to configure addresses and routes, thus previously assigned addresses and routes are kept until all requests are processed. Fixes #20050.
* ether-addr-util: drop redundant "addr" from struct hw_addr_dataYu Watanabe2021-06-101-3/+3
| | | | Also, this makes always specifiy "struct" for hw_addr_data.
* network: introduce request_hash_ops to dedup requestsYu Watanabe2021-06-081-2/+2
| | | | | If KeepConfiguration= or ConfigureWithoutCarrier= is set, then the same requests may be queued.
* network: ndisc: update log messageYu Watanabe2021-05-271-2/+2
|
* network: ndisc: always honor valid timeYu Watanabe2021-05-271-20/+18
| | | | | | | See draft-ietf-6man-slaac-renum-02, section 4.2. https://datatracker.ietf.org/doc/html/draft-ietf-6man-slaac-renum#section-4.2 Replaces #15260.
* network: drop unused "callback" arguments in route_remove() and address_remove()Yu Watanabe2021-05-191-2/+2
|
* network: address: introduce link_get_ipv4/ipv6_address()Yu Watanabe2021-05-181-2/+2
|
* network: use request queue to configure addresses, routes, and nexthopsYu Watanabe2021-05-121-62/+120
| | | | | | | | | | | | | | | | | | | | Why is this necessary? Several examples below. - When a route sets prefsrc, then the address must be already assigned (see issue #19285), and also it must be ready if IPv6. - When a route or nexthop sets gateway, then the address must be reachable. - When a route sets nexthop ID, then the corresponding nexthop must be assigned. - When a route sets multipath routes on another interface, then the interface must exist and be ready to configure. - When configuring address, the same address must not be under removing (see issue #18108). Etc,. etc,... So, this makes all requests about addresses, routes, and nethops are once stored in the queue, and will be processed when they are ready to configure. Fixes #18108 and #19285.
* network: split out common part of route or address handlersYu Watanabe2021-05-121-19/+6
|
* network: use IPV4_ADDRESS_FMT_STR/VAL macros and in6_addr_to_string() or friendsYu Watanabe2021-05-121-45/+46
|
* network: ndisc: fix ipv6 route preference for routes with Gateway=_ipv6raYu Watanabe2021-04-291-1/+1
|
* network: configure non-dhcp configs earlier even DUID-UUID is used by DHCP ↵Yu Watanabe2021-04-211-0/+11
| | | | | | | | | | clients Previously, if DUID-UUID is used, all configurations are configured after networkd gets product uuid of machine. This makes only DHCP clients are delayed, and other configs are configured earlier.
* network: move RouteMetric= from [DHCPv6] to [IPv6AcceptRA]Yu Watanabe2021-04-211-4/+4
| | | | As the value is used in the routes in RA.
* network: refuse to configure engines such as DHCP client more than onceYu Watanabe2021-04-131-1/+1
|
* network: refuse to configure NDISC twiceYu Watanabe2021-04-101-8/+9
|
* network: also introduce UseDomains= for [DHCPv6] sectionYu Watanabe2021-03-141-1/+3
| | | | | When we split [DHCP] section into [DHCPv4] and [DHCPv6], UseDomains= setting was forgot to be introduced in [DHCPv6] section.
* tree-wide: use usec_add() and usec_sub_unsigned()Yu Watanabe2021-03-051-4/+4
|
* network: move state file related functions to networkd-state-file.[ch]Yu Watanabe2021-03-031-0/+1
|
* network: suffix types with _t in public headersLennart Poettering2021-02-181-1/+1
| | | | | | | | | | | | Apparently, in our current public headers (i.e. those called sd-*.h) we suffixed typedefs that we use as values with _t, but we didn't do this for enum typedefs. Fix that while this stuff is not actually public yet. With this scheme "value typedefs" now end systematically in _t, and "object typedefs" (i.e. structures that are typically passed around via pointers and not values) do not. No code changes, just some renaming.
* tree-wide: constify variables if possibleYu Watanabe2021-02-181-2/+2
|
* network: use in_addr_prefix_to_string()Yu Watanabe2021-02-181-3/+3
|
* tree-wide: use in_addr_is_set() or friendsYu Watanabe2021-02-181-6/+5
|
* network: ndisc: change link state into "configuring" only when a new address ↵Yu Watanabe2021-02-121-3/+4
| | | | or route will be assigned
* network: automatically set NLM_F_REPLACE flagYu Watanabe2021-02-121-1/+1
| | | | | | | | | | | | The difference between sd_rtnl_message_new_addr() and sd_rtnl_message_new_addr_update() is only whether NLM_F_REPLACE flag will be set or not. If an address is already assigned, then we need to set NLM_F_REPLACE flag, otherwise, address_configure() will be fail. This makes address_configure() judge whether we should use the flag or not.
* network: drop one more link_dirty()Yu Watanabe2021-02-011-2/+0
| | | | | | | Follow-up for 9092113d93f61d67605f7c4a824b65a56b33fa59. link_dirty() will be called later in this function when a DNS or domain is dropped.
* network: drop many unnecessary link_dirty() callsYu Watanabe2021-01-221-14/+24
| | | | | | Now link state saves mostly link state, DNS and NTP settings, .network file name. So, it is not necessary to call link_dirty() e.g. when an address is updated. This drops such unnecessary link_dirty() calls.
* network: do not re-assign static routes when dynamic IPv6 addresses are updatedYu Watanabe2021-01-221-14/+1
| | | | | | | This effectively reverts 6545067aa950cf0af740a6fad88ff56d1b3fd40a. Unlike IPv4 addresses, routes are not removed when IPv6 addresses are removed. So, it is not necessary to re-assign routes.
* network: ndisc - Use ordered_set_ensure_putSusant Sahani2021-01-201-4/+2
|
* network: introduce RouterAllowList= and RouterDenyList= in [IPv6AcceptRA]Yu Watanabe2020-12-241-8/+26
|
* networkd: add support for prefix allow-list and route allow-listSusant Sahani2020-12-241-14/+27
|
* network: make RouteDenyList= filter route prefix rather than gateway addressYu Watanabe2020-12-241-10/+11
| | | | | | | DenyList= filters provided prefixes, not router address. So, RouteDenyLisy= should so for consistency. Fixes 16c89e649d248b0fc7c1dc7ad9f3323be4eac0f4.
* network: fix condition for checking the provided gateway is assigned to linkYu Watanabe2020-12-241-1/+1
| | | | Fix bug introduced by 221019166f315252304b3459902ead613b905de5.
* network: drop redundant TAKE_PTR()Yu Watanabe2020-12-241-2/+0
| | | | Follow-up for 16c89e649d248b0fc7c1dc7ad9f3323be4eac0f4.
* networkd: add RouteDenyListDevon Pringle2020-12-181-11/+27
| | | | | | | Allow configuration for IPv6 discovered routes to be ignored instead of adding them as a route. This can be used to block unwanted routes, for example, you may wish to not receive some set of routes on an interface if they are causing issues.
* network: move variable declarationYu Watanabe2020-12-181-2/+2
|
* networkd: handle ignoring ll gateway being link llDevon Pringle2020-12-161-3/+13
| | | | | | | | | | | | | In the event where network discovery gets a route with the gateway being the interfaces local link address, networkd will fail the interface. systemd-networkd[44319]: br_lan: Configuring route: dst: fdcd:41a4:5559:ec03::/64, src: n/a, gw: fe80::e4da:7eff:fe77:5c5e, prefsrc: n/a, scope: global, table: main, proto: ra, type: unicast systemd-networkd[44319]: br_lan: Could not set NDisc route or address: Gateway can not be a local address. Invalid argument systemd-networkd[44319]: br_lan: Failed systemd-networkd[44319]: br_lan: State changed: configuring -> failed This patch, instead of allowing the interface to fail, will instead log the event and skip setting the route.
* network: use address_get() in address_exists()Yu Watanabe2020-12-081-1/+1
| | | | And rename address_exists() to link_has_ipv6_address().
* network: honor M or O flag in RA even if IPv6AcceptRA.DHCPv6Cleint=alwaysYu Watanabe2020-11-161-4/+8
| | | | | | | | | | Follow-up for ac24e418d9bc988ecf114c464701b35934948178. The original motivation of the commit and RFE #15339 is to start dhcpv6 client in managed mode when neither M nor O flag is set in the RA. But, previously, if the setting is set to "always", then the DHCPv6 client is always started in managed mode even if O flag is set in the RA. Such the behavior breaks RFC 7084.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* network: store full hardware address in Link structTimo Rothenpieler2020-10-281-2/+7
| | | | | | 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.
* network: introduce network_adjust_ipv6_accept_ra()Yu Watanabe2020-10-151-13/+16
|
* network: when Gateway=_dhcp4, set several properties based on lease if they ↵Yu Watanabe2020-10-151-2/+15
| | | | | | | | | | | | 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.
* network: determine a [Route] section will be used or not by gateway family ↵Yu Watanabe2020-10-151-2/+1
| | | | | | | instead of route family By this commit, user can configure dynamic IPv6 Gateway with IPv4 destination.
* network: rename gateway_from_dhcp -> gateway_from_dhcp_or_raYu Watanabe2020-10-151-1/+1
| | | | As for IPv6 case gateway is given by RA.
* network: read peer address, label, broadcast from rtnl messageYu Watanabe2020-10-131-3/+3
| | | | | Then, Address objects in Network and Link can be easily compared by address_equal().
* network: support IPv4 route with IPv6 gatewayYu Watanabe2020-10-081-0/+3
|
* network: also manage routes without RTA_OIF attributeYu Watanabe2020-10-071-1/+1
|