Skip to content

Commit

Permalink
Merge pull request #1134 from jasonlyc/bug_fix
Browse files Browse the repository at this point in the history
fix shell compatibility bug in firerouter_dhcpcd_record_pd script
  • Loading branch information
MelvinTo authored Nov 14, 2023
2 parents a7a951d + d291105 commit 5e6d4ba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/firerouter_dhcpcd_record_pd
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ case $reason in
pd_id=$((pd_id + 1))
done
echo $pds > /home/pi/.router/run/dhcpcd/$interface/delegated_prefix
prev_pd_self_addr=$(cat /dev/shm/pd_self_addr.$interface || "")
if [ -n "$prev_pd_self_addr" && "$prev_pd_self_addr" -ne "$pd_self_addr" ]; then
prev_pd_self_addr=$(cat /dev/shm/pd_self_addr.$interface || echo "")
if [ -n "$prev_pd_self_addr" ] && [ "$prev_pd_self_addr" != "$pd_self_addr" ]; then
sudo ip -6 a del $prev_pd_self_addr dev $interface &> /dev/null
fi
if [ -n "$pd_self_addr" && -z "$nd1_addr1" && -z "$new_dhcp6_ia_na1_ia_addr1" ]; then
if [ -n "$pd_self_addr" ] && [ -z "$nd1_addr1" ] && [ -z "$new_dhcp6_ia_na1_ia_addr1" ]; then
echo $pd_self_addr > /dev/shm/pd_self_addr.$interface
sudo ip -6 a add $pd_self_addr dev $interface &> /dev/null
fi
Expand Down Expand Up @@ -86,11 +86,11 @@ case $reason in
pd_id=$((pd_id + 1))
done
echo $pds > /home/pi/.router/run/dhcpcd/$interface/delegated_prefix
prev_pd_self_addr=$(cat /dev/shm/pd_self_addr.$interface || "")
if [ -n "$prev_pd_self_addr" && "$prev_pd_self_addr" -ne "$pd_self_addr" ]; then
prev_pd_self_addr=$(cat /dev/shm/pd_self_addr.$interface || echo "")
if [ -n "$prev_pd_self_addr" ] && [ "$prev_pd_self_addr" != "$pd_self_addr" ]; then
sudo ip -6 a del $prev_pd_self_addr dev $interface &> /dev/null
fi
if [ -n "$pd_self_addr" && -z "$nd1_addr1" && -z "$new_dhcp6_ia_na1_ia_addr1" ]; then
if [ -n "$pd_self_addr" ] && [ -z "$nd1_addr1" ] && [ -z "$new_dhcp6_ia_na1_ia_addr1" ]; then
echo $pd_self_addr > /dev/shm/pd_self_addr.$interface
sudo ip -6 a add $pd_self_addr dev $interface &> /dev/null
fi
Expand Down

0 comments on commit 5e6d4ba

Please sign in to comment.