summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-radv.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-1/+1
| | | | | | | | | | | | | | | | -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.
* sd-radv: mention that failures in sending RA are ignoredYu Watanabe2022-10-111-4/+4
|
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-131-4/+2
|
* basic/in-addr-util: add IN_ADDR_PREFIX_TO_STRINGZbigniew Jędrzejewski-Szmek2022-06-061-17/+10
|
* libsystemd-network: minor simplificationZbigniew Jędrzejewski-Szmek2022-06-061-4/+2
|
* basic/in-addr-util: add IN_ADDR_TO_STRINGZbigniew Jędrzejewski-Szmek2022-06-061-6/+5
| | | | | | | | | | | | | | | 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.
* time-util: assume CLOCK_BOOTTIME always existsLennart Poettering2022-03-281-4/+4
| | | | | | | | 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.
* strv: make iterator in STRV_FOREACH() declaread in the loopYu Watanabe2022-03-191-1/+0
| | | | This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
* list: declare iterator of LIST_FOREACH() in the loopYu Watanabe2022-03-191-6/+2
|
* sd-radv: fix indentationYu Watanabe2022-03-171-12/+27
|
* sd-radv: do not use iterater outside of the loopYu Watanabe2022-03-171-16/+10
|
* sd-radv: voidify sd_radv_remove_prefix()Yu Watanabe2022-03-171-11/+13
| | | | | | | 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.
* sd-radv: do not use goto for non-error-handling casesYu Watanabe2021-12-191-45/+61
| | | | | | | | Follow-up for 059d7b6eae827e73c73633bcc40fe74f3696f3f6. 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.
* sd-radv: send RA when prefix is updatedYu Watanabe2021-12-181-22/+28
|
* libsystemd-network: ignore -ENETDOWN or friends in recv()Yu Watanabe2021-12-091-6/+11
| | | | And this makes most errors in io events ignored.
* libsystemd-network: drop _public_ attributeYu Watanabe2021-10-291-30/+30
| | | | No function in libsystemd-network is exposed yet.
* sd-radv: fix implicit conversion to booleanYu Watanabe2021-10-291-1/+1
|
* sd-radv: shorten the default lifetime for prefix/route prefixYu Watanabe2021-10-271-3/+3
| | | | See draft-ietf-6man-slaac-renum-02 section 4.1.1.
* sd-radv: make prefix/route prefix lifetime can be specified with ↵Yu Watanabe2021-10-271-82/+87
| | | | | | | | | 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.
* Merge pull request #21143 from yuwata/sd-radv-router-lifetimeYu Watanabe2021-10-271-49/+61
|\ | | | | sd-radv: several cleanups for router lifetime
| * sd-radv: update how to calculate interval of sending advertisementsYu Watanabe2021-10-271-21/+20
| |
| * sd-radv: router lifetime must be 0 or between 4 seconds and 9000 secondsYu Watanabe2021-10-271-11/+13
| | | | | | | | See RFC 4861 section 6.2.1.
| * sd-radv: introduce RADV_DEFAULT_ROUTER_LIFETIME_USECYu Watanabe2021-10-271-0/+1
| |
| * sd-radv: make several constants not exposedYu Watanabe2021-10-271-3/+3
| |
| * sd-radv: drop SD_ prefix for unexposed constantsYu Watanabe2021-10-271-17/+17
| |
| * sd-radv: make sd_radv_set_router_lifetime() take usec_t (uint64_t)Yu Watanabe2021-10-271-16/+26
| |
* | sd-radv: use IPv6 specific functionsYu Watanabe2021-10-271-17/+9
| |
* | sd-radv: use assert_return()Yu Watanabe2021-10-271-6/+2
|/
* sd-radv: rename sd_radv_prefix_set_route_prefix() -> ↵Yu Watanabe2021-10-121-1/+1
| | | | sd_radv_route_prefix_set_prefix()
* libsystemd-network: make sd_dhcp_client_get_ifname() or friends return ↵Yu Watanabe2021-09-291-4/+12
| | | | negative errno on error
* libsystemd-network: disable event sources before unref themYu Watanabe2021-09-241-4/+2
| | | | Fixes #20825.
* tree-wide: add FORMAT_TIMESPAN()Zbigniew Jędrzejewski-Szmek2021-07-091-13/+4
|
* libsystemd-network: make log_dhcp_client() or friends include interface nameYu Watanabe2021-03-041-30/+28
|
* libsystemd-network: introduce sd_xxx_{set,get}_ifname()Yu Watanabe2021-03-041-0/+19
|
* tree-wide: constify variables if possibleYu Watanabe2021-02-181-10/+10
|
* network: use in_addr_prefix_to_string()Yu Watanabe2021-02-181-34/+32
|
* tree-wide: use in_addr_is_set() or friendsYu Watanabe2021-02-181-5/+3
|
* sd-radv: refuse to set preference except medium when router lifetime is zeroYu Watanabe2020-11-101-3/+6
|
* sd-radv: router lifetime is uint16_tYu Watanabe2020-11-101-3/+3
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* libsystemd-network: do not request each daemon exist in sd_xxx_stop()Yu Watanabe2020-10-151-1/+2
|
* sd-radv: fix indentationLennart Poettering2020-09-231-10/+10
| | | | Fix-up for 97efde65d81b1501a3737f408f1234c6c25da61c
* various: remove assignments of unread variablesZbigniew Jędrzejewski-Szmek2020-09-221-1/+0
|
* network: radv: Send RA on newly-added dynamic prefixMichael Marley2020-07-271-0/+18
| | | | | | | | | | | | | | When a prefix is delegated to an interface that is already sending RAs, send an RA immediately to inform clients of the new prefix. This allows them to start using it immediately instead of waiting up to nearly 10 minutes (depending on when the last timed RA was sent). This type of situation might occur if, for example, an outage of the WAN connection caused the addresses and prefixes to be lost and later regained after service was restored. The condition for the number of RAs sent being above 0 simultaneously ensures that RADV is already running and that this code doesn't send any RAs before the timed RAs have started when the interface first comes up.
* radv: introduce sd_radv_is_running()Yu Watanabe2020-07-201-0/+6
|
* Revert "network: Don't send RA with zero router lifetime when restarting radv"Yu Watanabe2020-07-071-11/+7
| | | | This reverts commit d469cea3bde53bc39317c8b433c825bb4790cbe5.
* network: Don't send RA with zero router lifetime when restarting radvMichael Marley2020-07-071-7/+11
| | | | | | | | | | | | | | While investigating https://github.com/systemd/systemd/issues/16356, I discovered that networkd stops the radv service before adding or updating prefixes and then starts it again. This causes networkd to send an RA with a router lifetime of zero, causing the routes to flap on systems receiving the RA for a fraction of a second before radv is started again and proper RAs are sent. That has the potential to cause issues with latency-sensitive traffic like gaming or VoIP. This patch adds a boolean argument to the sd_radv_stop() function to control this behavior. The zero lifetime RA is still sent whenever radv is actually being stopped, but when it is being restarted for a prefix update (from networkd-dhcp6.c), the final RA is no longer sent to avoid the route flapping.
* dhcp6, radv: only accept valid ifindexYu Watanabe2020-07-021-1/+1
|
* network: 'cur' variable cannot be null, so simplify codeBenjamin Robin2020-05-131-4/+2
|
* network: radv introduce sd_radv_prefix_get_prefixSusant Sahani2020-03-011-0/+12
|