summaryrefslogtreecommitdiff
path: root/sys/netinet6/nd6_rtr.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2003-06-24 07:47:55 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2003-06-24 07:47:55 +0000
commit319451a2d41604cd35b4eec1f35f4d481914632b (patch)
tree2884d9be029dc1cd603500d7ac860baf8076a90f /sys/netinet6/nd6_rtr.c
parentec5b565276d3b8c473a6d06eca4d669e9e943e31 (diff)
use time.tv_sec directly, rather than having time_second (freebsd NIH).
Diffstat (limited to 'sys/netinet6/nd6_rtr.c')
-rw-r--r--sys/netinet6/nd6_rtr.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index eed6e6ab42d..5d08babbf63 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_rtr.c,v 1.26 2003/05/15 15:00:43 itojun Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.27 2003/06/24 07:47:54 itojun Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
@@ -239,13 +239,12 @@ nd6_ra_input(m, off, icmp6len)
{
struct nd_defrouter dr0;
u_int32_t advreachable = nd_ra->nd_ra_reachable;
- long time_second = time.tv_sec;
Bzero(&dr0, sizeof(dr0));
dr0.rtaddr = saddr6;
dr0.flags = nd_ra->nd_ra_flags_reserved;
dr0.rtlifetime = ntohs(nd_ra->nd_ra_router_lifetime);
- dr0.expire = time_second + dr0.rtlifetime;
+ dr0.expire = time.tv_sec + dr0.rtlifetime;
dr0.ifp = ifp;
/* unspecified or not? (RFC 2461 6.3.4) */
if (advreachable) {
@@ -271,7 +270,6 @@ nd6_ra_input(m, off, icmp6len)
struct nd_opt_hdr *pt;
struct nd_opt_prefix_info *pi = NULL;
struct nd_prefix pr;
- long time_second = time.tv_sec;
for (pt = (struct nd_opt_hdr *)ndopts.nd_opts_pi;
pt <= (struct nd_opt_hdr *)ndopts.nd_opts_pi_end;
@@ -330,7 +328,7 @@ nd6_ra_input(m, off, icmp6len)
pr.ndpr_plen = pi->nd_opt_pi_prefix_len;
pr.ndpr_vltime = ntohl(pi->nd_opt_pi_valid_time);
pr.ndpr_pltime = ntohl(pi->nd_opt_pi_preferred_time);
- pr.ndpr_lastupdate = time_second;
+ pr.ndpr_lastupdate = time.tv_sec;
if (in6_init_prefix_ltimes(&pr))
continue; /* prefix lifetime init failed */
@@ -1242,7 +1240,6 @@ prelist_update(new, dr, m)
struct in6_ifaddr *ifa6;
int ifa_plen;
u_int32_t storedlifetime;
- long time_second = time.tv_sec;
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
@@ -1295,7 +1292,7 @@ prelist_update(new, dr, m)
lt6_tmp = ifa6->ia6_lifetime;
if (lt6_tmp.ia6t_vltime == ND6_INFINITE_LIFETIME)
storedlifetime = ND6_INFINITE_LIFETIME;
- else if (time_second - ifa6->ia6_updatetime >
+ else if (time.tv_sec - ifa6->ia6_updatetime >
lt6_tmp.ia6t_vltime) {
/*
* The case of "invalid" address. We should usually
@@ -1304,7 +1301,7 @@ prelist_update(new, dr, m)
storedlifetime = 0;
} else
storedlifetime = lt6_tmp.ia6t_vltime -
- (time_second - ifa6->ia6_updatetime);
+ (time.tv_sec - ifa6->ia6_updatetime);
if (TWOHOUR < new->ndpr_vltime ||
storedlifetime < new->ndpr_vltime) {
lt6_tmp.ia6t_vltime = new->ndpr_vltime;
@@ -1335,7 +1332,7 @@ prelist_update(new, dr, m)
in6_init_address_ltimes(pr, &lt6_tmp);
ifa6->ia6_lifetime = lt6_tmp;
- ifa6->ia6_updatetime = time_second;
+ ifa6->ia6_updatetime = time.tv_sec;
}
if (ia6_match == NULL && new->ndpr_vltime) {
/*
@@ -1874,7 +1871,6 @@ in6_ifadd(pr)
int
in6_init_prefix_ltimes(struct nd_prefix *ndpr)
{
- long time_second = time.tv_sec;
/* check if preferred lifetime > valid lifetime. RFC2462 5.5.3 (c) */
if (ndpr->ndpr_pltime > ndpr->ndpr_vltime) {
@@ -1886,11 +1882,11 @@ in6_init_prefix_ltimes(struct nd_prefix *ndpr)
if (ndpr->ndpr_pltime == ND6_INFINITE_LIFETIME)
ndpr->ndpr_preferred = 0;
else
- ndpr->ndpr_preferred = time_second + ndpr->ndpr_pltime;
+ ndpr->ndpr_preferred = time.tv_sec + ndpr->ndpr_pltime;
if (ndpr->ndpr_vltime == ND6_INFINITE_LIFETIME)
ndpr->ndpr_expire = 0;
else
- ndpr->ndpr_expire = time_second + ndpr->ndpr_vltime;
+ ndpr->ndpr_expire = time.tv_sec + ndpr->ndpr_vltime;
return 0;
}
@@ -1898,14 +1894,13 @@ in6_init_prefix_ltimes(struct nd_prefix *ndpr)
static void
in6_init_address_ltimes(struct nd_prefix *new, struct in6_addrlifetime *lt6)
{
- long time_second = time.tv_sec;
/* Valid lifetime must not be updated unless explicitly specified. */
/* init ia6t_expire */
if (lt6->ia6t_vltime == ND6_INFINITE_LIFETIME)
lt6->ia6t_expire = 0;
else {
- lt6->ia6t_expire = time_second;
+ lt6->ia6t_expire = time.tv_sec;
lt6->ia6t_expire += lt6->ia6t_vltime;
}
@@ -1913,7 +1908,7 @@ in6_init_address_ltimes(struct nd_prefix *new, struct in6_addrlifetime *lt6)
if (lt6->ia6t_pltime == ND6_INFINITE_LIFETIME)
lt6->ia6t_preferred = 0;
else {
- lt6->ia6t_preferred = time_second;
+ lt6->ia6t_preferred = time.tv_sec;
lt6->ia6t_preferred += lt6->ia6t_pltime;
}
}