Commit Graph

1508 Commits

Author SHA1 Message Date
Matthijs van Duin
b0221bb6a4 Fix placement of TTL TLV in LLDP transmit
The LLDP spec (IEEE 802.1AB) requires the three mandatory TLVs (Chassis
ID, Port ID, and TTL) to be the first three TLVs in the packet, in that
specific order, whereas systemd put the TTL near the end of the packet.

This violation caused the ethernet switch in our office to discard these
packets as malformed, and Wireshark's packet parser also chokes on them.
2022-05-05 01:19:02 +09:00
Yu Watanabe
87bd4b79e6 sd-lldp: use memcpy_safe() as the buffer size may be zero 2022-05-04 16:05:04 +09:00
Yu Watanabe
9a44966e63 sd-ndisc: drop unused function 2022-05-04 16:03:57 +09:00
Yu Watanabe
4e88a46bfe libsystemd-network: refuse too large raw_size
Closes #23258.
2022-05-04 15:46:19 +09:00
Zbigniew Jędrzejewski-Szmek
6f1b4574b4 libsystemd-network: add assert about packet length
We reject too-short packets in client_receive_message_raw(), so
the packets that dhcp_packet_verify_headers() gets are of sufficient size.
But let's add an assert to clarify this for the reader.

Closes #23223.
2022-04-29 15:56:53 +02:00
Zbigniew Jędrzejewski-Szmek
9a94baa6c7 libsystemd-network: do not split messages in half
This makes grepping for the messages unnecessarily painful.
2022-04-29 15:56:53 +02:00
Yu Watanabe
239adf0384 sd-ipv4acd: actually drop the arp packet from one of the host interface
Fixes a bug in 7f77917c0e.

Fixes #23001.
2022-04-07 15:02:21 +09:00
Yu Watanabe
822883b3e7 sd-dhcp6-client: request several options
Even though these options are not currently used by sd-dhcp6-client,
RFC 8415 states these options MUST be requested.
2022-04-04 01:22:02 +09:00
Yu Watanabe
612caa2626 network: dhcp6: request DNS servers or friends only when they will be used 2022-04-03 19:55:25 +09:00
Yu Watanabe
f697ab358a dhcp: make option names singular 2022-04-03 19:50:02 +09:00
Yu Watanabe
0e0c4daea6 sd-dhcp6-client: sort requesting options 2022-04-03 19:23:03 +09:00
Yu Watanabe
2f53b311c3 sd-dhcp6-client: rename req_opts_len -> n_req_opts
As 'len' is confusing and we may misunderstand it as the size of
the buffer instead of the number of options.
2022-04-03 19:23:03 +09:00
Yu Watanabe
798931160e tree-wide: add a space after if, switch, for, and while 2022-04-01 22:48:42 +09:00
Lennart Poettering
ba4e0427e9 time-util: assume CLOCK_BOOTTIME always exists
Let's raise our supported baseline a bit: CLOCK_BOOTTIME started to work
with timerfd in kernel 3.15 (i.e. back in 2014), let's require support
for it now.

This will raise our baseline only modestly from 3.13 → 3.15.
2022-03-28 16:55:41 +02:00
Zbigniew Jędrzejewski-Szmek
8e1fc5d939 fuzz: rename fuzz-dhcp-server-relay-message to fuzz-dhcp-server-relay
We can only relay messages, so we can make the name shorter without
losing informational value. This makes meson test output look better.
2022-03-21 11:43:47 +01:00
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
Yu Watanabe
80a226b26b list: make LIST_FOREACH() and LIST_FOREACH_BACKWARDS() safer 2022-03-19 08:10:29 +09:00
Yu Watanabe
03677889f0 list: declare iterator of LIST_FOREACH() in the loop 2022-03-19 08:10:29 +09:00
Yu Watanabe
faaf3d66ce sd-radv: fix indentation 2022-03-17 14:34:58 +09:00
Yu Watanabe
56aa51432e sd-radv: do not use iterater outside of the loop 2022-03-17 14:34:58 +09:00
Yu Watanabe
95931532aa sd-radv: voidify sd_radv_remove_prefix()
If the prefix is only referenced by sd_radv, then the returned pointer
is already freed.

networkd does not uses the returned value. Let's voidify the function.
2022-03-17 14:34:58 +09:00
Jan Janssen
68da8adf54 test: Use TEST macros in more places 2022-03-16 14:50:12 +01:00
Yu Watanabe
6278e42878 network: dhcp: rename NextServer= and Filename= settings
And make the settings configures DHCP option 66 and 67.

