From 6ab6a0a1857e9ae487642f5aad0c948e12d167c5 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 13 Nov 2018 21:06:49 +0100 Subject: T1006: remove the check-ipv4-ipv6.pl script that is not used anywhere. --- scripts/check-ipv4-ipv6.pl | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100755 scripts/check-ipv4-ipv6.pl (limited to 'scripts') diff --git a/scripts/check-ipv4-ipv6.pl b/scripts/check-ipv4-ipv6.pl deleted file mode 100755 index 0816ebee..00000000 --- a/scripts/check-ipv4-ipv6.pl +++ /dev/null @@ -1,12 +0,0 @@ -#! /usr/bin/perl - -# Trivial script to check for valid IPv4 or IPv6 address - -use strict; -use NetAddr::IP; - -foreach my $addr (@ARGV) { - die "$addr: not valid a valid IPv4 or IPv6 address\n" - unless new NetAddr::IP $addr; -} - -- cgit v1.2.3 From 8f4b8917d23b42d15b7f48eb3f814a56cc5a4343 Mon Sep 17 00:00:00 2001 From: Runar Borge Date: Sun, 25 Nov 2018 21:45:36 +0100 Subject: T1045: static route dhcp-interface: check for ip in response Checks done to verify a dhcp-lease on the interface is updated to look for a ip-address like response from dhclient before returning an error. This fixes the error where a newline was enough to make the checks fail.. Updated to also make sure no newline is returned after the address to make sure commands using adresses from this script is not cut in half by the newline, and to be in line with the syntax on all errors. (no newline at the end) --- scripts/vyatta-dhcp-helper.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/vyatta-dhcp-helper.pl b/scripts/vyatta-dhcp-helper.pl index 6febbaf9..4b236503 100644 --- a/scripts/vyatta-dhcp-helper.pl +++ b/scripts/vyatta-dhcp-helper.pl @@ -22,9 +22,12 @@ sub get_dhcp_router { my $router = `grep new_routers= $lease | cut -d"'" -f2`; my @r = split(/,/, $router); $router = $r[0]; - if ($router eq "") { + # Make sure the result looks like a IP + if ($router !~ /\d+\.\d+\.\d+\.\d+/) { return "127.0.0.1"; } + # Remove trailing newlines + $router =~ s/\n$//; return $router; } -- cgit v1.2.3 From 6bd3ae4fe0b0ea70f26f0b85e39c9c6b01661b4b Mon Sep 17 00:00:00 2001 From: Geoff Adams Date: Tue, 27 Nov 2018 20:40:11 -0800 Subject: T1055: Wait for Duplicate Address Detection on the relevant interface The DHCPv6 client can't start on an interface when DAD is ongoing. There is a workaround in place to wait for DAD to complete, but it only works on eth0! --- scripts/vyatta-dhcpv6-client.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/vyatta-dhcpv6-client.pl b/scripts/vyatta-dhcpv6-client.pl index c0b4cfeb..64c6840d 100755 --- a/scripts/vyatta-dhcpv6-client.pl +++ b/scripts/vyatta-dhcpv6-client.pl @@ -146,7 +146,7 @@ if (defined($start_flag) || defined ($renew_flag)) { # https://phabricator.vyos.net/T903 for (my $attempt_count = 0; $attempt_count <= 60; $attempt_count++) { # Check for any non-tentative addresses (exit code 0 if any exist, 1 otherwise) - if (system("test -n \"\$(ip -6 -o addr show dev eth0 scope link -tentative)\"") != 0) { + if (system("test -n \"\$(ip -6 -o addr show dev $ifname scope link -tentative)\"") != 0) { # No non-tentative address found, sleep and retry or exit if ($attempt_count == 0) { print "Duplicate address detection incomplete, waiting\n" -- cgit v1.2.3 From 74c1a8e3262480b4863a9b86bee77e2f6bf0acd3 Mon Sep 17 00:00:00 2001 From: hagbard Date: Thu, 29 Nov 2018 14:27:41 -0800 Subject: Fix: T1053 - Error when re-configuring an interface from DHCP to static IP --- debian/changelog | 5 +++++ scripts/vyatta-address | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/debian/changelog b/debian/changelog index bd4efe61..1f14c36e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,8 @@ +vyatta-cfg-system (0.20.44+vyos2+current16) unstable; urgency=low + + * T1053 - Error when re-configuring an interface from DHCP to static IP + + -- hagbard Thu, 29 Nov 2018 14:26:07 -0800 vyatta-cfg-system (0.20.44+vyos2+current15) unstable; urgency=medium * Virtio network card, no info (maybe not fully supported?) 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 -- cgit v1.2.3 From c27f83c59f4567a63d9f9aa5008b8183ee964a2a Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Fri, 30 Nov 2018 05:54:56 +0700 Subject: Revert "T1055: Wait for Duplicate Address Detection on the relevant interface" --- scripts/vyatta-dhcpv6-client.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/vyatta-dhcpv6-client.pl b/scripts/vyatta-dhcpv6-client.pl index 64c6840d..c0b4cfeb 100755 --- a/scripts/vyatta-dhcpv6-client.pl +++ b/scripts/vyatta-dhcpv6-client.pl @@ -146,7 +146,7 @@ if (defined($start_flag) || defined ($renew_flag)) { # https://phabricator.vyos.net/T903 for (my $attempt_count = 0; $attempt_count <= 60; $attempt_count++) { # Check for any non-tentative addresses (exit code 0 if any exist, 1 otherwise) - if (system("test -n \"\$(ip -6 -o addr show dev $ifname scope link -tentative)\"") != 0) { + if (system("test -n \"\$(ip -6 -o addr show dev eth0 scope link -tentative)\"") != 0) { # No non-tentative address found, sleep and retry or exit if ($attempt_count == 0) { print "Duplicate address detection incomplete, waiting\n" -- cgit v1.2.3 From 0ebc3def62c13a19bcfb8d25ae479235ed376268 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Fri, 30 Nov 2018 00:03:44 +0100 Subject: Revert "Revert "T1055: Wait for Duplicate Address Detection on the relevant interface"" This reverts commit c27f83c59f4567a63d9f9aa5008b8183ee964a2a. --- scripts/vyatta-dhcpv6-client.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/vyatta-dhcpv6-client.pl b/scripts/vyatta-dhcpv6-client.pl index c0b4cfeb..64c6840d 100755 --- a/scripts/vyatta-dhcpv6-client.pl +++ b/scripts/vyatta-dhcpv6-client.pl @@ -146,7 +146,7 @@ if (defined($start_flag) || defined ($renew_flag)) { # https://phabricator.vyos.net/T903 for (my $attempt_count = 0; $attempt_count <= 60; $attempt_count++) { # Check for any non-tentative addresses (exit code 0 if any exist, 1 otherwise) - if (system("test -n \"\$(ip -6 -o addr show dev eth0 scope link -tentative)\"") != 0) { + if (system("test -n \"\$(ip -6 -o addr show dev $ifname scope link -tentative)\"") != 0) { # No non-tentative address found, sleep and retry or exit if ($attempt_count == 0) { print "Duplicate address detection incomplete, waiting\n" -- cgit v1.2.3