meshwizard: Fix setting of masqueraded networks
This commit is contained in:
parent
84db98f50e
commit
bbab736642
1 changed files with 19 additions and 11 deletions
|
@ -56,18 +56,26 @@ uci_commitverbose "Add '$netrenamed' to freifunk firewall zone" firewall
|
||||||
currms=$(uci -q get firewall.zone_freifunk.masq_src)
|
currms=$(uci -q get firewall.zone_freifunk.masq_src)
|
||||||
|
|
||||||
# If interfaces are outside of the mesh network they should be natted
|
# If interfaces are outside of the mesh network they should be natted
|
||||||
for i in $networks; do
|
|
||||||
# Get dhcprange and meshnet
|
# Get dhcprange and meshnet
|
||||||
dhcprange=$(uci -q get meshwizard.netconfig.$i\_dhcprange)
|
if_ip="$(uci -q get network.${netrenamed}dhcp.ipaddr)"
|
||||||
if [ -n "$dhcprange" ]; then
|
if_mask="$(uci -q get network.${netrenamed}dhcp.netmask)"
|
||||||
meshnet="$(uci get profile_$community.profile.mesh_network)"
|
|
||||||
# check if the dhcprange is inside meshnet
|
[ -n "$if_ip" -a "$if_mask" ] && export $(ipcalc.sh $if_ip $if_mask)
|
||||||
dhcpinmesh="$($dir/helpers/check-range-in-range.sh $dhcprange $meshnet)"
|
[ -n "$NETWORK" -a "$PREFIX" ] && dhcprange="$NETWORK/$PREFIX"
|
||||||
if [ ! "$dhcpinmesh" == 1 ]; then
|
|
||||||
uci set firewall.zone_freifunk.masq="1"
|
if [ -n "$dhcprange" ]; then
|
||||||
[ -z "$(echo $currms |grep ${netrenamed}dhcp)" ] && uci add_list firewall.zone_freifunk.masq_src="${netrenamed}dhcp"
|
meshnet="$(uci get profile_$community.profile.mesh_network)"
|
||||||
fi
|
# check if the dhcprange is inside meshnet
|
||||||
|
dhcpinmesh="$($dir/helpers/check-range-in-range.sh $dhcprange $meshnet)"
|
||||||
|
if [ ! "$dhcpinmesh" == 1 ]; then
|
||||||
|
uci set firewall.zone_freifunk.masq=1
|
||||||
|
[ -z "$(echo $currms |grep ${netrenamed}dhcp)" ] && uci add_list firewall.zone_freifunk.masq_src="${netrenamed}dhcp"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
for i in IP NETMASK BROADCAST NETWORK PREFIX; do
|
||||||
|
unset $i
|
||||||
done
|
done
|
||||||
|
|
||||||
uci_commitverbose "Setup masquerading rules for '$netrenamed'" firewall
|
uci_commitverbose "Setup masquerading rules for '$netrenamed'" firewall
|
||||||
|
|
Loading…
Reference in a new issue