Skip to content

Commit

Permalink
0.10 use dhcp6.extendprefix instead of ip6prefix to assign IPv6 PD by…
Browse files Browse the repository at this point in the history
… missing233
  • Loading branch information
makeding committed Dec 8, 2024
1 parent 24b4243 commit a62f3d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-fleth
LUCI_TITLE:=LuCI Support for Flet'h
LUCI_DESCRIPTION:=luci-app-fleth is a helper that can configure IPv4 over IPv6 tunnel automatically in Japan.
PKG_VERSION:=0.9
PKG_VERSION:=0.10
PKG_RELEASE:=1

LUCI_PKGARCH:=all
Expand Down
7 changes: 0 additions & 7 deletions root/etc/hotplug.d/iface/25-fleth-ip6prefix

This file was deleted.

27 changes: 3 additions & 24 deletions root/usr/sbin/fleth
Original file line number Diff line number Diff line change
Expand Up @@ -297,30 +297,9 @@ elif [ "$1" = "hook_none.js" ]; then
elif [ "$1" = "restore_none.js" ]; then
printf "'use strict';'require network';return network.registerProtocol('none',{getI18n:function(){return _('Unmanaged');}});" > /www/luci-static/resources/protocol/none.js
elif [ "$h_IP6PREFIX_ENABLED" -eq 1 ] && [ "$1" = "ip6prefix" ]; then
TRIES=0
MAX_TRIES=30
current_prefix=$(uci get network.${h_UPLINK_INTERFACE}.ip6prefix) > /dev/null
while [ $TRIES -lt $MAX_TRIES ]; do
ipv6_address=$(ifstatus ${h_UPLINK_INTERFACE} | grep '"address"' | awk -F '"' '{print $4}' | grep -vE '^(fe80|fc00|fd00|fd50|::|::1|::ffff:0:0|::/96)' | head -n 1)
if [ -n "$ipv6_address" ]; then
pd_prefix=$(echo $ipv6_address | cut -d ':' -f 1-4)::/64
if [ "$pd_prefix" != "$current_prefix" ]; then
logger -t fleth "Got new PD with ${h_UPLINK_INTERFACE}=${pd_prefix}"
uci set network.${h_UPLINK_INTERFACE}.ip6prefix=${pd_prefix}
uci commit
if [ "$h_ENABLED" -eq 1 ] && [ "$ACTION" = "ifup" ]; then
sleep 10
/usr/sbin/fleth auto
fi
fi
break
fi
sleep 1
TRIES=$((TRIES + 1))
done
if [ $TRIES -ge $MAX_TRIES ]; then
logger -t fleth "Failed to obtain a valid IPv6 address after $MAX_TRIES attempts."
fi
uci set network.${h_UPLINK_INTERFACE}.extendprefix=1
uci delete network.${h_UPLINK_INTERFACE}.ip6prefix
uci commit network.${h_UPLINK_INTERFACE}
else
echo "Flet'h by huggy"
echo "Flet'h is a helper that can configure your IPv4 over IPv6 tunnel automatically."
Expand Down

0 comments on commit a62f3d2

Please sign in to comment.