ra: avoid saving an empty search domain entry
authorSteven Barth <steven@midlink.org>
Wed, 15 Apr 2015 12:55:57 +0000 (14:55 +0200)
committerSteven Barth <steven@midlink.org>
Wed, 15 Apr 2015 12:55:57 +0000 (14:55 +0200)
Signed-off-by: Steven Barth <steven@midlink.org>
src/ra.c

index dcb3e0f..1c121e6 100644 (file)
--- a/src/ra.c
+++ b/src/ra.c
@@ -424,14 +424,17 @@ bool ra_process(void)
 
                                while (buf < end) {
                                        int len = dn_expand(buf, end, buf, (char*)entry->auxtarget, 256);
-                                       if (len > 0) {
-                                               buf = &buf[len];
-                                               entry->auxlen = strlen((char*)entry->auxtarget);
-                                               changed |= odhcp6c_update_entry(STATE_RA_SEARCH, entry, 0, true);
-                                               entry->auxlen = 0;
-                                       } else {
+                                       if (len < 1)
                                                break;
-                                       }
+
+                                       buf = &buf[len];
+                                       entry->auxlen = strlen((char*)entry->auxtarget);
+
+                                       if (entry->auxlen == 0)
+                                               continue;
+
+                                       changed |= odhcp6c_update_entry(STATE_RA_SEARCH, entry, 0, true);
+                                       entry->auxlen = 0;
                                }
                        }
                }