network: IPv6 Compliance: Router Advertisement Processing, Reachable Time [v6LC.2...
authorMatt Muggeridge <LiveFreeAndRoam@gmail.com>
Mon, 13 May 2024 21:50:51 +0000 (07:50 +1000)
committerGitHub <noreply@github.com>
Mon, 13 May 2024 21:50:51 +0000 (06:50 +0900)
Previously, RA option fields were being ignored when the Router Lifetime
value was zero. Remove this logic to be compliant with RFC4861.

Extract from: https://www.ietf.org/rfc/rfc4861.html#section-4.2, p.21,
first paragraph:

    The Router Lifetime applies only to
    the router's usefulness as a default router; it
    does not apply to information contained in other
    message fields or options.

This affected IPv6 Conformance test:
    v6LC.2.2.15: Router Advertisement Processing, Reachable Time.

Fixes #31842.

Co-authored-by: Matt Muggeridge <Matt.Muggeridge@hpe.com>
src/network/networkd-ndisc.c

index 92ff7c71f36e2e3dd0de325ff0a03a0a57812a27..b1451817bccdaa57563b71f2d423f2515db2116e 100644 (file)
@@ -913,11 +913,6 @@ static int ndisc_router_process_reachable_time(Link *link, sd_ndisc_router *rt)
         if (!link->network->ndisc_use_reachable_time)
                 return 0;
 
-        /* Ignore the reachable time field of the RA header if the lifetime is zero. */
-        r = sd_ndisc_router_get_lifetime(rt, NULL);
-        if (r <= 0)
-                return r;
-
         r = sd_ndisc_router_get_reachable_time(rt, &reachable_time);
         if (r < 0)
                 return log_link_warning_errno(link, r, "Failed to get reachable time from RA: %m");
@@ -951,11 +946,6 @@ static int ndisc_router_process_retransmission_time(Link *link, sd_ndisc_router
         if (!link->network->ndisc_use_retransmission_time)
                 return 0;
 
-        /* Ignore the retransmission time field of the RA header if the lifetime is zero. */
-        r = sd_ndisc_router_get_lifetime(rt, NULL);
-        if (r <= 0)
-                return r;
-
         r = sd_ndisc_router_get_retransmission_time(rt, &retrans_time);
         if (r < 0)
                 return log_link_warning_errno(link, r, "Failed to get retransmission time from RA: %m");
@@ -989,11 +979,6 @@ static int ndisc_router_process_hop_limit(Link *link, sd_ndisc_router *rt) {
         if (!link->network->ndisc_use_hop_limit)
                 return 0;
 
-        /* Ignore the hop limit field of the RA header if the lifetime is zero. */
-        r = sd_ndisc_router_get_lifetime(rt, NULL);
-        if (r <= 0)
-                return r;
-
         r = sd_ndisc_router_get_hop_limit(rt, &hop_limit);
         if (r < 0)
                 return log_link_warning_errno(link, r, "Failed to get hop limit from RA: %m");
@@ -1029,11 +1014,6 @@ static int ndisc_router_process_mtu(Link *link, sd_ndisc_router *rt) {
         if (!link->network->ndisc_use_mtu)
                 return 0;
 
-        /* Ignore the MTU option if the lifetime is zero. */
-        r = sd_ndisc_router_get_lifetime(rt, NULL);
-        if (r <= 0)
-                return r;
-
         r = sd_ndisc_router_get_mtu(rt, &mtu);
         if (r == -ENODATA)
                 return 0;
@@ -2459,7 +2439,6 @@ int ndisc_stop(Link *link) {
         return sd_ndisc_stop(link->ndisc);
 }
 
-
 void ndisc_flush(Link *link) {
         assert(link);