diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-04-16 12:00:15 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-04-19 05:05:41 +0200 |
commit | 2a1e890943a19c21d60f6c0e7efbca8a93db8ff3 (patch) | |
tree | d1e0e61b6d3d66346f6570e1099c43d9584c163f /src/libsystemd-network/sd-radv.c | |
parent | sd-radv: expose sd_radv_send() (diff) | |
download | systemd-2a1e890943a19c21d60f6c0e7efbca8a93db8ff3.tar.xz systemd-2a1e890943a19c21d60f6c0e7efbca8a93db8ff3.zip |
sd-radv: reset timer on sending unsolicited RA
Addresses https://github.com/systemd/systemd/pull/32267#discussion_r1567078807.
Diffstat (limited to 'src/libsystemd-network/sd-radv.c')
-rw-r--r-- | src/libsystemd-network/sd-radv.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libsystemd-network/sd-radv.c b/src/libsystemd-network/sd-radv.c index 4fae865e95..cc8d144e6d 100644 --- a/src/libsystemd-network/sd-radv.c +++ b/src/libsystemd-network/sd-radv.c @@ -279,11 +279,13 @@ static int radv_process_packet(sd_radv *ra, ICMP6Packet *packet) { if (r < 0) return r; - struct in6_addr src = {}; + struct in6_addr src; r = sd_ndisc_router_solicit_get_sender_address(rs, &src); - if (r < 0 && r != -ENODATA) /* null address is allowed */ + if (r == -ENODATA) /* null address is allowed */ + return sd_radv_send(ra); /* When an unsolicited RA, we need to also update timer. */ + if (r < 0) return log_radv_errno(ra, r, "Failed to get sender address of RS, ignoring: %m"); - if (r >= 0 && in6_addr_equal(&src, &ra->ipv6ll)) + if (in6_addr_equal(&src, &ra->ipv6ll)) /* This should be definitely caused by a misconfiguration. If we send RA to ourself, the * kernel complains about that. Let's ignore the packet. */ return log_radv_errno(ra, SYNTHETIC_ERRNO(EADDRINUSE), "Received RS from the same interface, ignoring."); |