diff options
author | hagbard <vyosdev@derith.de> | 2018-11-29 14:27:41 -0800 |
---|---|---|
committer | hagbard <vyosdev@derith.de> | 2018-11-29 14:27:41 -0800 |
commit | 74c1a8e3262480b4863a9b86bee77e2f6bf0acd3 (patch) | |
tree | f678de449b8651476d63ba0c2da081176451ca6d /scripts | |
parent | 4cc8f2d4bb9c72f662d5d453e6ac954e64cb7a16 (diff) | |
download | vyatta-cfg-system-74c1a8e3262480b4863a9b86bee77e2f6bf0acd3.tar.gz vyatta-cfg-system-74c1a8e3262480b4863a9b86bee77e2f6bf0acd3.zip |
Fix: T1053 - Error when re-configuring an interface from DHCP to static IP
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-address | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/vyatta-address b/scripts/vyatta-address index c3e57856..a35397de 100755 --- a/scripts/vyatta-address +++ b/scripts/vyatta-address @@ -29,7 +29,10 @@ case $1 in # Get current address from interface when using DHCP if [[ "$3" = "dhcp" ]]; then lease_file=/var/lib/dhcp/dhclient_"$2".leases; - ip_address=$(sed -n 's/^\s\sfixed-address\s\(.*\);/\1/p' $lease_file | sed -n '$p'); + ip=$(sed -n 's/^\s\sfixed-address\s\(.*\);/\1/p' $lease_file | sed -n '$p'); + #ip_address=$(sed -n 's/^\s\sfixed-address\s\(.*\);/\1/p' $lease_file | sed -n '$p'); + # T1053 we need IP/prefix for normalize-ip to function + ip_address=$(ip a s dev $2 | grep $ip | awk '{print $2}') elif [[ "$3" = "dhcpv6" ]]; then lease_file=/var/lib/dhcp/dhclient_v6_"$2".leases; ip_address=$(sed -n 's/^\s\s\s\siaaddr\s\(.*\)\s{/\1/p' $lease_file | sed -n '$p'); @@ -37,6 +40,7 @@ case $1 in ip_address=$3; fi + ### T1053 parameter $ip_address needs to be prefixed, not just the IP ip_address=$(/usr/libexec/vyos/system/normalize-ip $ip_address) if ! ip address show dev $2 2>/dev/null | grep -q "$ip_address"; then |