Skip to content

Commit

Permalink
[dhclient]Fix dhclient-hook inband-ztp permission errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondo910012 committed Feb 22, 2023
1 parent 92340ff commit 75a63b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/usr/lib/ztp/dhcp/inband-ztp-ip
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ case $reason in
if inband_interface_check ${interface} ; then
if [ -n "$old_ip_address" ] && [ -n "$old_subnet_mask" ]; then
prefix=$(IPprefix_by_netmask "${old_subnet_mask}")
config interface ip remove ${interface} ${old_ip_address}${prefix}
sudo config interface ip remove ${interface} ${old_ip_address}${prefix}
fi
fi
;;
Expand All @@ -47,11 +47,11 @@ case $reason in
if [ -n "$new_ip_address" ] && [ -n "$new_subnet_mask" ]; then
if [ -n "$old_ip_address" ] && [ -n "$old_subnet_mask" ]; then
prefix=$(IPprefix_by_netmask "${old_subnet_mask}")
config interface ip remove ${interface} ${old_ip_address}${prefix}
sudo config interface ip remove ${interface} ${old_ip_address}${prefix}
fi
prefix=$(IPprefix_by_netmask "${new_subnet_mask}")
if [ "${prefix}" != "/0" ]; then
config interface ip add ${interface} ${new_ip_address}${prefix}
sudo config interface ip add ${interface} ${new_ip_address}${prefix}
fi
fi
fi
Expand Down
6 changes: 3 additions & 3 deletions src/usr/lib/ztp/dhcp/inband-ztp-ip6
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ case $reason in
else
old_prefixlen=128
fi
config interface ip remove ${interface} ${old_ip6_address}/${old_prefixlen}
sudo config interface ip remove ${interface} ${old_ip6_address}/${old_prefixlen}
fi
fi
;;
Expand All @@ -45,14 +45,14 @@ case $reason in
else
old_prefixlen=128
fi
config interface ip remove ${interface} ${old_ip6_address}/${old_prefixlen}
sudo config interface ip remove ${interface} ${old_ip6_address}/${old_prefixlen}
fi
if [ -n "${new_ip6_prefixlen}" ]; then
prefixlen=${new_ip6_prefixlen}
else
prefixlen=128
fi
config interface ip add ${interface} ${new_ip6_address}/${new_ip6_prefixlen}
sudo config interface ip add ${interface} ${new_ip6_address}/${new_ip6_prefixlen}
fi
fi
;;
Expand Down

0 comments on commit 75a63b9

Please sign in to comment.