Commit Graph
26 Commits
Author SHA1 Message Date
Yu Watanabe de010b0b2e strv: make iterator in STRV_FOREACH() declaread in the loop
This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
2022-03-19 08:33:33 +09:00
LaserEyess ea5e55b311 network: rename SetupState to AdministrativeState
This is more consistent with the terminology used elsewhere. In
particular it is consistent with the name of the property exposed over
dbus for the link state.
2021-12-10 18:42:34 +09:00
Yu Watanabe e944711fba network: json: add src address when its prefix length is non-zero
This should not change anything. Just for consistency with
route_set_netlink_message(), which sets RTA_SRC attribute when prefix
length is non-zero.
2021-12-09 07:02:29 +09:00
Yu Watanabe d27e9b0f83 network: json: add missing initialization
Fixes CID#1466513.
2021-11-30 10:03:51 +09:00
Yu Watanabe b707e43d33 network: json: append DNS misc settings 2021-11-26 20:20:06 +09:00
Yu Watanabe 46c31852f1 network: json: append DNSSEC negative trust anchors 2021-11-26 20:20:06 +09:00
Yu Watanabe de045939ad network: json: append domains 2021-11-26 20:20:06 +09:00
Yu Watanabe 0843ec6c44 network: json: append SIP server information 2021-11-26 20:20:06 +09:00
Yu Watanabe dfd0a5f127 network: json: append NTP server information 2021-11-26 20:20:06 +09:00
Yu Watanabe 2ab60af29d network: json: append DNS server information 2021-11-26 20:20:06 +09:00
Yu Watanabe 3b60ededae network: json: add several entries for wait-online 2021-11-26 20:20:00 +09:00
Yu Watanabe da7c995b67 network: json: add more link information 2021-11-25 22:35:35 +09:00
Yu Watanabe 7edbe5fe40 network: json: append routing policy rule information 2021-11-25 22:35:35 +09:00
Yu Watanabe 6e66b981d5 network: json: append neighbor information 2021-11-25 22:35:35 +09:00
Yu Watanabe 972f17c8f6 network: json: append nexthop information 2021-11-25 22:35:35 +09:00
Yu Watanabe a92f3a1015 network: json: append route information 2021-11-25 22:35:35 +09:00
Yu Watanabe 5ee3ab4d3a network: json: append address information 2021-11-25 22:35:35 +09:00
Yu Watanabe 385f2512d5 network: json: split manager_build_json() into two 2021-11-25 22:35:35 +09:00
Yu Watanabe 165e719948 network: json: make {network,device}_build_json() accept NULL 2021-11-25 22:35:35 +09:00
Yu Watanabe cfb7e06b1e network: json: use new building json macros 2021-11-25 22:35:35 +09:00
Zbigniew Jędrzejewski-Szmek 718ca77232 shared/json: use int64_t instead of intmax_t
We were already asserting that the intmax_t and uintmax_t types
are the same as int64_t and uint64_t. Pretty much everywhere in
the code base we use the latter types. In principle intmax_t could
be something different on some new architecture, and then the code would
fail to compile or behave differently. We actually do not want the code
to behave differently on those architectures, because that'd break
interoperability. So let's just use int64_t/uint64_t since that's what
we indend to use.
2021-11-18 01:34:31 +01:00
Yu Watanabe 4eef6fad31 netif-util: rename link_get_type_string() -> net_get_type_string() 2021-11-09 08:24:10 +09:00
Yu Watanabe b5cc5591fa netif-util: move several functions from network-util.[ch] to shared/netif-util.[ch]
These functions are not relevant to sd-network, and only used by
networkd, networkctl, and udevd.
2021-11-09 08:24:10 +09:00
Yu Watanabe 6eab614db8 network: rename Manager::links -> Manager::links_by_index
This also renames link_get() -> link_get_by_index().
2021-07-01 00:49:02 +09:00
Alvin Šipraga bcdcc59648 network: add an online state for links and manager
Add a new state of type LinkOnlineState which indicates whether a link
is online or not. The state is also used by networkd's manager to expose
the overall online state of the system.

The possible states are:

  offline  the link (or system) is offline
  partial  at least one required link is online (see below)
  online   all required links are online

For links, a link is defined to be "online" if:
  - it is managed; and
  - its operational state is within the range defined by
    RequiredForOnline=; and
  - it has an IPv4 address if RequiredFamilyForOnline=ipv4 or =both; and
  - it has an IPv6 address if RequiredFamilyForOnline=ipv6 or =both.

A link is defined to be "offline" if:
  - it is managed; and
  - it is not online, i.e. its operational state is not within the range
    defined by RequiredForOnline=, and/or it is missing an IP address in
    a required address family.

Otherwise, the link online state is undefined (represented internally as
_LINK_ONLINE_STATUS_INVALID or -EINVAL). Put another way, networkd will
only offer a meaningful online state for managed links where
RequiredForOnline=yes.

For the manager, the online state is a function of the online state of
all links which are requried for online, i.e. RequiredForOnline=yes. If
all required links are online, then the manager online state is defined
to be "online". If at least one of the required links is online, then
the manager online state is defined to be "partial". If none of
the required links are online, then the manager online state is defined
to be "offline". If there are no managed links, or RequiredForOnline=no
for all managed links, then the manager online state is undefined as
above.

The purpose of the "partial" state is analogous to the --any switch in
systemd-networkd-wait-online.service(8). For example, a required link
which lacks a carrier on boot will not force the overall (manager)
online state to "offline" if there is an alternative link available.
2021-05-19 10:33:55 +09:00
Yu Watanabe 54a16efe18 network: introduce Describe() method for manager and links 2021-05-14 09:18:29 +09:00