Follow-ups for #22615.
Fixes #22661.
2022-03-11 10:14:57 +09:00
Yu Watanabe
71a9e3a304 dhcp: list all known message type 2022-03-10 14:47:28 +09:00
Yu Watanabe
3d80c57b7e sd-dhcp6-client: rename timezone options
To make them follow corresponding DHCPv4 options.
2022-03-10 14:47:28 +09:00
Yu Watanabe
3cb62efef8 dhcp: list all known DHCP options 2022-03-10 14:47:28 +09:00
Yu Watanabe
1aaab93621 network: refuse string which contains non-safe or non-ascii characters for Filename=
The string will be used when the client load additional config file to
boot, and it must be a valid path or url. Hence, let's refuse non-safe or
non-characters.
2022-03-10 14:43:48 +09:00
Zbigniew Jędrzejewski-Szmek
2f492a739c meson: move files' closing brace to separate line 2022-03-03 12:14:13 +01:00
Zbigniew Jędrzejewski-Szmek
f1b98127ff meson: do not use split() in file lists
The approach to use '''…'''.split() instead of a list of strings was initially
used when converting from automake because it allowed identical blocks of lines
to be used for both, making the conversion easier.

But over the years we have been using normal lists more and more, especially
when there were just a few filenames listed. This converts the rest.

No functional change.
2022-03-02 14:49:32 +01:00
Yu Watanabe
d5e5cd5c34 sd-dhcp-server: add support to send next server and filename option for PXE boot systems 2022-02-25 02:32:58 +09:00
Zbigniew Jędrzejewski-Szmek
f2acaf39c1 Merge pull request #22600 from poettering/timestamp_is_set-more
make more use of timestamp_is_set()
2022-02-23 08:59:49 +01:00
Lennart Poettering
0da36375eb tree-wide: use timestamp_is_set() more 2022-02-22 22:49:40 +01:00
Yu Watanabe
8306912b0e test: fix memory and fd leak in test-dhcp6-client
Fixes an issue reported in #22576.
2022-02-22 21:50:43 +09:00
Yu Watanabe
2e37084fc9 test: drop timeout handlers
Fixes file descriptor leak reported in #22576.
2022-02-22 21:50:32 +09:00
Yu Watanabe
9e0cb8b61f sd-dhcp-server: do not offer server address
The server address may be in the pool.
2022-02-17 16:45:10 +09:00
Yu Watanabe
37598ac6eb sd-dhcp6-client: use mempcpy() or mempcpy_safe() 2022-02-16 16:23:58 +09:00
Yu Watanabe
c9333c236f dhcp-identifier: use offsetof()
Also use appropriate place to store UUID.
2022-02-16 16:23:54 +09:00
Yu Watanabe
fc62d1c54f sd-dhcp6-client: add comment about ia_na and ia_pd 2022-02-15 23:36:45 +09:00
Yu Watanabe
119c00c1fa test-dhcp6-client: add test for rapid commit 2022-02-14 15:09:37 +09:00
Yu Watanabe
1f28019113 test-dhcp6-client: cleanups
This does many cleanups. Most prominently,
- check the sents packet more strictly,
- make the packets used in the test more readable,
- unify callbacks.
2022-02-14 15:09:28 +09:00
Yu Watanabe
bccb8fc61a fuzz-dhcp6-client: add prefix hint and vendor option to sent message 2022-02-14 15:02:33 +09:00
Yu Watanabe
7b53d3ead3 fuzz-dhcp6-client: merge with fuzz-dhcp6-client-send 2022-02-14 15:02:33 +09:00
Yu Watanabe
013c6904fa fuzz-dhcp6-client: test multiple states
Then, now all three paths client_process_information(),
client_process_reply(), and client_process_advertise_or_rapid_commit_reply()
in client_receive_message() are fuzzed.
2022-02-14 15:02:33 +09:00
Yu Watanabe
bbe3f62a16 sd-dhcp6-client: append extra options before elapsed time option
The value of elapsed time option is determined in runtime and not
deterministic. It is hard to test the sent packets if it is located
in the intermidiate of the packet.
2022-02-14 15:02:33 +09:00
Yu Watanabe
e261d31557 sd-dhcp6-client: logs invalid NTP option
Returning negative errno triggers to produce debugging log in
dhcp6_lease_parse_message().
2022-02-14 15:02:33 +09:00
Yu Watanabe
3f09d563f4 sd-dhcp6-client: split dhcp6-internal.h into two
Also, this moves string tables to dhcp6-protocol.c.
2022-02-14 15:02:33 +09:00
Yu Watanabe
dd73db7850 sd-dhcp6-client: reset Information Refresh Time on stop 2022-02-14 15:02:30 +09:00
Yu Watanabe
e1774086a7 sd-dhcp6-client: add log about Information Refresh Time
And store IRT only when the client is running in information
requesting mode.
2022-02-14 15:01:02 +09:00
Yu Watanabe
9c9fee8002 sd-dhcp6-client: use memcmp_nn() at one more place 2022-02-14 15:01:02 +09:00
Yu Watanabe
ac680f766d dhcp-identifier: generate static and constant DUID-EN when the client is running in test mode
Follow-up for 9216fddc5a.
2022-02-14 15:00:59 +09:00