From b26c345279b6232afe6bc5cf9eb9d1b8514ceba0 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Tue, 22 Aug 2023 17:16:56 +0530 Subject: [PATCH] network: radv - Allow to send hop limit --- man/systemd.network.xml | 8 ++++++++ src/network/networkd-network-gperf.gperf | 1 + src/network/networkd-network.h | 1 + src/network/networkd-radv.c | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/man/systemd.network.xml b/man/systemd.network.xml index fcf37a19b82..93830b5935b 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -3098,6 +3098,14 @@ Token=prefixstable:2002:da8:1:: for details. Defaults to medium. + + HopLimit= + + Configures hop limit. Takes an integer in the range 0…255. See also + IPv6HopLimit=. + + + UplinkInterface= Specifies the name or the index of the uplink interface, or one of the special diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index a364abf2b47..40e78c91b30 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -372,6 +372,7 @@ IPv6SendRA.RetransmitSec, config_parse_router_retransmit, IPv6SendRA.Managed, config_parse_bool, 0, offsetof(Network, router_managed) IPv6SendRA.OtherInformation, config_parse_bool, 0, offsetof(Network, router_other_information) IPv6SendRA.RouterPreference, config_parse_router_preference, 0, 0 +IPv6SendRA.HopLimit, config_parse_uint8, 0, offsetof(Network, router_hop_limit) IPv6SendRA.EmitDNS, config_parse_bool, 0, offsetof(Network, router_emit_dns) IPv6SendRA.DNS, config_parse_radv_dns, 0, 0 IPv6SendRA.EmitDomains, config_parse_bool, 0, offsetof(Network, router_emit_domains) diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index 75f1be442aa..cb8626f008e 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -228,6 +228,7 @@ struct Network { usec_t router_lifetime_usec; uint8_t router_preference; usec_t router_retransmit_usec; + uint8_t router_hop_limit; bool router_managed; bool router_other_information; bool router_emit_dns; diff --git a/src/network/networkd-radv.c b/src/network/networkd-radv.c index e6ef3974f28..1bf6fc99d97 100644 --- a/src/network/networkd-radv.c +++ b/src/network/networkd-radv.c @@ -480,6 +480,10 @@ static int radv_configure(Link *link) { if (r < 0) return r; + r = sd_radv_set_hop_limit(link->radv, link->network->router_hop_limit); + if (r < 0) + return r; + if (link->network->router_lifetime_usec > 0) { r = sd_radv_set_preference(link->radv, link->network->router_preference); if (r < 0)