Commit Graph
100 Commits
Author SHA1 Message Date
Yu Watanabe 32df2e1447 path-util: introduce path_is_safe()
The function is similar to path_is_valid(), but it refuses paths which
contain ".." component.
2021-05-28 13:41:23 +09:00
Yu Watanabe 6636883564 path-util: use path_find_first_component() in path_is_valid() 2021-05-28 13:41:23 +09:00
Yu Watanabe 0ee54dd4e2 path-util: introduce path_find_first_component()
The function may be useful to iterate on each path component.
2021-05-28 13:41:23 +09:00
Yu Watanabe 340cd6b6f9 path-util: fix off by one issue to detect slash at the end in path_extend() 2021-05-28 13:41:23 +09:00
Yu Watanabe 4e95bc56df Merge pull request #19749 from poettering/path-extend
add path_extend() helper which is a like if path_join() and strextend() had a baby
2021-05-28 05:53:57 +09:00
Yu Watanabe 38dd7673b3 Merge pull request #19703 from yuwata/network-ndisc-valid-time
network: ndisc: always honor valid time
2021-05-27 18:42:31 +09:00
Yu Watanabe facaf083f0 Merge pull request #19743 from yuwata/dhcpv4-static-leases
network: dhcp-server:  support static lease
2021-05-27 18:41:22 +09:00
Yu Watanabe a19b1ac7c8 network: ndisc: update log message 2021-05-27 16:33:36 +09:00
Yu Watanabe 25db3aeaf3 network: ndisc: always honor valid time
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.
2021-05-27 16:33:33 +09:00
Yu Watanabe e954939b9e Merge pull request #19736 from poettering/udev-trigger-uuid
sd-device: add support for triggering devices with UUID support
2021-05-27 13:05:00 +09:00
Yu Watanabe 06043c7821 test-network: refuse RA if not necessary 2021-05-26 21:22:13 +09:00
Yu Watanabe 618da3e7d5 test-network: wait for that the link is in configuring state at the beginning 2021-05-26 21:13:56 +09:00
Yu Watanabe 89c629fc4b Merge pull request #19726 from poettering/path-event-symlink
teach .path units to notice events on paths with components that are symlinks
2021-05-26 10:51:00 +09:00
Yu Watanabe b69855e645 Merge pull request #19727 from poettering/pcr-comma
Allow PCRs to be separated by "+" instead of ","
2021-05-26 10:37:24 +09:00
Yu Watanabe 95599cacd3 core/service: do not set zero error to log_unit_debug_errno()
Fixes #19725.
2021-05-26 10:23:36 +09:00
Yu Watanabe 764dca0edc dns-domain: fix build failure with libidn
Follow-up for 319a4f4bc4.

Fixes #19723.
2021-05-26 10:23:36 +09:00
Yu Watanabe 13eeefe1a8 Merge pull request #19716 from yuwata/sd-netlink-NETLINK_GET_STRICT_CHK
sd-netlink: enable NETLINK_GET_STRICT_CHK socket option to filter out message on kernel
2021-05-25 22:38:59 +09:00
Yu Watanabe 5de0d10bee Merge pull request #19715 from yuwata/network-link-group
network: allow to set Group=0 in [Link] section
2021-05-25 13:29:50 +09:00
Yu Watanabe 5709c7fe4e Merge pull request #19713 from nabijaczleweli/bootctlpsko-liter
The "obviously good stuff" from #19006 again
2021-05-25 08:31:38 +09:00
Yu Watanabe 922a653090 test: add testcases of filtering on dumping addresses 2021-05-25 08:26:00 +09:00
Yu Watanabe 6a28b78f2e local-addresses: set ifindex when dump addresses on an interface 2021-05-25 08:26:00 +09:00
Yu Watanabe c31298be7a network: set ifindex when dump addresses on an interface 2021-05-25 08:26:00 +09:00
Yu Watanabe d7418b3bb2 sd-netlink: set NETLINK_GET_STRICT_CHK socket option
Then kernel filters out unnecessary info on dumping, e.g. RTM_GETADDR.
2021-05-25 08:26:00 +09:00
Yu Watanabe 3e0eeb8e33 sd-netlink: do not set route type and table by default for RTM_GETROUTE or friends 2021-05-25 08:26:00 +09:00
Yu Watanabe 3ca619061d sd-netlink: do not set action for RTM_GETRULE message
Otherwise, when NETLINK_GET_STRICT_CHK socket option is enabled, no rule
will be dumped.
2021-05-25 08:26:00 +09:00
Yu Watanabe f318f64388 sd-netlink: do not enable dump flag by default for RTM_GETADDR message 2021-05-25 08:26:00 +09:00
Yu Watanabe 97bb863c25 sd-netlink: do not append prefixlen by default
Otherwise, when NETLINK_GET_STRICT_CHK socket option is enabled, no
address will be dumped.
2021-05-25 08:26:00 +09:00
Yu Watanabe 5aafd5b190 network: add several assertions in conf parsers 2021-05-25 07:12:05 +09:00
Yu Watanabe f0c09831bd network: allow to set Group=0 in [Link] section
Previously, when a link has already in a numbered group, we cannot
remove the link from the group.

