Lennart Poettering
bd1ae17833
io-util: split out "struct iovec" related calls into their own .c/.h files
...
This is preparation for #28891 , which adds a bunch more helpers around
"struct iovec", at which point this really deserves its own .c/.h file.
The idea is that we sooner or later can consider "struct iovec" as an
entirely generic mechanism to reference some binary blob, and is the
go-to type for this purpose whenever we need one.
2023-10-20 10:34:33 +02:00
Zbigniew Jędrzejewski-Szmek
a0fe45a93f
Merge pull request #29224 from keszybz/netdev-config-parsing
...
Use a helper to simplify parsing of ranges in netdev config and related changes
2023-09-22 14:29:47 +02:00
Yu Watanabe
eca280c8c0
sd-radv: make sd_radv always take timespan in usec
2023-09-21 04:01:14 +09:00
Yu Watanabe
ca515c961b
libsystemd-network: introduce several helper functions to handle time values
...
These will be used in later commits.
2023-09-20 05:04:03 +09:00
Zbigniew Jędrzejewski-Szmek
f31fa08057
sd-network: modernize log error messages
...
SYNTHETIC_ERRNO() is used where appropriate.
Splits in message format strings are removed, so that it's easier to
read/grep/copy them.
2023-09-19 09:35:52 +02:00
Yu Watanabe
8b1bd20722
Merge pull request #29052 from yuwata/icmp6-util-cleanups
...
icmp6-util: several cleanups and fixlets
2023-09-05 00:15:23 +09:00
Susant Sahani
6e8f5e4c1f
network: ndisc - Allow to parse PREF64 prefix
2023-09-04 23:41:02 +09:00
Susant Sahani
6a6d27bc5b
network: sd-radv - Allow to configure Mobile IPv6 Home Agent
2023-09-04 23:40:40 +09:00
Yu Watanabe
4961f56646
icmp6-util: make icmp6_receive() accept the null source address
...
Fixes #29050 .
2023-09-04 21:54:43 +09:00
Yu Watanabe
4674f407b2
sd-ndisc,sd-radv: fix use of uninitialized value
...
When icmp6_receive() fails, then the source address is not initialized yet.
2023-09-04 19:31:40 +09:00
Susant Sahani
1a6b1214af
sd-radv: fix memory leak
2023-08-28 14:07:16 +01:00
Susant Sahani
1925f829ab
network: sd-radv - Introduce pref64 support (RFC8781)
...
Implements: https://datatracker.ietf.org/doc/html/rfc8781
```
[IPv6PREF64Prefix]
Prefix=2003:da8:1:0::/64
ValidLifetimeSec=30m
Frame 16: 126 bytes on wire (1008 bits), 126 bytes captured (1008 bits) on interface veth99, id 0
Ethernet II, Src: 06:c7:41:95:1d:7f (06:c7:41:95:1d:7f), Dst: IPv6mcast_01 (33:33:00:00:00:01)
Internet Protocol Version 6, Src: fe80::4c7:41ff:fe95:1d7f, Dst: ff02::1
Internet Control Message Protocol v6
Type: Router Advertisement (134)
Code: 0
Checksum: 0x0ca0 [correct]
[Checksum Status: Good]
Cur hop limit: 0
Flags: 0x00, Prf (Default Router Preference): Medium
Router lifetime (s): 1800
Reachable time (ms): 0
Retrans timer (ms): 0
ICMPv6 Option (Source link-layer address : 06:c7:41:95:1d:7f)
ICMPv6 Option (Prefix information : 2002:da8:1::/64)
ICMPv6 Option (PREF64 Option)
Type: PREF64 Option (38)
Length: 2 (16 bytes)
0000 0111 0000 1... = Scaled Lifetime: 225
.... .... .... .001 = PLC (Prefix Length Code): 64 bits prefix length (0x1)
Prefix: 64:ff9b::
```
2023-08-25 15:13:06 +02:00
Susant Sahani
fdc4c67c2a
network/radv: allow to configure the time between retransmitted Neighbor Solicitation ( #28888 )
2023-08-23 12:37:44 +09:00
David Tardon
9aad490e53
tree-wide: use LIST_CLEAR()
2023-08-17 09:48:17 +02:00
Zbigniew Jędrzejewski-Szmek
1f2db2e315
libsystemd-network: use _NEG_ macros to reduce indentation
...
No functional change intended.
2023-08-16 12:52:56 +02:00
Zbigniew Jędrzejewski-Szmek
254d1313ae
tree-wide: use -EBADF for fd initialization
...
-1 was used everywhere, but -EBADF or -EBADFD started being used in various
places. Let's make things consistent in the new style.
Note that there are two candidates:
EBADF 9 Bad file descriptor
EBADFD 77 File descriptor in bad state
Since we're initializating the fd, we're just assigning a value that means
"no fd yet", so it's just a bad file descriptor, and the first errno fits
better. If instead we had a valid file descriptor that became invalid because
of some operation or state change, the other errno would fit better.
In some places, initialization is dropped if unnecessary.
2022-12-19 15:00:57 +01:00
Yu Watanabe
abb977a61a
sd-radv: mention that failures in sending RA are ignored
2022-10-11 16:22:35 +09:00
David Tardon
995340074e
tree-wide: use ASSERT_PTR more
2022-09-13 08:13:27 +02:00
Zbigniew Jędrzejewski-Szmek
c71384a9ee
basic/in-addr-util: add IN_ADDR_PREFIX_TO_STRING
2022-06-06 09:52:52 +02:00
Zbigniew Jędrzejewski-Szmek
dd6d433a4f
libsystemd-network: minor simplification
2022-06-06 09:52:52 +02:00
Zbigniew Jędrzejewski-Szmek
84dbb3fd83
basic/in-addr-util: add IN_ADDR_TO_STRING
...
Since we don't need the error value, and the buffer is allocated with a fixed
size, the whole logic provided by in_addr_to_string() becomes unnecessary, so
it's enough to wrap inet_ntop() directly.
inet_ntop() can only fail with ENOSPC. But we specify a buffer that is supposed
to be large enough, so this should never fail. A bunch of tests of this are added.
This allows all the wrappers like strna(), strnull(), strempty() to be dropped.
The guard of 'if (DEBUG_LOGGING)' can be dropped from around log_debug(),
because log_debug() implements the check outside of the function call. But
log_link_debug() does not, so it we need it to avoid unnecessary evaluation of
the formatting.
2022-06-06 09:52:52 +02: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
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
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
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
059d7b6eae
sd-radv: send RA when prefix is updated
2021-12-18 10:09:07 +09: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
Yu Watanabe
17347053cf
libsystemd-network: drop _public_ attribute
...
No function in libsystemd-network is exposed yet.
2021-10-29 22:13:23 +09:00
Yu Watanabe
41521417ab
sd-radv: fix implicit conversion to boolean
2021-10-29 22:10:43 +09:00
Yu Watanabe
d951507d5d
sd-radv: shorten the default lifetime for prefix/route prefix
...
See draft-ietf-6man-slaac-renum-02 section 4.1.1.
2021-10-27 23:58:35 +09:00
Yu Watanabe
95e104e049
sd-radv: make prefix/route prefix lifetime can be specified with independently with valid_until
...
Previously, valid_until (or preferred_until for preferred lifetime) was
calculated from lifetime. So, when an upstream interface acquire a
dynamic prefix (e.g. through DHCPv6-PD) with long lifetime, then sd-radv
advertise the same lifetime. It may not be desired for some situations.
2021-10-27 23:58:28 +09:00
Yu Watanabe
eef5ebec97
Merge pull request #21143 from yuwata/sd-radv-router-lifetime
...
sd-radv: several cleanups for router lifetime
2021-10-27 22:14:35 +09:00
Yu Watanabe
804775577d
sd-radv: update how to calculate interval of sending advertisements
2021-10-27 19:27:23 +09:00
Yu Watanabe
0945767012
sd-radv: router lifetime must be 0 or between 4 seconds and 9000 seconds
...
See RFC 4861 section 6.2.1.
2021-10-27 19:27:07 +09:00
Yu Watanabe
72db0a714b
sd-radv: introduce RADV_DEFAULT_ROUTER_LIFETIME_USEC
2021-10-27 19:05:55 +09:00
Yu Watanabe
03ec10fdf4
sd-radv: make several constants not exposed
2021-10-27 19:03:35 +09:00
Yu Watanabe
d6fc0d674f
sd-radv: drop SD_ prefix for unexposed constants
2021-10-27 19:03:31 +09:00
Yu Watanabe
68cbac5bd4
sd-radv: use IPv6 specific functions
2021-10-27 16:41:04 +09:00
Yu Watanabe
acbb5500e2
sd-radv: use assert_return()
2021-10-27 16:41:04 +09:00
Yu Watanabe
7003b11487
sd-radv: make sd_radv_set_router_lifetime() take usec_t (uint64_t)
2021-10-27 16:13:09 +09:00
Yu Watanabe
7ebb14313f
sd-radv: rename sd_radv_prefix_set_route_prefix() -> sd_radv_route_prefix_set_prefix()
2021-10-12 03:10:30 +09:00
Yu Watanabe
5977b71f28
libsystemd-network: make sd_dhcp_client_get_ifname() or friends return negative errno on error
2021-09-29 03:37:09 +09:00
Yu Watanabe
eb2f750242
libsystemd-network: disable event sources before unref them
...
Fixes #20825 .
2021-09-24 17:26:41 +09:00
Zbigniew Jędrzejewski-Szmek
5291f26d4a
tree-wide: add FORMAT_TIMESPAN()
2021-07-09 11:03:36 +02:00
Yu Watanabe
353887831b
libsystemd-network: make log_dhcp_client() or friends include interface name
2021-03-04 05:51:28 +09:00
Yu Watanabe
61a9fa8f0c
libsystemd-network: introduce sd_xxx_{set,get}_ifname()
2021-03-04 05:24:54 +09:00
Yu Watanabe
c633628daf
tree-wide: constify variables if possible
2021-02-18 03:48:07 +09:00