Commit Graph
15 Commits
Author SHA1 Message Date
noxiouzandYu Watanabe 54e8ea6552 networkctl: use io.systemd.service.Reload() method
Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 22:55:52 +00:00
Yu Watanabe dde311ba14 networkctl: use new varlink methods
Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 22:55:52 +00:00
Zbigniew Jędrzejewski-Szmek 31ddd87da0 tree-wide: extend verbs functions with extra per-verb data parameter
We often have a pattern where the same verb function is used for
multiple actions. This leads to an antipattern where we figure out what
action needs to be taken from argv[0] multiple times: often once in
parse_argv() to figure out what options are allowed, then once again
implicitly in dispatch_verb(), and then again in the action verb itself.
Let's allow passing a parameter into the verb to simplify this.

This matches a pattern we have in conf-parser.h, where we have both
void *userdata (more global) and void *data (per-config item). Here,
I opted for uintptr_t userdata. It seems that most of the time we'll
want to just pass an enum value. This works OK with no casts. I also
tried a void* and union. In both cases, much more boilerplate is needed:
either a cast or a macro to help avoid compiler warnings. uintptr_t
seems generic enough to cover foreseeable usecases with no fuss.

This is a noop refactoring. See next commit for an example.
2026-03-18 10:28:47 +00:00
Zbigniew Jędrzejewski-Szmek 26216a7e95 networkctl: call all verb functions verb_* 2026-03-18 10:28:47 +00:00
Yu Watanabe b6919c737a network: rename io.systemd.Network.LinkUp()/LinkDown()
Then, this also moves their implementations to networkd-link-varlink.c.
2026-02-24 23:56:20 +09:00
Yu Watanabe 067758a3be networkctl: use varlink methods to bring up/down interfaces
Then,
- polkit authentication can be used,
- dynamic configuration engine can be safely stopped before bringing
  down interfaces.

Fixes #38538.
2026-02-16 18:37:17 +09:00
Yu Watanabe 314f93d9d3 networkctl: merge three functions for calling D-Bus methods 2026-02-16 18:37:17 +09:00
Yu Watanabe 63fd8c9b9e networkctl: use parse_interfaces() at one more place 2026-02-16 18:37:17 +09:00
Yu Watanabe 4610a4dc4c networkctl: split out parse_interfaces()
Also, this makes interfaces stored in OrderedSet rather than Set,
so interfaces becomes up/down in the specified order.

This also makes when multiple interfaces are specified, networkctl tries
to up/down all specfied interfaces even if some of them are failed.

Fixes #40017.
2026-02-16 18:37:17 +09:00
Zbigniew Jędrzejewski-Szmek 42ba99748d various: do not include file names directly in error messages
git grep -l 'Failed to open /'|xargs sed -r -i 's|"Failed to open (/[^ ]+): %m"|"Failed to open %s: %m", "\1"|g'
git grep -l $'Failed to open \'/'|xargs sed -r -i $'s|"Failed to open \'(/[^ ]+)\': %m"|"Failed to open %s: %m", "\\1"|g'
git grep -l "Failed to open /"|xargs sed -r -i $'s|"Failed to open (/[^ ]+), ignoring: %m"|"Failed to open %s, ignoring: %m", "\\1"|g'
+ some manual fixups.
2025-06-02 11:10:38 +02:00
Daan De Meyer 1e35e81b2c tree-wide: Clean up includes
Preparation for cleaning up includes in src/shared.
2025-05-22 21:10:15 +02:00
Daan De Meyer baa3fadfb7 network: Clean up includes
Split out of #37344.
2025-05-22 02:15:43 +09:00
Daan De Meyer 93a1f7921a basic: Stop including log.h in macro.h
Now that the necessary functions from log.h have been moved to macro.h,
we can stop including log.h in macro.h. This requires modifying source
files all over the tree to include log.h instead.
2025-04-18 14:19:15 +02:00
Lennart Poettering 868258cf38 basic: split ifname related calls from format-util.h into format-ifname.h
This way we don't have to pull in net/if.h into format-util.h.

This is supposed to address https://github.com/systemd/systemd/pull/32212#discussion_r1755639881

No actual code changes, just a .c/.h file split-up.
2024-09-13 07:27:47 +02:00
Yu Watanabe 1bf49198b5 networkctl: split networkctl.c into small pieces
No functional change, just refactoring.
2024-08-22 01:12:39 +09:00