diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2017-05-27 10:54:45 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2017-05-27 10:54:45 +0000 |
commit | 33daed407021562ee11483defb5d377df0d05df5 (patch) | |
tree | 9adf7fbc330c787fb54d701ee1153b72948085df /usr.sbin | |
parent | a37cd1ad9e4c7b0ebfa3ea16d8c87daffe903294 (diff) |
there is no need to construct and send a proposal if we reached the
limit and just remove the list element directly afterwards
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/slaacd/engine.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/usr.sbin/slaacd/engine.c b/usr.sbin/slaacd/engine.c index 2ade1760ec9..d2f6c65e456 100644 --- a/usr.sbin/slaacd/engine.c +++ b/usr.sbin/slaacd/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.14 2017/05/27 10:53:37 florian Exp $ */ +/* $OpenBSD: engine.c,v 1.15 2017/05/27 10:54:44 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser <florian@openbsd.org> @@ -1688,23 +1688,24 @@ address_proposal_timeout(int fd, short events, void *arg) switch (addr_proposal->state) { case PROPOSAL_NOT_CONFIGURED: case PROPOSAL_SENT: - addr_proposal->id = ++proposal_id; - memset(&proposal, 0, sizeof(proposal)); - proposal.if_index = addr_proposal->if_index; - proposal.pid = getpid(); - proposal.id = addr_proposal->id; - memcpy(&proposal.addr, &addr_proposal->addr, - sizeof(proposal.addr)); - memcpy(&proposal.mask, &addr_proposal->mask, - sizeof(proposal.mask)); + if (addr_proposal->timeout_count++ < 6) { + addr_proposal->id = ++proposal_id; - proposal.rtm_addrs = RTA_NETMASK | RTA_IFA; + memset(&proposal, 0, sizeof(proposal)); + proposal.if_index = addr_proposal->if_index; + proposal.pid = getpid(); + proposal.id = addr_proposal->id; + memcpy(&proposal.addr, &addr_proposal->addr, + sizeof(proposal.addr)); + memcpy(&proposal.mask, &addr_proposal->mask, + sizeof(proposal.mask)); - addr_proposal->state = PROPOSAL_SENT; + proposal.rtm_addrs = RTA_NETMASK | RTA_IFA; - send_proposal(&proposal); + addr_proposal->state = PROPOSAL_SENT; + + send_proposal(&proposal); - if (addr_proposal->timeout_count++ < 6) { tv.tv_sec = addr_proposal->next_timeout; tv.tv_usec = arc4random_uniform(1000000); addr_proposal->next_timeout *= 2; |