summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2014-10-10 03:55:15 +0700
committerDaniil Baturin <daniil@baturin.org>2014-10-10 03:55:15 +0700
commit83fe2b10fda6d94ccd80539d772da0a56c428554 (patch)
tree7e4718d22582849d9ecd4290fdc32fc1897fce0e
parent4f05e2a3c33a85538ac780c1e704878ebe02b70d (diff)
parent125a751e4b9eec64e44bc450673f6169148979ef (diff)
downloadvyatta-cfg-system-83fe2b10fda6d94ccd80539d772da0a56c428554.tar.gz
vyatta-cfg-system-83fe2b10fda6d94ccd80539d772da0a56c428554.zip
Merge pull request #26 from cyclops8456/helium
vyatta-cfg-system: allow dhcp and dhcpv6 addresses to be deleted
-rwxr-xr-xscripts/vyatta-address7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/vyatta-address b/scripts/vyatta-address
index 3cc1755b..afe60191 100755
--- a/scripts/vyatta-address
+++ b/scripts/vyatta-address
@@ -28,8 +28,11 @@ case $1 in
delete)
# Get current address from interface when using DHCP
if [[ "$3" = "dhcp" ]]; then
- file=/var/lib/dhcp3/dhclient_"$2"_lease;
- ip_address=$(sed -n "/new_ip_address='/ s/.*\='*//p" $file | sed -n "s/'//p");
+ lease_file=/var/lib/dhcp3/dhclient_"$2".leases;
+ ip_address=$(sed -n 's/^\s\sfixed-address\s\(.*\);/\1/p' $lease_file | sed -n '$p');
+ elif [[ "$3" = "dhcpv6" ]]; then
+ lease_file=/var/lib/dhcp3/dhclient_v6_"$2".leases;
+ ip_address=$(sed -n 's/^\s\s\s\siaaddr\s\(.*\)\s{/\1/p' $lease_file | sed -n '$p');
else
ip_address=$3;
fi