Merge pull request #20930 from stangri/master-pbr

pbr: ipv6 & migration bugfixes
This commit is contained in:
Stan Grishin 2023-05-08 19:41:31 -06:00 committed by GitHub
commit 9bd9458812
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=pbr PKG_NAME:=pbr
PKG_VERSION:=1.1.1 PKG_VERSION:=1.1.1
PKG_RELEASE:=1 PKG_RELEASE:=5
PKG_LICENSE:=GPL-3.0-or-later PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca> PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>

View file

@ -224,7 +224,7 @@ pbr_get_gateway6() {
local iface="$2" dev="$3" gw local iface="$2" dev="$3" gw
network_get_gateway6 gw "$iface" true network_get_gateway6 gw "$iface" true
if [ -z "$gw" ] || [ "$gw" = '::/0' ] || [ "$gw" = '::0/0' ] || [ "$gw" = '::' ]; then if [ -z "$gw" ] || [ "$gw" = '::/0' ] || [ "$gw" = '::0/0' ] || [ "$gw" = '::' ]; then
gw="$($ip_bin -6 a list dev "$dev" 2>/dev/null | grep inet6 | awk '{print $2}')" gw="$($ip_bin -6 a list dev "$dev" 2>/dev/null | grep inet6 | grep 'scope global' | awk '{print $2}')"
fi fi
eval "$1"='$gw' eval "$1"='$gw'
} }
@ -1771,7 +1771,7 @@ EOF
ipv6_error=0 ipv6_error=0
if { [ -n "$gw6" ] && [ "$gw6" != "::/0" ]; } || [ "$strict_enforcement" -ne 0 ]; then if { [ -n "$gw6" ] && [ "$gw6" != "::/0" ]; } || [ "$strict_enforcement" -ne 0 ]; then
if [ -z "$gw6" ] || [ "$gw6" = "::/0" ]; then if [ -z "$gw6" ] || [ "$gw6" = "::/0" ]; then
$ip_bin -6 route add unreachable default table "$tid" || ipv6_error=1 $ip_bin -6 route add unreachable default table "$tid" >/dev/null 2>&1 || ipv6_error=1
elif $ip_bin -6 route list table main | grep -q " dev $dev6 "; then elif $ip_bin -6 route list table main | grep -q " dev $dev6 "; then
while read -r i; do while read -r i; do
i="$(echo "$i" | sed 's/ linkdown$//')" i="$(echo "$i" | sed 's/ linkdown$//')"
@ -1785,7 +1785,7 @@ EOF
$ip_bin -6 route add default dev "$dev6" table "$tid" >/dev/null 2>&1 || ipv6_error=1 $ip_bin -6 route add default dev "$dev6" table "$tid" >/dev/null 2>&1 || ipv6_error=1
fi fi
fi fi
$ip_bin -6 rule add fwmark "${mark}/${fw_mask}" table "$tid" priority "$priority" || ipv6_error=1 $ip_bin -6 rule add fwmark "${mark}/${fw_mask}" table "$tid" priority "$priority" >/dev/null 2>&1 || ipv6_error=1
fi fi
fi fi
if [ "$ipv4_error" -eq 0 ] || [ "$ipv6_error" -eq 0 ]; then if [ "$ipv4_error" -eq 0 ] || [ "$ipv6_error" -eq 0 ]; then

View file

@ -5,6 +5,11 @@ readonly __OK__='\033[0;32m[\xe2\x9c\x93]\033[0m'
# Transition from vpn-policy-routing # Transition from vpn-policy-routing
if [ -s '/etc/config/vpn-policy-routing' ] && [ ! -s '/etc/config/pbr-opkg' ]; then if [ -s '/etc/config/vpn-policy-routing' ] && [ ! -s '/etc/config/pbr-opkg' ]; then
if [ -x '/etc/init.d/vpn-policy-routing' ]; then
echo "Stopping and disabling vpn-policy-routing."
/etc/init.d/vpn-policy-routing stop
/etc/init.d/vpn-policy-routing disable
fi
echo "Migrating vpn-policy-routing config file." echo "Migrating vpn-policy-routing config file."
mv '/etc/config/pbr' '/etc/config/pbr-opkg' mv '/etc/config/pbr' '/etc/config/pbr-opkg'
sed 's/vpn-policy-routing/pbr/g' /etc/config/vpn-policy-routing > /etc/config/pbr sed 's/vpn-policy-routing/pbr/g' /etc/config/vpn-policy-routing > /etc/config/pbr