Index: [Article Count Order] [Thread]

Date: Wed, 29 Oct 2008 20:40:54 +0900
From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Subject: [users:00961] Issue on getting linklayer address from previous message
To: dhcptest@tahi.org
Cc: users@tahi.org
Message-Id: <20081029204054.083fce57.mitch@linux.vnet.ibm.com>
X-Mail-Count: 00961

Hi TAHI Project folks,

I found an issue in DHCPv6_Self_Test_P2_1_0_13.
At the routine to get a byte sequence of a linklayer address from the
previous message, it simply removes colon(:) from the character string
of the linklayer address.
However, it doesn't work well for the string which omits proceeding 0,
e.g. 00:01:02:34:05:67. This example becomes 01234567 wrongly.
It should be 000102340567.

I attach a proposal patch here. Could you review this?

Thank you,
----
Mitsuru Chinen <mitch@linux.vnet.ibm.com>

--- DHCPv6_Self_Test_P2_1_0_13.orig/DHCPv6_common.pm	2008-10-03 13:18:12.000000000 +0900
+++ DHCPv6_Self_Test_P2_1_0_13/DHCPv6_common.pm	2008-10-29 20:12:00.000000000 +0900
@@ -1688,7 +1688,14 @@ sub GetSvrDUIDfromPreMsg($$){
 			my $hardwaretype = $$ref_msg{"$duidindexname.HardwareType"};
 			my $time = $$ref_msg{"$duidindexname.Time"};
 			my $linkerlayeraddress = $$ref_msg{"$duidindexname.LinkLayerAddress"};
-			$linkerlayeraddress =~ s/://g;
+			if($linkerlayeraddress =~ /(\w+):(\w+):(\w+):(\w+):(\w+):(\w+)/) {
+				$linkerlayeraddress = sprintf("%02s%02s%02s%02s%02s%02s",
+							   	 $1, $2, $3, $4, $5, $6);
+			} else {
+				vLogHTML("The format of linklayer address is wrong!<BR>");
+				return (1,$cpp);
+			}
+
 			my $endofaddress = $$ref_msg{"$duidindexname.[Needless].data"};
 
 			if(defined($endofaddress)){