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 dcb3e0f0fb40e9ee9281979ebf23435e52821254..1c121e63e3f8153064886293b3b8d5bcc72533b0 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;
                                }
                        }
                }