Yu Watanabe
bf2a8b7b13
fuzz-dhcp-server: attach sd_event to make dhcp_server_cleanup_expired_leases() works in the fuzzer
...
Otherwise, most code paths in dhcp_server_handle_message() are not
evaluated by the fuzzer.
2022-01-25 00:05:02 +09:00
Yu Watanabe
0590f1b58c
fuzz-dhcp-server: duplicate input data
...
As `dhcp_server_handle_message()` -> `ensure_sane_request()` may modify
the input data, and that causes error in some fuzzing engine.
2022-01-24 19:37:37 +09:00
Yu Watanabe
c3da2e4732
fuzz-dhcp-server: also set new lease elements correctly
...
The fuzzer does not send anything to the address, so it should be not
necessary, but just for safety.
2022-01-24 19:28:21 +09:00
Yu Watanabe
ab4f9eeb7b
sd-dhcp-server: fix heap buffer overflow
...
This checks client hardware length earlier.
2022-01-24 04:49:33 +09:00
Yu Watanabe
54d95d02e3
sd-dhcp-server: support packet from non-Ethernet interface
...
Fixes #22217 .
2022-01-24 04:18:20 +09:00
Yu Watanabe
97fa338dce
sd-dhcp-client,sd-dhcp-client-server: set chaddr in dhcp_message_init()
...
And also set chaddr and hlen for packets on non-Ethernet interfaces,
except for InfiniBand.
2022-01-24 04:18:20 +09:00
Yu Watanabe
a6508f37c9
sd-dhcp-client: fix RFC number
2022-01-24 04:18:20 +09:00
Yu Watanabe
2cb66bbdfb
sd-dhcp-server: change the type of the client ID data
2022-01-24 04:18:20 +09:00
Yu Watanabe
255d493324
sd-dhcp-server: use free_and_replace() at one more place
2022-01-24 04:18:20 +09:00
Yu Watanabe
4f9dcf3dc5
sd-dhcp-server: shorten code a bit
2022-01-24 04:18:20 +09:00
Yu Watanabe
f4759ae051
sd-dhcp-server: drop unnecessary buffer duplication
...
The block try to find and remove the existing static lease which matches
the provided client ID, and the provided client ID will not be stored
anywhere. Hence, it is not necessary to duplicate it.
2022-01-24 04:16:41 +09:00
Yu Watanabe
95c514e9a5
test: add testcase for broken NTP server option
...
For issue #22099 .
2022-01-13 20:21:40 +09:00
Yu Watanabe
37408dd264
test: voidify test functions
...
This also drops unnecessary arguments, and unbreak several lines.
2022-01-13 20:20:48 +09:00
Yu Watanabe
16de849fd8
sd-dhcp6-client: expose client_parse_message()
...
To introduce tests for the function in later commits.
2022-01-13 20:20:19 +09:00
Yu Watanabe
0ac9daa4a1
sd-dhcp6-client: ignore broken non-critical options
...
The commit b89a3758e9 made the validity
check of the received message stricter. E.g. if the client received a
message with broken NTP server option, then the entire message is
dropped.
This relaxes the check. If some non-critical options are broken, then
ignore the options, but the message itself is still accepted.
Fixes #22099 .
2022-01-13 20:20:19 +09:00
Jan Janssen
bbec46c817
meson: Use files() for fuzzers
...
Not having to provide the full path in the source tree is much
nicer and the produced lists can also be used anywhere in the source
tree.
2022-01-11 14:15:54 +01:00
Jan Janssen
e1eeebbb11
meson: Use files() for tests
...
Not having to provide the full path in the source tree is much
nicer and the produced lists can also be used anywhere in the source
tree.
2022-01-11 14:15:54 +01:00
Yu Watanabe
b9f27a0567
sd-radv: do not use goto for non-error-handling cases
...
Follow-up for 059d7b6eae .
The comment https://github.com/systemd/systemd/pull/21814#discussion_r771842132
suggests to introduce new helper, but it is used only one place.
Let's not add such, but simply replace the goto with a flag.
2021-12-19 12:23:14 +00:00
Yu Watanabe
897f720602
sd-dhcp-client: add log message when a message is received
2021-12-18 10:09:07 +09:00
Yu Watanabe
059d7b6eae
sd-radv: send RA when prefix is updated
2021-12-18 10:09:07 +09:00
Zbigniew Jędrzejewski-Szmek
03f7ddf0bf
meson: stop building out convenience libraries by default
...
The meson default for static_library() are:
build_by_default=true, install=false. We never interact with the
static libraries, and we only care about them as a stepping-stone towards
the installable executables or libraries. Thus let's only build them if
they are a dependency of something else we are building.
While at it, let's drop install:false, since this appears to be the default.
This change would have fixed the issue with lib_import_common failing
to build too: we wouldn't attempt to build it.
In practice this changes very little, because we generally only declare static
libraries where there's something in the default target that will make use of
them. But it seems to be a better pattern to set build_by_default to false.
2021-12-16 11:01:08 +01:00
Yu Watanabe
ab8a8a4e77
libsystemd-network: ignore -ENETDOWN or friends in recv()
...
And this makes most errors in io events ignored.
2021-12-09 09:10:51 +01:00
Zbigniew Jędrzejewski-Szmek
874e525de4
test-dhcp-option: inline iterator variable declarations
2021-12-08 10:13:50 +01:00
Zbigniew Jędrzejewski-Szmek
74e2e54896
test-dhcp-option: rename variable to avoid global/local name conflict
...
CodeQL was complaining that the local variable obscurs the global
one. It is indeed a bit confusing when reading this… Let's rename
the variable to avoid confusing the reader.
2021-12-08 10:13:44 +01:00
Yu Watanabe
990d0aa980
dhcp: fix assertion failure
...
Fixes #21671 .
2021-12-08 08:52:33 +09:00
Yu Watanabe
dbdcaca3ab
sd-dhcp-client: support 6rd option
2021-12-07 20:32:02 +09:00
Yu Watanabe
d262928879
dhcp6: drop unnecessary space
2021-12-06 19:15:41 +09:00
Yu Watanabe
8add30a03c
tree-wide: use ERRNO_IS_TRANSIENT()
2021-11-30 23:06:43 +09:00
Yu Watanabe
97e80ee4a8
sd-dhcp6-client: fix error handling
2021-11-30 22:37:21 +09:00
Zbigniew Jędrzejewski-Szmek
8e560cd090
Merge pull request #21532 from yuwata/network-json-more
...
network: add more json entries
2021-11-29 21:26:56 +01:00
Nacho Barrientos
081f44859a
Byte order to host before using the lifetime
...
I've seen this in `NetworkManager-1.34.0-0.3.el8.x86_64` (latest in CentOS
Stream 8 at the time of writing this message) which does not use the latest
Systemd but probably the code base is the same (see
https://github.com/NetworkManager/NetworkManager/commit/51f93e00a23fbd09f5ad96da6290bf4ca737d46a ).
Before the patch:
```
libsystemd: eth0: DHCPv6 client: T1 expires in 34y 3w 6d 45min 31s
libsystemd: eth0: DHCPv6 client: T2 expires in 54y 5month 3w 3d 23h 20min 35s
```
After the patch:
```
libsystemd: eth0: DHCPv6 client: T1 expires in 3d 7h 58min 3s
libsystemd: eth0: DHCPv6 client: T2 expires in 5d 2h 26min 50s
```
same box (x86_64 system) and same DHCPv6 server.
This regression has likely been introduced by 8a8955507a .
2021-11-30 03:05:02 +09:00
Yu Watanabe
5656ff9dd1
dhcp6: make sd_dhcp6_lease_get_dns() and friends accepts NULL
2021-11-26 20:20:05 +09:00
Yu Watanabe
ee5b48341e
dhcp: make sd_dhcp_lease_get_servers() accepts NULL
2021-11-26 20:20:05 +09:00
Zbigniew Jędrzejewski-Szmek
ed8ba68f3b
Merge pull request #21272 from yuwata/netif-util-split
...
netif-util: move several functions from network-util.c to netif-util.c
2021-11-09 10:01:07 +01:00
Yu Watanabe
b01895bf70
arp-util: drop redundant line
...
The client's IP address is already loaded to X.
(The comment of the dropped line is wrong, X instead of A.)
2021-11-09 09:32:09 +01:00
Yu Watanabe
043b193f6e
netif-util: rename net_get_name_persistent() -> net_get_persistent_name()
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
59aa622013
network: dhcp-server: introduce Router= setting to specify router address
...
Closes #21202 .
2021-11-03 03:15:00 +09:00
Yu Watanabe
aa5a0f959c
sd-dhcp6-client: simplify code a bit
...
Also this adds a note.
2021-11-01 23:13:08 +09:00
Yu Watanabe
0936c189c9
sd-dhcp6-client: do not implicitly cast to boolean
2021-11-01 23:13:08 +09:00
Yu Watanabe
e79b4b8534
sd-dhcp6-client: introduce dhcp6_lease_{get,set}_clientid()
2021-11-01 23:13:08 +09:00
Yu Watanabe
65457c17e6
sd-dhcp6-client: shorten code a bit
2021-11-01 23:13:08 +09:00
Yu Watanabe
4f81f0d241
sd-dhcp6-client: prefix variables which store results with "ret_"
2021-11-01 23:13:08 +09:00
Yu Watanabe
d3aa9d6a80
sd-dhcp6-client: update log messages
2021-11-01 23:13:08 +09:00
Yu Watanabe
7e6abd25f4
Merge pull request #21200 from yuwata/sd-dhcp6-client-server-address
...
sd-dhcp6-client: introduce sd_dhcp6_lease_get_server_address()
2021-11-01 21:04:48 +09:00
Yu Watanabe
3b73ebc08a
Merge pull request #21199 from yuwata/sd-dhcp6-client-trivial-cleanups
...
sd-dhcp6-client: trivial cleanups
2021-11-01 21:04:05 +09:00
Yu Watanabe
ef4edc1546
sd-dhcp6-client: introduce sd_dhcp6_lease_get_server_address()
2021-11-01 18:22:49 +09:00
Yu Watanabe
2c269a4e2a
sd-lldp-tx: drop unused and useless function
...
sd-lldp-tx does not call any callback function. So, the function is
mostly useless.
2021-11-01 08:57:17 +00:00
Yu Watanabe
7f402e5b7b
sd-dhcp6: drop unused functions
2021-11-01 08:56:42 +00:00
Yu Watanabe
01b4e90f32
sd-dhcp6-client: request IA_PD by default
...
For consistency with 0f5ef9b62a .
2021-11-01 10:02:50 +09:00