]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Test no useable IA in each lease validation.
authorRoy Marples <roy@marples.name>
Mon, 28 Jul 2014 09:15:04 +0000 (09:15 +0000)
committerRoy Marples <roy@marples.name>
Mon, 28 Jul 2014 09:15:04 +0000 (09:15 +0000)
dhcp6.c

diff --git a/dhcp6.c b/dhcp6.c
index ea11f4f6ff8e9fc46b6e804f86e889b081cd1f5c..e77f793e38c1e678864a941071c8e69be1ecc74c 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -1955,6 +1955,7 @@ dhcp6_validatelease(struct interface *ifp,
     const char *sfrom)
 {
        struct dhcp6_state *state;
+       int nia;
 
        if (len <= sizeof(*m)) {
                syslog(LOG_ERR, "%s: DHCPv6 lease truncated", ifp->name);
@@ -1967,7 +1968,13 @@ dhcp6_validatelease(struct interface *ifp,
 
        state->renew = state->rebind = state->expire = 0;
        state->lowpl = ND6_INFINITE_LIFETIME;
-       return dhcp6_findia(ifp, m, len, sfrom);
+       nia = dhcp6_findia(ifp, m, len, sfrom);
+       if (nia == 0) {
+               syslog(LOG_ERR, "%s: no useable IA found in lease",
+                   ifp->name);
+               return -1;
+       }
+       return nia;
 }
 
 static ssize_t
@@ -2037,11 +2044,6 @@ dhcp6_readlease(struct interface *ifp)
        fd = dhcp6_validatelease(ifp, state->new, state->new_len, NULL);
        if (fd == -1)
                goto ex;
-       if (fd == 0) {
-               syslog(LOG_INFO, "%s: no useable IA found in lease",
-                   ifp->name);
-               goto ex;
-       }
 
        if (state->expire != ND6_INFINITE_LIFETIME) {
                gettimeofday(&now, NULL);