summaryrefslogtreecommitdiffstats
path: root/ipv6.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2015-01-20 10:55:04 +0000
committerRoy Marples <roy@marples.name>2015-01-20 10:55:04 +0000
commitab84143db4c63358deb59b94bf80251fd8c9c074 (patch)
tree37939187b55e9a5d971b87ecc1f800f8460069bc /ipv6.c
parent85bff6487d2394245edf6a4013f4fd63d7c8d0ca (diff)
downloaddhcpcd-ab84143db4c63358deb59b94bf80251fd8c9c074.tar.xz
Add ipv6_freedrop, similar to dhcp6_freedrop so we can easily
drop and free or just free IPv6 temporary addresses.
Diffstat (limited to 'ipv6.c')
-rw-r--r--ipv6.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/ipv6.c b/ipv6.c
index f3307936..ebd3e626 100644
--- a/ipv6.c
+++ b/ipv6.c
@@ -1066,22 +1066,6 @@ ipv6_addlinklocalcallback(struct interface *ifp,
return 0;
}
-void
-ipv6_drop(struct interface *ifp)
-{
- struct ipv6_state *state;
- struct ll_callback *cb;
-
- state = IPV6_STATE(ifp);
- if (state) {
- while ((cb = TAILQ_FIRST(&state->ll_callbacks))) {
- TAILQ_REMOVE(&state->ll_callbacks, cb, next);
- free(cb);
- }
- ipv6_freedrop_addrs(&state->addrs, 2, NULL);
- }
-}
-
static struct ipv6_addr *
ipv6_newlinklocal(struct interface *ifp)
{
@@ -1244,19 +1228,19 @@ ipv6_start(struct interface *ifp)
}
void
-ipv6_free(struct interface *ifp)
+ipv6_freedrop(struct interface *ifp, int drop)
{
struct ipv6_state *state;
- struct ipv6_addr *ap;
+ struct ll_callback *cb;
if (ifp) {
- ipv6_drop(ifp);
state = IPV6_STATE(ifp);
if (state) {
- while ((ap = TAILQ_FIRST(&state->addrs))) {
- TAILQ_REMOVE(&state->addrs, ap, next);
- free(ap);
+ while ((cb = TAILQ_FIRST(&state->ll_callbacks))) {
+ TAILQ_REMOVE(&state->ll_callbacks, cb, next);
+ free(cb);
}
+ ipv6_freedrop_addrs(&state->addrs, drop ? 2 : 0, NULL);
free(state);
ifp->if_data[IF_DATA_IPV6] = NULL;
eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);