]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Only start DHCPv6 if the RA is new or has changed.
authorRoy Marples <roy@marples.name>
Tue, 2 Jul 2013 13:45:27 +0000 (13:45 +0000)
committerRoy Marples <roy@marples.name>
Tue, 2 Jul 2013 13:45:27 +0000 (13:45 +0000)
ipv6rs.c

index 5969f627207591cd04befd43ed20eb133ed022e6..9601370b54726ea796664f8d70208f0262791d44 100644 (file)
--- a/ipv6rs.c
+++ b/ipv6rs.c
@@ -605,8 +605,7 @@ ipv6rs_handledata(__unused void *arg)
 
        /* We don't want to spam the log with the fact we got an RA every
         * 30 seconds or so, so only spam the log if it's different. */
-       if (options & DHCPCD_DEBUG || rap == NULL ||
-           (rap->data_len != len ||
+       if (rap == NULL || (rap->data_len != len ||
             memcmp(rap->data, (unsigned char *)icp, rap->data_len) != 0))
        {
                if (rap) {
@@ -617,10 +616,11 @@ ipv6rs_handledata(__unused void *arg)
                        rap->nslen = 0;
                }
                new_data = 1;
-               syslog(LOG_INFO, "%s: Router Advertisement from %s",
-                   ifp->name, sfrom);
        } else
                new_data = 0;
+       if (new_data || ifp->options->options & DHCPCD_DEBUG)
+               syslog(LOG_INFO, "%s: Router Advertisement from %s",
+                   ifp->name, sfrom);
 
        if (rap == NULL) {
                rap = calloc(1, sizeof(*rap));
@@ -935,10 +935,12 @@ ipv6rs_handledata(__unused void *arg)
 
 handle_flag:
        if (rap->flags & ND_RA_FLAG_MANAGED) {
-               if (rap->lifetime && dhcp6_start(ifp, DH6S_INIT) == -1)
+               if (rap->lifetime && new_data &&
+                   dhcp6_start(ifp, DH6S_INIT) == -1)
                        syslog(LOG_ERR, "dhcp6_start: %s: %m", ifp->name);
        } else if (rap->flags & ND_RA_FLAG_OTHER) {
-               if (rap->lifetime && dhcp6_start(ifp, DH6S_INFORM) == -1)
+               if (rap->lifetime && new_data &&
+                   dhcp6_start(ifp, DH6S_INFORM) == -1)
                        syslog(LOG_ERR, "dhcp6_start: %s: %m", ifp->name);
        } else {
                if (rap->lifetime && new_data)