From: Roy Marples Date: Tue, 2 Jul 2013 13:45:27 +0000 (+0000) Subject: Only start DHCPv6 if the RA is new or has changed. X-Git-Tag: v6.0.3~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ee70f4ab00ebe69c32e4af0c6d1dbfa20022f10f;p=thirdparty%2Fdhcpcd.git Only start DHCPv6 if the RA is new or has changed. --- diff --git a/ipv6rs.c b/ipv6rs.c index 5969f627..9601370b 100644 --- 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)