| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
This makes most header files easier to look at. Also Emacs gets really
slow when browsing through large sections of overly long prototypes,
which is much improved by this macro.
We should probably not do something similar with too many other cases,
as macros like this might help readability for some, but make it worse
for others. But I think given the complexity of this specific prototype
and how often we use it, it's worth doing.
|
|\
| |
| | |
basic: timezone_is_valid: check for magic bytes "TZif"
|
| | |
|
| |
| |
| |
| |
| |
| | |
This also fixes a wrong argument for route_configure().
Fixes #8960.
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch add support to enables to send User Class option code 77
RFC 3004.
This option MAY carry multiple User Classes.
The format of this option is as follows:
Code Len Value
+-----+-----+--------------------- . . . --+
| 77 | N | User Class Data ('Len' octets) |
+-----+-----+--------------------- . . . --+
where Value consists of one or more instances of User Class Data.
Each instance of User Class Data is formatted as follows:
UC_Len_i User_Class_Data_i
+--------+------------------------ . . . --+
| L_i | Opaque-Data ('UC_Len_i' octets) |
+--------+------------------------ . . . --+
UserClass=
A DHCPv4 client can use UserClass option to identify the type or category of user or applications
it represents. The information contained in this option is an string that represents the user class
of which the client is a member. Each class sets an identifying string of information to be used by the DHCP service to classify clients. Takes a whitespace-separated list.
UserClass= hello world how are you
Closes: RFC: #5134
|
|
|
|
|
|
| |
While Saving the DNS server use [IPv6AcceptRA] UseDNS= that is
ipv6_accept_ra_use_dns.
Closes #8420
|
|
|
|
|
|
|
|
|
|
| |
Rather than choosing to set or unset any of these flag
use kernel defaults. This patch makes following properties to unset.
UseBPDU = unset
HairPin = unset
FastLeave = unset
AllowPortToBeRoot = unset
UnicastFlood = unset
|
|
|
|
|
|
|
|
| |
If an interface name is changed, then the link state, especially
managed or not, may need to be updated, as its corresponding
.link or .network files may be different. So, let's once drop
the link and recreate a new link object.
Fixes #8794.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This cleans up handling of MTU values across the codebase. Previously
MTU values where stored sometimes in uint32_t, sometimes in uint16_t,
sometimes unsigned and sometimes in size_t. This now unifies this to
uint32_t across the codebase, as that's what netlink spits out, and what
the majority was already using.
Also, all MTU parameters are now parsed with config_parse_mtu() and
config_parse_ipv6_mtu() is dropped as it is now unneeded.
(Note there is one exception for the MTU typing: in the DCHPv4 code we
continue to process the MTU as uint16_t value, as it is encoded like
that in the protocol, and it's probably better stay close to the
protocol there.)
|
|
|
|
| |
We already have it in missing.h, and once suffices.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This drops a good number of type-specific _cleanup_ macros, and patches
all users to just use the generic ones.
In most recent code we abstained from defining type-specific macros, and
this basically removes all those added already, with the exception of
the really low-level ones.
Having explicit macros for this is not too useful, as the expression
without the extra macro is generally just 2ch wider. We should generally
emphesize generic code, unless there are really good reasons for
specific code, hence let's follow this in this case too.
Note that _cleanup_free_ and similar really low-level, libc'ish, Linux
API'ish macros continue to be defined, only the really high-level OO
ones are dropped. From now on this should really be the rule: for really
low-level stuff, such as memory allocation, fd handling and so one, go
ahead and define explicit per-type macros, but for high-level, specific
program code, just use the generic _cleanup_() macro directly, in order
to keep things simple and as readable as possible for the uninitiated.
Note that before this patch some of the APIs (notable libudev ones) were
already used with the high-level macros at some places and with the
generic _cleanup_ macro at others. With this patch we hence unify on the
latter.
|
|
|
|
|
|
| |
Issue #5853 introduced a link_down for every netdev enslaved. This behaviour is
not required on other slave interfaces.
fixes 14b6bb7
|
|
|
|
|
| |
This patch supports to configure IPv6 MTU.
Closes #8632
|
|
|
|
|
|
|
|
| |
Double newlines (i.e. one empty lines) are great to structure code. But
let's avoid triple newlines (i.e. two empty lines), quadruple newlines,
quintuple newlines, …, that's just spurious whitespace.
It's an easy way to drop 121 lines of code, and keeps the coding style
of our sources a bit tigther.
|
|\
| |
| | |
bus-util: introduce bus_open_system_watch_bind_with_description()
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The dhcp4 code sets link->dhcp4_configured when dhcp4_route_handler()
has processed the last message.
However, in case UseRoutes=no has been set in the [DHCP] section, or
in case the DHCP server simply sends no routes, link_set_dhcp_routes()
will not send any netlink messages and dhcp4_route_handler() will
therefore never be called.
This causes the link to never reach LINK_STATE_CONFIGURED, and e.g.
systemd-networkd-wait-online will not consider the link as ready.
Fix that by setting link->dhcp4_configured = true and calling
link_check_ready() in dhcp4_address_handler() in case
link_set_dhcp_routes() sent no netlink messages (dhcp4_messages is
zero).
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In some situation if networkd fails to get the network file
then networkd crashes becasse the link->network is not initalized;
```
veth99: Failed to get network dhcp-client-ipv4-only: No such file or directory
Segmentation fault
gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/sus/tt/systemd/build/systemd-networkd
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
Program received signal SIGSEGV, Segmentation fault.
link_load (link=0x55555582ccd0) at ../src/network/networkd-link.c:2973
2973 r = sd_dhcp_client_new(&link->dhcp_client, link->network->dhcp_anonymize);
(gdb) bt
(gdb) p link->network
$1 = (Network *) 0x0
(gdb) list
2968 if (r < 0) {
2969 log_link_debug_errno(link, r, "Failed to parse DHCPv4 address %s: %m", dhcp4_address);
2970 goto dhcp4_address_fail;
2971 }
2972
2973 r = sd_dhcp_client_new(&link->dhcp_client, link->network->dhcp_anonymize);
2974 if (r < 0)
2975 return log_link_error_errno(link, r, "Failed to create DHCPv4 client: %m");
2976
2977 r = sd_dhcp_client_set_request_address(link->dhcp_client, &address.in);
(gdb) r
```
|
|
|
| |
Follow-up for d7afd945b5aad5b262a3de97614f486d63d94612.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.
I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
|
| |
|
| |
|
|\
| |
| | |
Test and diagnostics improvements
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When we are attempting to create directory somewhere in the bowels of /var/lib
and get an error that it already exists, it can be quite hard to diagnose what
is wrong (especially for a user who is not aware that the directory must have
the specified owner, and permissions not looser than what was requested). Let's
print a warning in most cases. A warning is appropriate, because such state is
usually a sign of borked installation and needs to be resolved by the adminstrator.
$ build/test-fs-util
Path "/tmp/test-readlink_and_make_absolute" already exists and is not a directory, refusing.
(or)
Directory "/tmp/test-readlink_and_make_absolute" already exists, but has mode 0775 that is too permissive (0755 was requested), refusing.
(or)
Directory "/tmp/test-readlink_and_make_absolute" already exists, but is owned by 1001:1000 (1000:1000 was requested), refusing.
Assertion 'mkdir_safe(tempdir, 0755, getuid(), getgid(), MKDIR_WARN_MODE) >= 0' failed at ../src/test/test-fs-util.c:320, function test_readlink_and_make_absolute(). Aborting.
No functional change except for the new log lines.
|
| |
| |
| |
| | |
In preparation for subsequent changes...
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This macro will read a pointer of any type, return it, and set the
pointer to NULL. This is useful as an explicit concept of passing
ownership of a memory area between pointers.
This takes inspiration from Rust:
https://doc.rust-lang.org/std/option/enum.Option.html#method.take
and was suggested by Alan Jenkins (@sourcejedi).
It drops ~160 lines of code from our codebase, which makes me like it.
Also, I think it clarifies passing of ownership, and thus helps
readability a bit (at least for the initiated who know the new macro)
|
|\
| |
| | |
move route expiration to kernel
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
kernel >= 4.5 (with commit https://github.com/torvalds/linux/commit/32bc201e1974976b7d3fea9a9b17bb7392ca6394) supports
RTA_EXPIRES netlink attribute to set router lifetime. This simply detect
the kernel version (>=4.5) and set the lifetime properly, fallback to
expiring route in userspace for kernel that doesnt support it.
Signed-off-by: Daniel Dao <dqminh89@gmail.com>
|
| |
| |
| |
| |
| |
| | |
Even if pager_open() fails, in general, we should continue the operations.
All erroneous cases in pager_open() show log message in the function.
So, it is not necessary to check the returned value.
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
This makes users can configure DHCPv4 client with ClientIdentifier=duid-only.
If set so, then DHCP client sends only DUID as the client identifier.
This may not be RFC compliant, but some setups require this.
Closes #7828.
|
|/
|
|
|
| |
Let's systematically make use of reallocarray() whereever we invoke
realloc() with a product of two values.
|
|
|
|
| |
This is the usual spelling, and a bit shorter.
|
|
|
|
|
|
|
|
| |
Remote= must be a non multicast address. ip-link(8) says:
> remote IPADDR - specifies the unicast destination IP address to
> use in outgoing packets when the destination link layer address
> is not known in the VXLAN device forwarding database.
Closes #8088.
|
|\
| |
| | |
networkd: fixup networkctl type display
|
| |
| |
| |
| |
| |
| |
| | |
It's cleaner and more consistent to actually return what we were
planning on returning.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
|
| |
| |
| |
| |
| |
| | |
The return value is always ignored, so get rid of it.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Every place the kernel actually calls SET_NETDEV_DEVTYPE, it's adding a
piece of information that looks useful and relevant for us to use. So
let's use it when it's there.
The previous matching based on the corresponding ARPHRD didn't really
make much sense. The more sensible logic for getting a textual
representation of the link type is to see if the kernel supplies a
devtype. If it does, great. If not, then we can fall back on the ARPHRD,
as before.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
|
| |
| |
| |
| |
| |
| |
| | |
It's not useful to simply show "none", when we have more interesting
information to display.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
|
|/
|
|
|
|
|
|
|
|
| |
Found by the following warning by gcc.
```
../src/network/networkd-manager.c: In function 'dhcp6_prefixes_compare_func':
../src/network/networkd-manager.c:1383:16: warning: 'memcmp' reading 16 bytes from a region of size 8 [-Wstringop-overflow=]
return memcmp(&a, &b, sizeof(*a));
^
```
|
|
|
|
|
|
|
|
|
|
| |
It turns out that link local doesn't make much sense in its context.
Since link local is disabled by the kernel driver, it's important that
networkd assumes it's off too, so that the link can reach the
"configured" stage, without waiting indefinitely for link local
addresses which will never come.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
|
|\
| |
| | |
Networkd: cleanup code a bit
|
| | |
|
| | |
|