+ break;
+ }
+
+ /*
+ * If changes have occurred, and if we have not sent a broadcast
+ * recently, send a dynamic update. This update is sent only
+ * on interfaces other than the one on which we received notice
+ * of the change. If we are within MIN_WAITTIME of a full update,
+ * don't bother sending; if we just sent a dynamic update
+ * and set a timer (nextbcast), delay until that time.
+ * If we just sent a full update, delay the dynamic update.
+ * Set a timer for a randomized value to suppress additional
+ * dynamic updates until it expires; if we delayed sending
+ * the current changes, set needupdate.
+ */
+ if (changes && supplier &&
+ now.tv_sec - lastfullupdate.tv_sec < SUPPLY_INTERVAL-MAX_WAITTIME) {
+ u_long delay;
+ extern long random();
+
+ if (now.tv_sec - lastbcast.tv_sec >= MIN_WAITTIME &&
+ timercmp(&nextbcast, &now, <)) {
+ if (traceactions)
+ fprintf(ftrace, "send dynamic update\n");
+ toall(supply, RTS_CHANGED, ifp);
+ lastbcast = now;
+ needupdate = 0;
+ nextbcast.tv_sec = 0;
+ } else {
+ needupdate++;
+ if (traceactions)
+ fprintf(ftrace, "delay dynamic update\n");
+ }
+#define RANDOMDELAY() (MIN_WAITTIME * 1000000 + \
+ (u_long)random() % ((MAX_WAITTIME - MIN_WAITTIME) * 1000000))
+
+ if (nextbcast.tv_sec == 0) {
+ delay = RANDOMDELAY();
+ if (traceactions)
+ fprintf(ftrace,
+ "inhibit dynamic update for %d usec\n",
+ delay);
+ nextbcast.tv_sec = delay / 1000000;
+ nextbcast.tv_usec = delay % 1000000;
+ timevaladd(&nextbcast, &now);
+ /*
+ * If the next possibly dynamic update
+ * is within MIN_WAITTIME of the next full update,
+ * force the delay past the full update,
+ * or we might send a dynamic update just before
+ * the full update.
+ */
+ if (nextbcast.tv_sec > lastfullupdate.tv_sec +
+ SUPPLY_INTERVAL - MIN_WAITTIME)
+ nextbcast.tv_sec = lastfullupdate.tv_sec +
+ SUPPLY_INTERVAL + 1;
+ }