This also fixes the range mentioned in the man page.
2021-05-25 07:12:05 +09:00
Yu Watanabe 113d94c393 Merge pull request #19704 from yuwata/network-small-fixes
network: several tiny cleanups
2021-05-23 23:02:07 +09:00
Yu Watanabe 70f32a260b udev/net: do not manage loopback interfaces
There are nothing we can configure in udevd for loopback interfaces;
no ethertool configs can be applied, MAC address, interface name should
not be touched.
2021-05-23 22:58:47 +09:00
Yu Watanabe f25e642bca sd-netlink: rename rtnl_get_link_iftype() -> rtnl_get_link_info() and make it optionally return link flags 2021-05-23 22:58:03 +09:00
Yu Watanabe ce01c07f1c udev/net: rename link_config -> LinkConfig 2021-05-23 22:58:03 +09:00
Yu Watanabe afca7ac13d udev/net: rename link_config_ctx -> LinkConfigContext 2021-05-23 22:58:03 +09:00
Yu Watanabe 75d5abd298 network: IPv6LinkLocalAddressGenerationMode=none disables IPv6LL addressing 2021-05-23 17:13:06 +09:00
Yu Watanabe c3b9425130 network: make link_configure() static 2021-05-23 17:12:48 +09:00
Yu Watanabe fbb1a39866 ordered-set: introduce ordered_set_get() 2021-05-23 17:12:40 +09:00
Yu Watanabe 2a5a844259 Merge pull request #19681 from yuwata/ethtool-util-log
ethtool-util: several cleanups
2021-05-23 15:24:46 +09:00
Yu Watanabe 3ee316bd7b ethtool-util: drop unused function 2021-05-23 11:40:15 +09:00
Yu Watanabe 80662eecbf udev/net: drop unnecessary conditions 2021-05-23 11:40:15 +09:00
Yu Watanabe a7994dd3ab udev/net: drop fallback logic to set speed
ethtool_set_glinksettings() already fallback to use ETHTOOL_GSET/ETHTOOL_SSET
commands when ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS are not
supported.
2021-05-23 11:40:15 +09:00
Yu Watanabe ba1030594e ethtool-util: do not touch anything if nothing is requested
And update settings only when it is necessary.
2021-05-23 11:40:15 +09:00
Yu Watanabe c8e644b116 ethtool-util: disable autonegotiation when speed, duplex, or port is specified
And if autonegotiation is enabled, speed, duplex, and port are ignored.

