Skip to content

Commit

Permalink
Update IPv6 prefer settings
Browse files Browse the repository at this point in the history
  • Loading branch information
EkkoG committed Oct 20, 2023
1 parent 190254d commit 69dc933
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions modules/prefer-ipv6-settings/files/etc/hotplug.d/iface/99-odhcpd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0
[ "$ACTION" = ifupdate -a -z "$IFUPDATE_ADDRESSES" -a -z "$IFUPDATE_DATA" ] && exit 0

logger -t odhcpd "Reloading odhcpd due to $ACTION of $INTERFACE ($DEVICE)"
if echo "$INTERFACE" | grep -q "wan" && echo "$INTERFACE" | grep -qv "vap"; then
IPV6_REGEX="\(\([0-9A-Fa-f]\{1,4\}:\)\{1,\}\)\(\([0-9A-Fa-f]\{1,4\}\)\{0,1\}\)\(\(:[0-9A-Fa-f]\{1,4\}\)\{1,\}\)"
IPV6_ADDR="$(ip -6 addr show dev "$DEVICE" | grep inet6 | grep -m 1 -o "$IPV6_REGEX")"
LOCK_FILE="/tmp/lock/odhcpd_hotplug_lock"

"/etc/init.d/odhcpd" restart
if [ -n "$IPV6_ADDR" ] && mkdir "$LOCK_FILE" 2>/dev/null; then
[ -f '/etc/init.d/miniupnpd' ] && "/etc/init.d/miniupnpd" stop 2>&1
"/sbin/ifup" lan 2>&1
[ -f '/etc/init.d/miniupnpd' ] && "/etc/init.d/miniupnpd" start 2>&1 &
logger -t odhcpd "Reloading lan due to $ACTION of $INTERFACE ($DEVICE)"
fi
fi

0 comments on commit 69dc933

Please sign in to comment.