tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Replace time_second with time_uptime in some places



On Thu, Aug 6, 2015 at 12:35 PM, Ryota Ozaki <ozaki-r%netbsd.org@localhost> wrote:
> On Thu, Aug 6, 2015 at 1:27 AM, Greg Troxel <gdt%ir.bbn.com@localhost> wrote:
>>
>> Ryota Ozaki <ozaki-r%netbsd.org@localhost> writes:
>>
>>> Some codes in sys/net* use time_second to
>>> manage time periods such as cache expirations.
>>> However, time_second doesn't increase monotonically
>>> and can leap by say settimeofday(2) according to
>>> time_second(9). We should use time_uptime
>>> instead of it to avoid such time leaps.
>>>
>>> http://www.netbsd.org/~ozaki-r/use-time_uptime.diff
>>
>> Generally this sounds sensible.  One thing to consider is whether this
>> change results in leaking uptime to hosts over the network.  (That could
>> be used to help identify roving hosts.)
>
> Right. A possible leakage is ia6t_expire, but a TTL is
> calculated by ia6t_expire - time_uptime so time_uptime
> itself isn't leaked.
>
> Here is a list of variables to which time_uptime can
> be assigned and how they are used:
>
> - rmx_expire      : exchanged with userland
> - ia6t_expire     : used to calculate TTL and
>                     passed from userland
>                     (but not used for now)
> - ia6t_preferred  : passed from userland
>                     (but not used for now)
> - ia6_updatetime  : passed to userland
>                     (via ia6t_expire and ia6t_preferred)
> - ia6_createtime  : internal use only
> - ip6_log_time    : internal use only
> - ru_reseed       : internal use only
> - ln_expire       : passed to userland
>                     (should be passed from userland too
>                      but not used for now. See PR/50127)
> - ndpr_lastupdate : passed to userland
>                     (via in6_prefix#expire)
> - ndpr_preferred  : internal use only
> - ndpr_expire     : internal use only
>
> ...so I found I forgot some conversions on passing/getting
> values to/from userland. Fixed them.
>
> http://www.netbsd.org/~ozaki-r/use-time_uptime.diff

I changed the macros to static inline functions
as Taylor suggested in the end.

  ozaki-r

>
> Anyway we would need to add some tests for the IPv6
> lifetime management.
>
> Thanks,
>   ozaki-r


Home | Main Index | Thread Index | Old Index