Fixes #19625.
2021-05-23 11:40:15 +09:00
Yu Watanabe 4323046c5f ethtool-util: move and rebreak comments 2021-05-23 11:40:15 +09:00
Yu Watanabe 4f5040313d ethtool-util: make ethtool_connect() open fd only when it is not opened 2021-05-23 11:39:56 +09:00
Yu Watanabe af92e46527 Merge pull request #19594 from yuwata/network-nexthop-group
network: nexthop: add Group= setting to configure multipath route with group nexthop
2021-05-22 16:01:13 +09:00
Yu Watanabe a6c747a63f Merge pull request #19691 from poettering/read-virtual-file-tweaks
tweaks to read_virtual_file()
2021-05-22 15:59:17 +09:00
Yu Watanabe 9c8f90d0f9 test-network: add a test case for nexthop Group= setting 2021-05-22 04:59:45 +09:00
Yu Watanabe 228c3e21e9 network: nexthop: add Group= setting to configure multipath route with group nexthop 2021-05-22 04:59:40 +09:00
Yu Watanabe 8031e5ca8d network: nexthop: IFF_UP flag is required for nexthops which attached to a link 2021-05-22 04:56:46 +09:00
Yu Watanabe 7b3a7581e3 network: make nexthop_add(), nexthop_configure() and friends return 0 on success
After request queue is introduced, the return value on success is unused.
2021-05-22 04:56:46 +09:00
Yu Watanabe 234106dbf9 network: route: make stored multipath route weight equivalent to hop of nexthop 2021-05-22 04:54:09 +09:00
Yu Watanabe 11a288e846 ethtool-util: downgrade log level
This just hides issue #19625. It will be fixed in later commits.
2021-05-22 04:40:54 +09:00
Yu Watanabe e8f99f4e24 network: fix an infinite loop
Fixes #19467.
2021-05-21 12:03:01 +09:00
Yu Watanabe e6655fbe40 man: mention that drop-in files are merged in alphanumeric order
This addresses the request in https://github.com/systemd/systemd/issues/19467#issuecomment-829332877.
2021-05-20 21:20:51 +02:00
Yu Watanabe 580bf61304 sysv-generator: use strextend_with_separator() 2021-05-20 21:57:09 +09:00
Yu Watanabe 742a011a3a systemctl: use strextend_with_separator() 2021-05-20 21:57:09 +09:00
Yu Watanabe eda397c966 run: use strextend_with_separator() 2021-05-20 21:57:09 +09:00
Yu Watanabe cfea7618f2 nspawn: use strextendf_with_separator() 2021-05-20 21:57:04 +09:00
Yu Watanabe db5486b450 test-network: add a testcase for OutgoingInterface= in [BridgeFDB] 2021-05-20 18:23:15 +09:00
Yu Watanabe e5b35bf6c2 network: use queue to configure bridge FDB 2021-05-20 18:23:15 +09:00
Yu Watanabe 9671ae9d51 network: bridgeFDB: rename FdbEntry -> BridgeFDB 2021-05-20 18:23:15 +09:00
Yu Watanabe 4ff6ff9a91 networkctl: use strextend() 2021-05-20 18:18:56 +09:00
Yu Watanabe 03c324c578 sd-bus: use strextend() 2021-05-20 18:18:56 +09:00
Yu Watanabe f8abe13f32 escape: use strextend() 2021-05-20 18:18:56 +09:00
Yu Watanabe a2a7b77260 pid1: use strextend_with_separator() 2021-05-20 18:18:56 +09:00
Yu Watanabe 2b070200f1 env-util: use strextend() 2021-05-20 18:18:56 +09:00
Yu Watanabe 4304f68d15 network: route: make log_route_debug() show weight for multipath route 2021-05-20 18:18:52 +09:00
Yu Watanabe 6b13ca8ada string-util: introduce strextendf_with_separator() 2021-05-20 18:16:51 +09:00
Yu Watanabe 354dadb30f nspawn: fix build failure
This fixes a conflict between #19555 and #19653.
2021-05-20 10:04:14 +02:00
Yu Watanabe 834f3ba1a0 test: reduce debugging logs in test-event
The logs mostly give no information, but fill CI results.
2021-05-19 21:34:17 +02:00
Yu Watanabe 6db7b533c6 Merge pull request #19163 from sipraga/online-if-required
network: introduce an online state that respects RequiredForOnline=
2021-05-19 23:08:18 +09:00
Yu Watanabe 550721c2e3 alloc-util: use memcpy_safe() in memdup() or friends 2021-05-19 21:22:23 +09:00
Yu Watanabe d1f3b08098 memory-util: make memcpy_safe() return pointer to destination 2021-05-19 21:20:49 +09:00
Yu Watanabe 70a2d9dd31 network: route: check validity of interface name in MultiPathRoute= 2021-05-19 16:28:53 +09:00
Yu Watanabe 8ed87c4983 network: route: parse earlier if device specifier in MultiPathRoute= is ifindex 2021-05-19 16:28:53 +09:00
Yu Watanabe 0b54c87081 network: introduce link_get_by_name() 2021-05-19 16:28:53 +09:00
Yu Watanabe 8e4b1b35bc network: drop redundant condition
When Network::unmanaged is set, then the Network object is not assigned
to any Link object. Hence, the condition is always false.
2021-05-19 16:25:02 +09:00
Yu Watanabe 3a1dfdb43f network: drop unnecessary call of manager_rtnl_process_address()
The reply should be NLMSG_DONE or NLMSG_ERROR.
Moreover, calling the function for reply of address label configuration
is completely wrong.
2021-05-19 16:17:23 +09:00
Yu Watanabe f4cc13646f network: drop unused "callback" arguments in route_remove() and address_remove() 2021-05-19 10:38:57 +09:00
Yu Watanabe 50b7477064 network: dhcp4: re-request DHCP4 address and routes immediately
It is not necessary to wait for removal is finished, as network queue
already do the same thing.
2021-05-19 10:38:57 +09:00
Yu Watanabe e7901aba14 Merge pull request #19611 from yuwata/network-dhcp-server-introduce-server-address
network: dhcp-server: introduce ServerAddress= setting
2021-05-19 10:29:43 +09:00
Yu Watanabe 734b3115d6 Merge pull request #19631 from yuwata/network-fix-reference-counting-issues
network: fix reference counting issues
2021-05-19 10:29:16 +09:00
Yu Watanabe 6b87254ad1 Merge pull request #19630 from keszybz/jinja2
Use jinja2 for templating
2021-05-19 10:27:21 +09:00
Yu Watanabe cc2d7efc5c network: fix Link reference counter issue
Previously, when link_new() fails, `link_unref()` was called, so,
`Manager::links` may become dirty.
This introduces `link_drop_or_unref()` and it will be called on
failure.
2021-05-18 20:40:56 +09:00
Yu Watanabe 56001f0233 network: also drop requests when link enters linger state
Otherwise, if link is removed, several references to the link in remain
exist in requests.
2021-05-18 20:40:56 +09:00
Yu Watanabe 63130eb36d network: merge link_drop() and link_detach_from_manager()
link_detach_from_manager() is only called by link_drop(). It is not
necessary to split such tiny function.
2021-05-18 20:40:56 +09:00
Yu Watanabe ce9388d72a network: fix possible message counter double decrement
When after_configure() for a request fails, then the request is not
removed from the queue at that time, and the link enters to failed
state. After that, if the link is reconfigured or its carrier is lost,
then the request is dropped from the queue, and the message_counter is
decreased. However, the counter is already or will be also decreased
when the corresponding netlink reply is received.
So, the counter is decreased twice.
2021-05-18 20:40:50 +09:00
Yu Watanabe 72ffb9133d test-network: add testcases for ServerAddress= 2021-05-18 20:20:24 +09:00
Yu Watanabe 0017ba3165 network: dhcp-server: introduce ServerAddress= setting
This may be useful when the link which DHCP server running on has
multiple static addresses.
2021-05-18 20:20:24 +09:00
Yu Watanabe 998545a7d9 network: address: introduce link_get_ipv4/ipv6_address() 2021-05-18 20:20:24 +09:00
Yu Watanabe 99b5f4f7b8 network: use UINT32_C() macro 2021-05-18 20:20:24 +09:00
Yu Watanabe 473680be32 network: introduce address_set_broadcast() 2021-05-18 20:20:20 +09:00
Yu Watanabe c9f2db2c40 network: use config_parse_in_addr_non_null() 2021-05-18 20:19:37 +09:00
Yu Watanabe cf0747725d conf-parser: introduce config_parse_in_addr_non_null() 2021-05-18 20:19:37 +09:00
Yu Watanabe 4301cb32f2 fix typo 2021-05-14 19:51:37 +02:00
Yu Watanabe 893e3ffe7d network: shorten code a bit and update log message 2021-05-14 09:38:41 +02:00
Yu Watanabe f8cd3f610f shell-completion: support --json option for hostnamectl 2021-05-14 09:18:29 +09:00
Yu Watanabe bfc2b05e59 networkctl: introduce --json option for "status" and "list" commands
When `--json` option is specified, "status" and "list" commands gives
the same information, as originally "list" just gives partial
information of "status" in different format.
2021-05-14 09:18:29 +09:00
Yu Watanabe fec7a9e0ac json: make JSON_VARIANT_ARRAY/OBJECT_FOREACH() nestable 2021-05-14 09:18:29 +09:00