diff options
author | Daniil Baturin <daniil@baturin.org> | 2014-10-10 03:55:15 +0700 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2014-10-10 03:55:15 +0700 |
commit | 83fe2b10fda6d94ccd80539d772da0a56c428554 (patch) | |
tree | 7e4718d22582849d9ecd4290fdc32fc1897fce0e | |
parent | 4f05e2a3c33a85538ac780c1e704878ebe02b70d (diff) | |
parent | 125a751e4b9eec64e44bc450673f6169148979ef (diff) | |
download | vyatta-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-x | scripts/vyatta-address | 7 |
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 |