*prod*, while t2k17 is still on...
On Sat, Aug 12, 2017 at 06:26:44PM +0000, Florian Obser wrote:
>
> Stop supporting prefix lifetimes that decrement in real time.
> It complicates the code, it's off by default and RFC 4861 section
> 6.2.1 lists it as MAY.
> After this we can stop regenerating the RA packets everytime we send
> them.
>
> Also I'm not convinced that this has a use case. I think it
> comes from a fairy tale where renumbering is easy.
> Considering the two hour rule in RFC 4862 this might not actually
> work to begin with...
>
> OK?
>
> diff --git config.c config.c
> index 497fedbf562..62ce62c58d3 100644
> --- config.c
> +++ config.c
> @@ -212,14 +212,6 @@ getconfig(char *intface)
>
> /* prefix information */
>
> - /*
> - * This is an implementation specific parameter to consider
> - * link propagation delays and poorly synchronized clocks when
> - * checking consistency of advertised lifetimes.
> - */
> - MAYHAVE(val, "clockskew", 0);
> - tmp->clockskew = val;
> -
> tmp->pfxs = 0;
> for (i = -1; i < MAXPREFIX; i++) {
> struct prefix *pfx;
> @@ -278,14 +270,6 @@ getconfig(char *intface)
>
> pfx->validlifetime = (u_int32_t)val64;
>
> - makeentry(entbuf, sizeof(entbuf), i, "vltimedecr");
> - if (agetflag(entbuf)) {
> - struct timeval now;
> - gettimeofday(&now, 0);
> - pfx->vltimeexpire =
> - now.tv_sec + pfx->validlifetime;
> - }
> -
> makeentry(entbuf, sizeof(entbuf), i, "pltime");
> MAYHAVE(val64, entbuf, DEF_ADVPREFERREDLIFETIME);
> if (val64 < 0 || val64 > 0xffffffff)
> @@ -296,13 +280,6 @@ getconfig(char *intface)
>
> pfx->preflifetime = (u_int32_t)val64;
>
> - makeentry(entbuf, sizeof(entbuf), i, "pltimedecr");
> - if (agetflag(entbuf)) {
> - struct timeval now;
> - gettimeofday(&now, 0);
> - pfx->pltimeexpire =
> - now.tv_sec + pfx->preflifetime;
> - }
> }
> if (tmp->pfxs == 0 && !agetflag("noifprefix"))
> get_prefix(tmp);
> @@ -748,9 +725,6 @@ make_packet(struct rainfo *rainfo)
> }
>
> TAILQ_FOREACH(pfx, &rainfo->prefixes, entry) {
> - u_int32_t vltime, pltime;
> - struct timeval now;
> -
> ndopt_pi = (struct nd_opt_prefix_info *)buf;
> ndopt_pi->nd_opt_pi_type = ND_OPT_PREFIX_INFORMATION;
> ndopt_pi->nd_opt_pi_len = 4;
> @@ -762,27 +736,9 @@ make_packet(struct rainfo *rainfo)
> if (pfx->autoconfflg)
> ndopt_pi->nd_opt_pi_flags_reserved |=
> ND_OPT_PI_FLAG_AUTO;
> - if (pfx->vltimeexpire || pfx->pltimeexpire)
> - gettimeofday(&now, NULL);
> - if (pfx->vltimeexpire == 0)
> - vltime = pfx->validlifetime;
> - else
> - vltime = (u_int32_t)(pfx->vltimeexpire > now.tv_sec ?
> - pfx->vltimeexpire - now.tv_sec : 0);
> - if (pfx->pltimeexpire == 0)
> - pltime = pfx->preflifetime;
> - else
> - pltime = (u_int32_t)(pfx->pltimeexpire > now.tv_sec ?
> - pfx->pltimeexpire - now.tv_sec : 0);
> - if (vltime < pltime) {
> - /*
> - * this can happen if vltime is decremented but pltime
> - * is not.
> - */
> - pltime = vltime;
> - }
> - ndopt_pi->nd_opt_pi_valid_time = htonl(vltime);
> - ndopt_pi->nd_opt_pi_preferred_time = htonl(pltime);
> +
> + ndopt_pi->nd_opt_pi_valid_time = htonl(pfx->validlifetime);
> + ndopt_pi->nd_opt_pi_preferred_time = htonl(pfx->preflifetime);
> ndopt_pi->nd_opt_pi_reserved2 = 0;
> ndopt_pi->nd_opt_pi_prefix = pfx->prefix;
>
> diff --git dump.c dump.c
> index bccfad7a3fb..f4a7bd4b2cf 100644
> --- dump.c
> +++ dump.c
> @@ -113,7 +113,6 @@ rtadvd_dump(void)
> int first;
> struct timeval now, next;
> char *origin, *vltime, *pltime, *flags;
> - char *vltimexpire, *pltimexpire;
> char ctimebuf[26];
>
> gettimeofday(&now, NULL);
> @@ -164,9 +163,7 @@ rtadvd_dump(void)
> log_info(" ReachableTime: %d, RetransTimer: %d, "
> "CurHopLimit: %d", rai->reachabletime,
> rai->retranstimer, rai->hoplimit);
> - if (rai->clockskew)
> - log_info(" Clock skew: %ldsec",
> - rai->clockskew);
> +
> first = 1;
> TAILQ_FOREACH(pfx, &rai->prefixes, entry) {
> if (first) {
> @@ -186,40 +183,17 @@ rtadvd_dump(void)
> default:
> origin = "";
> }
> - if (pfx->vltimeexpire != 0) {
> - /* truncate to onwire value */
> - if (asprintf(&vltimexpire, "(decr,expire %u)",
> - (u_int32_t)(pfx->vltimeexpire > now.tv_sec ?
> - pfx->vltimeexpire - now.tv_sec : 0)) == -1)
> - vltimexpire = NULL;
> - } else
> - vltimexpire = NULL;
> -
> - if (pfx->pltimeexpire != 0) {
> - /* truncate to onwire value */
> - if (asprintf(&pltimexpire, "(decr,expire %u)",
> - (u_int32_t)(pfx->pltimeexpire > now.tv_sec ?
> - pfx->pltimeexpire - now.tv_sec : 0)) == -1)
> - pltimexpire = NULL;
> - } else
> - pltimexpire = NULL;
> -
> vltime = lifetime(pfx->validlifetime);
> pltime = lifetime(pfx->preflifetime);
> asprintf(&flags, "%s%s",
> pfx->onlinkflg ? "L" : "-",
> pfx->autoconfflg ? "A" : "-");
> - log_info(" %s/%d(%s, vltime: %s%s, "
> - "pltime: %s%s, flags: %s)",
> + log_info(" %s/%d(%s, vltime: %s, "
> + "pltime: %s, flags: %s)",
> inet_ntop(AF_INET6, &pfx->prefix, prefixbuf,
> sizeof(prefixbuf)), pfx->prefixlen, origin,
> - vltime, (vltimexpire)? vltimexpire : "",
> - pltime, (pltimexpire)? pltimexpire : "", flags);
> + vltime, pltime, flags);
>
> - free(vltimexpire);
> - vltimexpire = NULL;
> - free(pltimexpire);
> - pltimexpire = NULL;
> free(vltime);
> free(pltime);
> free(flags);
> diff --git rtadvd.c rtadvd.c
> index cabec6c5950..0af71fa2804 100644
> --- rtadvd.c
> +++ rtadvd.c
> @@ -832,11 +832,10 @@ static int
> prefix_check(struct nd_opt_prefix_info *pinfo,
> struct rainfo *rai, struct sockaddr_in6 *from)
> {
> - time_t preferred_time, valid_time;
> + uint32_t preferred_time, valid_time;
> struct prefix *pp;
> int inconsistent = 0;
> u_char ntopbuf[INET6_ADDRSTRLEN], prefixbuf[INET6_ADDRSTRLEN];
> - struct timeval now;
>
> #if 0 /* impossible */
> if (pinfo->nd_opt_pi_type != ND_OPT_PREFIX_INFORMATION)
> @@ -869,32 +868,7 @@ prefix_check(struct nd_opt_prefix_info *pinfo,
> }
>
> preferred_time = ntohl(pinfo->nd_opt_pi_preferred_time);
> - if (pp->pltimeexpire) {
> - /*
> - * The lifetime is decremented in real time, so we should
> - * compare the expiration time.
> - * (RFC 2461 Section 6.2.7.)
> - * XXX: can we really expect that all routers on the link
> - * have synchronized clocks?
> - */
> - gettimeofday(&now, NULL);
> - preferred_time += now.tv_sec;
> -
> - if (rai->clockskew &&
> - llabs(preferred_time - pp->pltimeexpire) > rai->clockskew) {
> - log_info("preferred lifetime for %s/%d"
> - " (decr. in real time) inconsistent on %s:"
> - " %lld from %s, %lld from us",
> - inet_ntop(AF_INET6, &pinfo->nd_opt_pi_prefix,
> - prefixbuf, INET6_ADDRSTRLEN),
> - pinfo->nd_opt_pi_prefix_len,
> - rai->ifname, (long long)preferred_time,
> - inet_ntop(AF_INET6, &from->sin6_addr,
> - ntopbuf, INET6_ADDRSTRLEN),
> - (long long)pp->pltimeexpire);
> - inconsistent++;
> - }
> - } else if (preferred_time != pp->preflifetime)
> + if (preferred_time != pp->preflifetime) {
> log_info("preferred lifetime for %s/%d"
> " inconsistent on %s:"
> " %lld from %s, %d from us",
> @@ -905,27 +879,11 @@ prefix_check(struct nd_opt_prefix_info *pinfo,
> inet_ntop(AF_INET6, &from->sin6_addr,
> ntopbuf, INET6_ADDRSTRLEN),
> pp->preflifetime);
> + inconsistent++;
> + }
>
> valid_time = ntohl(pinfo->nd_opt_pi_valid_time);
> - if (pp->vltimeexpire) {
> - gettimeofday(&now, NULL);
> - valid_time += now.tv_sec;
> -
> - if (rai->clockskew &&
> - llabs(valid_time - pp->vltimeexpire) > rai->clockskew) {
> - log_info("valid lifetime for %s/%d"
> - " (decr. in real time) inconsistent on %s:"
> - " %lld from %s, %lld from us",
> - inet_ntop(AF_INET6, &pinfo->nd_opt_pi_prefix,
> - prefixbuf, INET6_ADDRSTRLEN),
> - pinfo->nd_opt_pi_prefix_len,
> - rai->ifname, (long long)preferred_time,
> - inet_ntop(AF_INET6, &from->sin6_addr,
> - ntopbuf, INET6_ADDRSTRLEN),
> - (long long)pp->vltimeexpire);
> - inconsistent++;
> - }
> - } else if (valid_time != pp->validlifetime) {
> + if (valid_time != pp->validlifetime) {
> log_info("valid lifetime for %s/%d"
> " inconsistent on %s:"
> " %lld from %s, %d from us",
> diff --git rtadvd.conf.5 rtadvd.conf.5
> index d3e0cd8bc59..a96744b74a4 100644
> --- rtadvd.conf.5
> +++ rtadvd.conf.5
> @@ -157,23 +157,10 @@ will automatically get appropriate prefixes from the
> kernel's routing table,
> and advertise the prefixes with the default parameters, unless the
> .Cm noifprefix
> flag is specified.
> -Keywords other than
> -.Cm clockskew
> -can be augmented with a number, like
> + Keywords can be augmented with a number, like
> .Dq Li prefix2 ,
> to specify multiple prefixes.
> .Bl -tag -width indent
> -.It Cm \&clockskew
> -(num) Time skew to adjust link propagation delays and clock skews
> -between routers on the link
> -.Pq unit: seconds .
> -This value is used in consistency check for locally-configured and
> -advertised prefix lifetimes, and has its meaning when the local router
> -configures a prefix on the link with a lifetime that decrements in
> -real time.
> -If the value is 0, it means the consistency check will be skipped
> -for such prefixes.
> -The default value is 0.
> .It Cm \&prefixlen
> (num) Prefix length field.
> The default value is 64.
> @@ -211,16 +198,10 @@ will send RA packets with no prefix information.
> (num) Valid lifetime field
> .Pq unit: seconds .
> The default value is 2592000 (30 days).
> -.It Cm \&vltimedecr
> -(bool) This item means the advertised valid lifetime will decrement
> -in real time, which is disabled by default.
> .It Cm \&pltime
> (num) Preferred lifetime field
> .Pq unit: seconds .
> The default value is 604800 (7 days).
> -.It Cm \&pltimedecr
> -(bool) This item means the advertised preferred lifetime will decrement
> -in real time, which is disabled by default.
> .El
> .Pp
> The following item is for ICMPv6 MTU option,
> diff --git rtadvd.h rtadvd.h
> index 18f532b9436..4ce2fb3051f 100644
> --- rtadvd.h
> +++ rtadvd.h
> @@ -69,9 +69,7 @@ struct prefix {
> TAILQ_ENTRY(prefix) entry;
>
> u_int32_t validlifetime; /* AdvValidLifetime */
> - time_t vltimeexpire; /* expiration of vltime; decrement case only */
> u_int32_t preflifetime; /* AdvPreferredLifetime */
> - time_t pltimeexpire; /* expiration of pltime; decrement case only */
> u_int onlinkflg; /* bool: AdvOnLinkFlag */
> u_int autoconfflg; /* bool: AdvAutonomousFlag */
> int prefixlen;
> @@ -151,8 +149,6 @@ struct rainfo {
> TAILQ_HEAD(rtinfolist, rtinfo) rtinfos;
> TAILQ_HEAD(rdnsslist, rdnss) rdnsss; /* advertised recursive dns
> servers */
> TAILQ_HEAD(dnssllist, dnssl) dnssls;
> - long clockskew; /* used for consistency check of lifetimes */
> -
>
> /* actual RA packet data and its length */
> size_t ra_datalen;
>
>
> --
> I'm not entirely sure you are real.
>
--
I'm not entirely sure you are real.