resolver-conf problem with both hotplug scripts and the wan6 interface
I have two issues with the hotplug scripts restarting the resolver on every interface update. Currently there seems to be a bug / issue in OpenWrt in resulting in frequent interface updates on my wan6 interface, also there seems to be no change in the ip addresses at all, even the temporary addresses are still the same, but i did not investigate this any further. I just added a simple nested if to it. Some similar issues where also mentioned in the forum https://forum.turris.cz/t/every-3-secs-in-log-kresd-hard-limit-for-number-of-file-descriptors-any-help:
/etc/hotplug.d/iface/40-ip-resolver-reload
if [ "$ACTION" = "ifupdate" -o "$ACTION" = "ifup" ]; then
if [ "$IFUPDATE_ADDRESSES" = "1" -o "$IFUPDATE_PREFIXES" = "1" ]; then
if [ "$INTERFACE" != "wan6" ]; then <------- added line
logger -t hotplug "Reload resolver because of interface address update"
/etc/init.d/resolver reload
fi
fi
fi
I also recognized that the second script /etc/hotplug.d/iface/40-resolver-reload is also triggerd, there is some matching against an previous md5, but which never got set on my box. So i added storing the md5 in the script as well, i'm not sure if some other script should set this:
/etc/hotplug.d/iface/40-resolver-reload
if /etc/init.d/resolver enabled && \
[ "$MD5" != "$PREVIOUS" ] && \
[ "$DO_FORWARD" = "1" ] ; then
/etc/init.d/resolver reload
echo "$MD5" > /tmp/resolv.conf.auto.last.md5 <-------- added line
fi
maybe this whole stuff could be refactored in a single script, i have no clue why there is a need for two different hotplug scripts at all.
Update:
i did some further investigations and it seems the "netifd" is doing a prefix update event also when only the preferred_until / valid_until values are modified.
https://git.openwrt.org/?p=project/netifd.git;a=blob;f=interface-ip.c
if (node_old && node_new) {
/* Move assignments and refresh addresses to update valid times */
list_splice(&prefix_old->assignments, &prefix_new->assignments);
list_for_each_entry(c, &prefix_new->assignments, head)
if ((iface = vlist_find(&interfaces, c->name, iface, node)))
interface_set_prefix_address(c, prefix_new, iface, true);
if (prefix_new->preferred_until != prefix_old->preferred_until ||
prefix_new->valid_until != prefix_old->valid_until)
ip->iface->updated |= IUF_PREFIX; <--- ALSO RESULTING IN AN PREFIX_UPDATE EVENT