Skip to content

Commit 986e182

Browse files
committed
network: do not try to set invalid value for IPv6 hop limit
1 parent 39713b0 commit 986e182

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

man/systemd.network.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -864,9 +864,9 @@ Table=1234</programlisting></para>
864864
<varlistentry>
865865
<term><varname>IPv6HopLimit=</varname></term>
866866
<listitem>
867-
<para>Configures IPv6 Hop Limit. For each router that forwards the packet, the hop limit is
868-
decremented by 1. When the hop limit field reaches zero, the packet is discarded. When unset,
869-
the kernel's default will be used.</para>
867+
<para>Configures IPv6 Hop Limit. Takes an integer in the range 1…255. For each router that
868+
forwards the packet, the hop limit is decremented by 1. When the hop limit field reaches zero, the
869+
packet is discarded. When unset, the kernel's default will be used.</para>
870870

871871
<xi:include href="version-info.xml" xpointer="v228"/>
872872
</listitem>

src/network/networkd-network-gperf.gperf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Network.IPv6PrivacyExtensions, config_parse_ipv6_privacy_extension
130130
Network.IPv6AcceptRA, config_parse_tristate, 0, offsetof(Network, ipv6_accept_ra)
131131
Network.IPv6AcceptRouterAdvertisements, config_parse_tristate, 0, offsetof(Network, ipv6_accept_ra)
132132
Network.IPv6DuplicateAddressDetection, config_parse_int, 0, offsetof(Network, ipv6_dad_transmits)
133-
Network.IPv6HopLimit, config_parse_int, 0, offsetof(Network, ipv6_hop_limit)
133+
Network.IPv6HopLimit, config_parse_uint8, 0, offsetof(Network, ipv6_hop_limit)
134134
Network.IPv6ProxyNDP, config_parse_tristate, 0, offsetof(Network, ipv6_proxy_ndp)
135135
Network.IPv6MTUBytes, config_parse_mtu, AF_INET6, offsetof(Network, ipv6_mtu)
136136
Network.IPv4AcceptLocal, config_parse_tristate, 0, offsetof(Network, ipv4_accept_local)

src/network/networkd-network.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
466466
.ipv4_route_localnet = -1,
467467
.ipv6_privacy_extensions = _IPV6_PRIVACY_EXTENSIONS_INVALID,
468468
.ipv6_dad_transmits = -1,
469-
.ipv6_hop_limit = -1,
470469
.ipv6_proxy_ndp = -1,
471470
.proxy_arp = -1,
472471
.ipv4_rp_filter = _IP_REVERSE_PATH_FILTER_INVALID,

src/network/networkd-network.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ struct Network {
323323
int ipv4_accept_local;
324324
int ipv4_route_localnet;
325325
int ipv6_dad_transmits;
326-
int ipv6_hop_limit;
326+
uint8_t ipv6_hop_limit;
327327
int proxy_arp;
328328
uint32_t ipv6_mtu;
329329
IPv6PrivacyExtensions ipv6_privacy_extensions;

src/network/networkd-sysctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int link_set_ipv6_hop_limit(Link *link) {
178178
if (!link->network)
179179
return 0;
180180

181-
if (link->network->ipv6_hop_limit < 0)
181+
if (link->network->ipv6_hop_limit <= 0)
182182
return 0;
183183

184184
return sysctl_write_ip_property_int(AF_INET6, link->ifname, "hop_limit", link->network->ipv6_hop_limit);

0 commit comments

Comments
 (0)