diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-04-29 21:42:48 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-04-29 21:44:18 +0200 |
commit | 73fe7fafbbd88079c7048d7380fae8c81f6834aa (patch) | |
tree | 055927f17b7b544f3903e715a6afb34d2824bec0 | |
parent | ac13c77d7ddd607b32f5948560bfe41cb2dcd756 (diff) | |
download | vyatta-cfg-system-73fe7fafbbd88079c7048d7380fae8c81f6834aa.tar.gz vyatta-cfg-system-73fe7fafbbd88079c7048d7380fae8c81f6834aa.zip |
T1359: Bugfix handling VLAN interfaces on DHCP -> static address change
Changing VLAN interface address from DHCP to static is not handeled in
vyatta-address script as VLAN interfaces are called e.g. eth0.201 or
br0.10 and dhclient replaces the '.' by '_', this was not handeled.
(cherry picked from commit 08a27c62b16e4560e4a47eafd281176e924bbe51)
-rwxr-xr-x | scripts/vyatta-address | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/vyatta-address b/scripts/vyatta-address index a35397de..0727911e 100755 --- a/scripts/vyatta-address +++ b/scripts/vyatta-address @@ -28,19 +28,19 @@ case $1 in delete) # Get current address from interface when using DHCP if [[ "$3" = "dhcp" ]]; then - lease_file=/var/lib/dhcp/dhclient_"$2".leases; + lease_file=/var/lib/dhcp/dhclient_"$(echo $2 | sed -e 's/\./_/')".leases; 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}') + 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; + lease_file=/var/lib/dhcp/dhclient_v6_"$(echo $2 | sed -e 's/\./_/')".leases; ip_address=$(sed -n 's/^\s\s\s\siaaddr\s\(.*\)\s{/\1/p' $lease_file | sed -n '$p'); else ip_address=$3; fi - ### T1053 parameter $ip_address needs to be prefixed, not just the IP + ### 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 @@ -48,7 +48,7 @@ case $1 in exit 0 fi - if [ ! -d "/sys/class/net/$2" ]; then + if [ ! -d "/sys/class/net/$2" ]; then # device is already gone exit 0 elif [[ "$3" = "dhcp" ]]; then |