network/dhcp: correct prefix for expected IPv6 address
diff mbox series

Message ID 1554310924-24751-1-git-send-email-alexey.kodanev@oracle.com
State Accepted
Headers show
Series
  • network/dhcp: correct prefix for expected IPv6 address
Related show

Commit Message

Alexey Kodanev April 3, 2019, 5:02 p.m. UTC
Assuming a /64 prefix from DHCPv6 server is wrong [1], fixed dhclient
sets /128 prefix.

With this patch the test also checks the configured address without
the prefix, when the first check fails, and reports a more verbose
message, plus shows an output from 'ip addr show $iface' command.

[1] https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1609898

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/network/dhcp/dhcp_lib.sh |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

Comments

Petr Vorel April 4, 2019, 2:44 p.m. UTC | #1
Hi Alexey,

Reviewed-by: Petr Vorel <pvorel@suse.cz>
Good catch, thanks for fixing it!

>  testcases/network/dhcp/dhcp_lib.sh |   15 +++++++++++----
...
>  	if [ $TST_IPV6 ]; then
>  		ip_addr="fd00:1:1:2::12/64"
> -		ip_addr_check="fd00:1:1:2::100/64"
> +		ip_addr_check_nm="fd00:1:1:2::100"
Just curious what _nm stands for :).
> +		ip_addr_check="$ip_addr_check_nm/128"
...

Kind regards,
Petr
Alexey Kodanev April 5, 2019, 10:21 a.m. UTC | #2
Hi Petr,
On 04.04.2019 17:44, Petr Vorel wrote:
> Hi Alexey,
> 
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Good catch, thanks for fixing it!
> 
>>  testcases/network/dhcp/dhcp_lib.sh |   15 +++++++++++----
> ...
>>  	if [ $TST_IPV6 ]; then
>>  		ip_addr="fd00:1:1:2::12/64"
>> -		ip_addr_check="fd00:1:1:2::100/64"
>> +		ip_addr_check_nm="fd00:1:1:2::100"
> Just curious what _nm stands for :).

no mask, will change it to _noprefix.

Thanks for review!

>> +		ip_addr_check="$ip_addr_check_nm/128"
> ...
> 
> Kind regards,
> Petr
>

Patch
diff mbox series

diff --git a/testcases/network/dhcp/dhcp_lib.sh b/testcases/network/dhcp/dhcp_lib.sh
index c92117f..434ac1d 100755
--- a/testcases/network/dhcp/dhcp_lib.sh
+++ b/testcases/network/dhcp/dhcp_lib.sh
@@ -42,10 +42,12 @@  dhcp_lib_setup()
 
 	if [ $TST_IPV6 ]; then
 		ip_addr="fd00:1:1:2::12/64"
-		ip_addr_check="fd00:1:1:2::100/64"
+		ip_addr_check_nm="fd00:1:1:2::100"
+		ip_addr_check="$ip_addr_check_nm/128"
 	else
 		ip_addr="10.1.1.12/24"
-		ip_addr_check="10.1.1.100/24"
+		ip_addr_check_nm="10.1.1.100"
+		ip_addr_check="$ip_addr_check_nm/24"
 	fi
 
 	lsmod | grep -q '^veth ' && veth_loaded=yes || veth_loaded=no
@@ -141,8 +143,13 @@  test01()
 	if [ $? -eq 0 ]; then
 		tst_res TPASS "'$ip_addr_check' configured by DHCPv$TST_IPVER"
 	else
-		tst_res TFAIL "'$ip_addr_check' not configured by DHCPv$TST_IPVER"
-		print_dhcp_log
+		if ip addr show $iface1 | grep -q $ip_addr_check_nm; then
+			tst_res TFAIL "'$ip_addr_check_nm' configured but has wrong prefix, expect '$ip_addr_check'"
+			ip addr show $iface1
+		else
+			tst_res TFAIL "'$ip_addr_check' not configured by DHCPv$TST_IPVER"
+			print_dhcp_log
+		fi
 	fi
 
 	if [ "$wicked" ]; then