tcpiputils/dhcp/te_dhcp/src/te_dhcpTestStep1.cpp
changeset 0 af10295192d8
child 20 7e41d162e158
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Basic Server Interaction Tests (test doc 4.1)
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file te_dhcpTestStep1.cpp
       
    20 */
       
    21 #include "te_dhcpTestStep1.h"
       
    22 #include <test/testexecutelog.h>
       
    23 #include <commdbconnpref.h>
       
    24 #include <in_sock.h>
       
    25 #include <nifman.h>
       
    26 #include "te_dhcpTestServer.h"
       
    27 #include <comms-infras/es_config.h>
       
    28 #include "../../include/DHCP_Std.h"
       
    29 #include <comms-infras/startprocess.h>
       
    30 #include "te_TestDaemonClient.h"
       
    31 #include "DHCPStatesDebug.h"
       
    32 
       
    33 TVerdict CDhcpTestStep1_1::doTestStepL()
       
    34 /**
       
    35 * @return - TVerdict code, only ever returns EPass, else leaves with error!
       
    36 * Override of base class pure virtual
       
    37 * Connect to DHCP Daemon (test doc 4.1.1)
       
    38 * Test cannot explicitly connect as we use the
       
    39 * RConnection API here which will test full
       
    40 * functionality through the system. This test
       
    41 * therefore starts an ethernet connection with
       
    42 * settings in commDB to specify using dhcp configuration
       
    43 * to provide the connection with an address. If the connection
       
    44 * starts successfully, then DHCP was used to configure an
       
    45 * address therefore connection to DHCP by NIFMAN was achieved...
       
    46 */
       
    47 	{
       
    48 
       
    49 	SetTestStepResult(EFail);
       
    50 	
       
    51 	RSocketServ eSock;
       
    52 	TInt err = eSock.Connect();
       
    53 	TESTEL(err == KErrNone, err);
       
    54 	CleanupClosePushL(eSock);
       
    55 
       
    56 #ifdef _DEBUG
       
    57 	User::LeaveIfError(RProperty::Set(KMyPropertyCat, KMyPropertyDestPortv4, 67));
       
    58 	User::LeaveIfError(RProperty::Set(KMyPropertyCat, KMyPropertyDestPortv6, 547));
       
    59 #endif		
       
    60 	
       
    61 	RConnection connNET1;
       
    62 	err = connNET1.Open(eSock);
       
    63 	TESTEL(err == KErrNone, err);
       
    64 	CleanupClosePushL(connNET1);
       
    65 	
       
    66 	err = connNET1.Start(iConnPrefs); // see test script for IAP used
       
    67 	TESTEL(err == KErrNone, err);
       
    68 	
       
    69 	err = connNET1.Stop();
       
    70 	TESTEL(err == KErrNone, err);
       
    71 
       
    72 	CleanupStack::PopAndDestroy(&connNET1);
       
    73 	CleanupStack::PopAndDestroy(&eSock);
       
    74 	
       
    75 	SetTestStepResult(EPass);
       
    76 	return TestStepResult();
       
    77 	}
       
    78 
       
    79 TVerdict CDhcpTestStep1_2::doTestStepL()
       
    80 /**
       
    81 * @return - TVerdict code only ever returns EPass, else leaves with error!
       
    82 * Override of base class pure virtual
       
    83 * Connect to DHCP Daemon - Daemon not found(test doc 4.1.2)
       
    84 * Daemon name in commDB specifies a non-existent daemon therefore
       
    85 * connection start will fail as the settings for it are incorrect...
       
    86 */
       
    87 	{
       
    88 	SetTestStepResult(EFail);
       
    89 	
       
    90 	RSocketServ eSock;
       
    91 	TInt err = eSock.Connect();
       
    92 	TESTEL(err == KErrNone, err);
       
    93 	CleanupClosePushL(eSock);
       
    94 #ifdef _DEBUG
       
    95 	User::LeaveIfError(RProperty::Set(KMyPropertyCat, KMyPropertyDestPortv4, 67));
       
    96 #endif		
       
    97 	
       
    98 	RConnection connNET1;
       
    99 	err = connNET1.Open(eSock);
       
   100 	TESTEL(err == KErrNone, err);
       
   101 	CleanupClosePushL(connNET1);
       
   102 	
       
   103 	err = connNET1.Start(iConnPrefs); // see test script for IAP used
       
   104 	TESTEL(err == KErrNotFound, err);
       
   105 
       
   106 	CleanupStack::PopAndDestroy(&connNET1);
       
   107 	CleanupStack::PopAndDestroy(&eSock);
       
   108 	
       
   109 	SetTestStepResult(EPass);
       
   110 	return TestStepResult();
       
   111 	}
       
   112 
       
   113 TVerdict CDhcpTestStep1_3::doTestStepL()
       
   114 /**
       
   115 * @return - TVerdict code only ever returns EPass, else leaves with error!
       
   116 * Override of base class pure virtual
       
   117 * Get Active IP Address (test doc 4.1.3)
       
   118 * from a connection that does not use DHCP
       
   119 * configuration but the static settings in
       
   120 * commDB. Therefore any request for the address
       
   121 * from the DHCP daemon will fail.
       
   122 */
       
   123 	{
       
   124 	SetTestStepResult(EFail);
       
   125 	
       
   126 	RSocketServ eSock;
       
   127 	TInt err = eSock.Connect();
       
   128 	TESTEL(err == KErrNone, err);
       
   129 	INFO_PRINTF2(_L("eSock.Connect() returned %d"),err);
       
   130 	CleanupClosePushL(eSock);
       
   131 #ifdef _DEBUG
       
   132 	User::LeaveIfError(RProperty::Set(KMyPropertyCat, KMyPropertyDestPortv4, 67));
       
   133 #endif		
       
   134 	
       
   135 	RConnection connNET1;
       
   136 	err = connNET1.Open(eSock);
       
   137 	INFO_PRINTF2(_L("connNET1.Open(eSock) returned %d"),err);
       
   138 	TESTEL(err == KErrNone, err);
       
   139 	CleanupClosePushL(connNET1);
       
   140 	
       
   141 	err = connNET1.Start(iConnPrefs); // see test script for IAP used
       
   142 	INFO_PRINTF2(_L("connNET1.Start(prefs) returned %d"),err);
       
   143 	TESTEL(err == KErrNone, err);
       
   144 	
       
   145 	TRequestStatus stat;
       
   146 	TConnectionAddrBuf address;
       
   147 	address().iAddressFamily = IpAddressFamilyL();
       
   148 	INFO_PRINTF1(_L("Just before connNET1.Ioctl(...)"));
       
   149 	
       
   150 
       
   151 	INFO_PRINTF2(_L("Size: %d "), address.Size());
       
   152 	INFO_PRINTF2(_L("MaxSize: %d "), address.MaxSize());
       
   153 	INFO_PRINTF2(_L("MaxLength: %d "), address.MaxLength());
       
   154 	
       
   155 	connNET1.Ioctl(KCOLConfiguration, KConnGetCurrentAddr, stat, &address);
       
   156 	User::WaitForRequest(stat);
       
   157 	INFO_PRINTF2(_L("err = connNET1.Ioctl(...) returned %d"),stat.Int());
       
   158 	TESTEL(stat == KErrNotSupported, stat.Int());
       
   159 
       
   160 	err = connNET1.Stop();
       
   161 	INFO_PRINTF2(_L("connNET1.Stop() returned %d"),err);
       
   162 	TESTEL(err == KErrNone, err);
       
   163 
       
   164 	CleanupStack::PopAndDestroy(&connNET1);
       
   165 	CleanupStack::PopAndDestroy(&eSock);
       
   166 	
       
   167 	SetTestStepResult(EPass);
       
   168 	return TestStepResult();
       
   169 	}
       
   170 
       
   171 TVerdict CDhcpTestStep1_4::doTestStepL()
       
   172 /**
       
   173 * @return - TVerdict code only ever returns EPass, else leaves with error!
       
   174 * Override of base class pure virtual
       
   175 * Get DHCP Server Address (test case 4.1.4)
       
   176 * As no DHCP configuration is used for this
       
   177 * test, the connection cannot be queried for 
       
   178 * the DHCP Server that assigned any address...
       
   179 */
       
   180 	{
       
   181 	SetTestStepResult(EFail);
       
   182 	
       
   183 	RSocketServ eSock;
       
   184 	TInt err = eSock.Connect();
       
   185 	TESTEL( err == KErrNone, err);
       
   186 	CleanupClosePushL(eSock);
       
   187 #ifdef _DEBUG
       
   188 	User::LeaveIfError(RProperty::Set(KMyPropertyCat, KMyPropertyDestPortv4, 67));
       
   189 #endif		
       
   190 	
       
   191 	RConnection connNET1;
       
   192 	err = connNET1.Open(eSock);
       
   193 	TESTEL( err == KErrNone, err);
       
   194 	CleanupClosePushL(connNET1);
       
   195 	
       
   196 	err = connNET1.Start(iConnPrefs); // see test script for IAP used
       
   197 	TESTEL(err == KErrNone, err);
       
   198 	
       
   199 	TRequestStatus stat;
       
   200 	TConnectionAddrBuf address;
       
   201 	address().iAddressFamily = IpAddressFamilyL();
       
   202 	connNET1.Ioctl(KCOLConfiguration, KConnGetServerAddr, stat, &address);
       
   203 	User::WaitForRequest(stat);
       
   204 	TESTEL( stat == KErrNotSupported, stat.Int());
       
   205 
       
   206 	err = connNET1.Stop();
       
   207 	TESTEL(err == KErrNone, err);
       
   208 	
       
   209 	CleanupStack::PopAndDestroy(&connNET1);
       
   210 	CleanupStack::PopAndDestroy(&eSock);
       
   211 	
       
   212 	SetTestStepResult(EPass);
       
   213 	return TestStepResult();
       
   214 	}
       
   215 
       
   216 TVerdict CDhcpTestStep1_5::doTestStepL()
       
   217 /**
       
   218 * @return - TVerdict code only ever returns EPass, else leaves with error!
       
   219 * Override of base class pure virtual
       
   220 * Get Remaining Lease Time (test case 4.1.5)
       
   221 */
       
   222 	{
       
   223 	SetTestStepResult(EFail);
       
   224 	
       
   225 	RSocketServ eSock;
       
   226 	TInt err = eSock.Connect();
       
   227 	TESTEL(err == KErrNone, err);
       
   228 	CleanupClosePushL(eSock);
       
   229 #ifdef _DEBUG
       
   230 	User::LeaveIfError(RProperty::Set(KMyPropertyCat, KMyPropertyDestPortv4, 67));
       
   231 #endif		
       
   232 	
       
   233 	RConnection connNET1;
       
   234 	err = connNET1.Open(eSock);
       
   235 	TESTEL(err == KErrNone, err);
       
   236 	CleanupClosePushL(connNET1);
       
   237 	
       
   238 	err = connNET1.Start(iConnPrefs); // see test script for IAP used
       
   239 	TESTEL(err == KErrNone, err);
       
   240 	
       
   241 	TConnectionLeaseInfoBuf leaseTime1;
       
   242 	leaseTime1().iAddressFamily = IpAddressFamilyL();
       
   243 	TRequestStatus stat;
       
   244 	connNET1.Ioctl(KCOLConfiguration, KConnGetAddrLeaseTimeRemain, stat, &leaseTime1);
       
   245 	User::WaitForRequest(stat);
       
   246 	TESTEL(stat == KErrNotSupported, stat.Int());
       
   247 
       
   248 	err = connNET1.Stop();
       
   249 	TESTEL(err == KErrNone, err);
       
   250 
       
   251 	CleanupStack::PopAndDestroy(&connNET1);
       
   252 	CleanupStack::PopAndDestroy(&eSock);
       
   253 	
       
   254 	SetTestStepResult(EPass);
       
   255 	return TestStepResult();
       
   256 	}
       
   257 
       
   258 
       
   259 TVerdict CDhcpTestStep1_6::doTestStepL()
       
   260 /**
       
   261 * @return - TVerdict code only ever returns EPass, else leaves with error!
       
   262 * Override of base class pure virtual
       
   263 * Renew Current Lease (test case 4.1.6)
       
   264 */
       
   265 	{
       
   266 	SetTestStepResult(EFail);
       
   267 	
       
   268 	RSocketServ eSock;
       
   269 	TInt err = eSock.Connect();
       
   270 	TESTEL( err == KErrNone, err);
       
   271 	CleanupClosePushL(eSock);
       
   272 #ifdef _DEBUG
       
   273 	User::LeaveIfError(RProperty::Set(KMyPropertyCat, KMyPropertyDestPortv4, 67));
       
   274 #endif		
       
   275 	
       
   276 	RConnection connNET1;
       
   277 	err = connNET1.Open(eSock);
       
   278 	TESTEL( err == KErrNone, err);
       
   279 	CleanupClosePushL(connNET1);
       
   280 	
       
   281 	err = connNET1.Start(iConnPrefs); // see test script for IAP used
       
   282 	TESTEL( err == KErrNone, err);
       
   283 	
       
   284 	TRequestStatus stat;
       
   285 	connNET1.Ioctl(KCOLConfiguration, KConnAddrRenew, stat);
       
   286 	User::WaitForRequest(stat);
       
   287 	TESTEL( stat == KErrNotSupported, stat.Int());
       
   288 
       
   289 	err = connNET1.Stop();
       
   290 	TESTEL(err == KErrNone, err);
       
   291 
       
   292 	CleanupStack::PopAndDestroy(&connNET1);
       
   293 	CleanupStack::PopAndDestroy(&eSock);
       
   294 	
       
   295 	SetTestStepResult(EPass);
       
   296 	return TestStepResult();
       
   297 	}
       
   298 
       
   299 TVerdict CDhcpTestStep1_7::doTestStepL()
       
   300 /**
       
   301 * @return - TVerdict code only ever returns EPass, else leaves with error!
       
   302 * Override of base class pure virtual
       
   303 * Release Current Lease (test case 4.1.7)
       
   304 */
       
   305 	{
       
   306 	SetTestStepResult(EFail);
       
   307 	
       
   308 	RSocketServ eSock;
       
   309 	TInt err = eSock.Connect();
       
   310 	TESTEL( err == KErrNone, err);
       
   311 	CleanupClosePushL(eSock);
       
   312 #ifdef _DEBUG
       
   313 	User::LeaveIfError(RProperty::Set(KMyPropertyCat, KMyPropertyDestPortv4, 67));
       
   314 #endif		
       
   315 	
       
   316 	RConnection connNET1;
       
   317 	err = connNET1.Open(eSock);
       
   318 	TESTEL(err == KErrNone, err);
       
   319 	CleanupClosePushL(connNET1);
       
   320 	
       
   321 	err = connNET1.Start(iConnPrefs); // see test script for IAP used
       
   322 	TESTEL(err == KErrNone, err);
       
   323 	
       
   324 	TRequestStatus stat;
       
   325 	connNET1.Ioctl(KCOLConfiguration, KConnAddrRelease, stat);
       
   326 	User::WaitForRequest(stat);
       
   327 	TESTEL(stat == KErrNotSupported, stat.Int());
       
   328 
       
   329 	err = connNET1.Stop();
       
   330 	TESTEL(err == KErrNone, err);
       
   331 
       
   332 	CleanupStack::PopAndDestroy(&connNET1);
       
   333 	CleanupStack::PopAndDestroy(&eSock);
       
   334 	
       
   335 	SetTestStepResult(EPass);
       
   336 	return TestStepResult();
       
   337 	}
       
   338 	
       
   339 TVerdict CDhcpTestStep1_8::doTestStepL()
       
   340 /**
       
   341 * @return - TVerdict code only ever returns EPass, else leaves with error!
       
   342 * Override of base class pure virtual
       
   343 * Check that the TCP/IP link local option is honoured if the DHCP server is unavailable.
       
   344 */
       
   345 	{
       
   346     #ifndef __DHCP_HEAP_CHECK_CONTROL
       
   347     	INFO_PRINTF1(_L("This test step is disabled for release build."));
       
   348         SetTestStepResult(EInconclusive);
       
   349 	    return TestStepResult();
       
   350     #else
       
   351 
       
   352 	SetTestStepResult(EFail);
       
   353 
       
   354 	TInt ipv4linklocal = 0;
       
   355 	
       
   356 	if( !UsingIPv6L() )
       
   357 		{
       
   358 		// Open the .ini file.
       
   359 		TAutoClose<RFs> fs;
       
   360 		User::LeaveIfError( fs.iObj.Connect() );
       
   361 		fs.PushL();
       
   362 		TAutoClose<RFile> file;
       
   363 		User::LeaveIfError( file.iObj.Open( fs.iObj, TCPIP_INI_PATH, EFileRead | EFileShareAny ) );
       
   364 		file.PushL();
       
   365 
       
   366 		// Read the contents of the file.
       
   367 		TInt size;
       
   368 		User::LeaveIfError( file.iObj.Size( size ) );
       
   369 		TAutoClose<RBuf8> buf;
       
   370 		buf.iObj.CreateL( size );
       
   371 		buf.PushL();
       
   372 		User::LeaveIfError( file.iObj.Read( buf.iObj ) );
       
   373 		
       
   374 		// Read the ipv4linklocal value if present.
       
   375 		TInt valPos = buf.iObj.Find( TCPIP_INI_IPV4LINKLOCAL );
       
   376 		if( valPos != KErrNotFound )
       
   377 			{
       
   378 			ipv4linklocal = buf.iObj[valPos + ( (const TDes8 &)TCPIP_INI_IPV4LINKLOCAL ).Length()] - '0'; // convert to integer by subtracting base of ASCII integer range
       
   379 			
       
   380 			// Check that the value is valid.
       
   381 			if( ( ipv4linklocal < 0 ) || ( ipv4linklocal > 3 ) )
       
   382 				{
       
   383 		    	INFO_PRINTF2(_L("Invalid ipv4linklocal option %d in tcpip.ini"), ipv4linklocal);
       
   384 		        
       
   385 		        SetTestStepResult(EInconclusive);
       
   386 			    
       
   387 			    return TestStepResult();
       
   388 				}
       
   389 			}
       
   390 			
       
   391 		buf.Pop();
       
   392 		file.Pop();
       
   393 		fs.Pop();
       
   394 		}
       
   395 		
       
   396 	// Check to see if the IP address is static.
       
   397 	bool isStatic = IsIAPAddrStaticL();
       
   398 	if( isStatic )
       
   399 		{
       
   400 		INFO_PRINTF1(_L("A static IP address has been configured."));
       
   401 		}
       
   402 	else
       
   403 		{
       
   404 		INFO_PRINTF1(_L("A static IP address has not been configured."));
       
   405 		}
       
   406 	
       
   407 	// Start DHCP server.
       
   408 	RStartProcess processStart;
       
   409 	TInt err = processStart.Start(KDHCPProcessName);
       
   410 	TESTEL( err == KErrNone || err ==KErrAlreadyExists, err);
       
   411 
       
   412 	// Connect to the server. We will use this connection to issue heap debug commands.
       
   413 	RTestDaemonClient debugSession;
       
   414 	debugSession.CreateSession();
       
   415 	CleanupClosePushL(debugSession);
       
   416 
       
   417 	RSocketServ eSock;
       
   418 	err = eSock.Connect();
       
   419 	TESTEL(err == KErrNone, err);
       
   420 	CleanupClosePushL(eSock);
       
   421 	
       
   422 	RConnection connNET1;
       
   423 	err = connNET1.Open(eSock);
       
   424 	TESTEL(err == KErrNone, err);
       
   425 	CleanupClosePushL(connNET1);
       
   426 	
       
   427 	RSocket socket;
       
   428 	CleanupClosePushL(socket);
       
   429 
       
   430 	TRequestStatus stat;
       
   431 	TUint curAddrTypesDHCPDiscoverFailed = KCurAddrNone;
       
   432 
       
   433 	// Check to see if configuration deamon controlled link locals are enabled or
       
   434 	// the address is static (must not try this test in other circumstances - the
       
   435 	// interface will not start without a valid initial address).
       
   436 	if( ( ipv4linklocal == 3 ) || isStatic )
       
   437 		{
       
   438 		INFO_PRINTF1(_L("Testing address types after failed DHCP initialisation..."));
       
   439 
       
   440 		// Set debug flags.
       
   441 		INFO_PRINTF1(_L("Setting debug option to simulate DHCP discovery failure..."));
       
   442 	    TDhcpMemDbgParamBuf dhcpMemDbgParamBuf;
       
   443 		dhcpMemDbgParamBuf() = KDHCP_FailDiscover;
       
   444 		debugSession.Ioctl(KCOLConfiguration, KDhcpMemDbgIoctl|KDHCP_DbgFlags, stat, &dhcpMemDbgParamBuf);
       
   445 		User::WaitForRequest(stat);
       
   446 		TESTEL(stat == KErrNone, stat.Int());
       
   447 
       
   448 		err = connNET1.Start(iConnPrefs); // see test script for IAP used
       
   449 		TESTEL(err == KErrNone, err);
       
   450 		
       
   451 		User::LeaveIfError( socket.Open( eSock, KAfInet, KSockDatagram, KProtocolInetUdp, connNET1 ) );
       
   452 		
       
   453 		// Check to see if a link local is configured after the DHCP initialisation
       
   454 		// process fails.
       
   455 		curAddrTypesDHCPDiscoverFailed = GetCurrentAddressTypesL( socket );
       
   456 
       
   457 		// Remove debug flags.
       
   458 		INFO_PRINTF1(_L("Clearing debug options."));
       
   459 		dhcpMemDbgParamBuf() = 0;
       
   460 		debugSession.Ioctl(KCOLConfiguration, KDhcpMemDbgIoctl|KDHCP_DbgFlags, stat, &dhcpMemDbgParamBuf);
       
   461 		User::WaitForRequest(stat);
       
   462 		TESTEL(stat == KErrNone, stat.Int());
       
   463 		
       
   464 		socket.Close();
       
   465 		connNET1.Stop();
       
   466 		}
       
   467 
       
   468 	// Restart the interface to remove any link local address.
       
   469 	err = connNET1.Start(iConnPrefs);
       
   470 	TESTEL(err == KErrNone, err);
       
   471 	User::LeaveIfError( socket.Open( eSock, KAfInet, KSockDatagram, KProtocolInetUdp, connNET1 ) );
       
   472 
       
   473 	// Check to see if DHCP has been enabled.
       
   474 	TConnectionAddrBuf address;
       
   475 	address().iAddressFamily = IpAddressFamilyL();
       
   476 	connNET1.Ioctl( KCOLConfiguration, KConnGetCurrentAddr, stat, &address );
       
   477 	User::WaitForRequest( stat );
       
   478 	TBool dhcpEnabledForIAP = stat.Int() != KErrNotSupported;
       
   479 	if( dhcpEnabledForIAP )
       
   480 		{
       
   481 		INFO_PRINTF1(_L("DHCP client is available."));
       
   482 
       
   483 		GetDebugHandleL(connNET1);
       
   484   		}
       
   485    	else
       
   486 		{
       
   487   		INFO_PRINTF1(_L("DHCP client is not available."));
       
   488    		}
       
   489 	
       
   490 	// Check to see if a link local is configured after the DHCP initialisation
       
   491 	// process succeeds.
       
   492 	INFO_PRINTF1(_L("Testing address types after successful DHCP initialisation..."));
       
   493 	TUint curAddrTypesDHCP = GetCurrentAddressTypesL( socket );
       
   494 	
       
   495 	TUint curAddrTypesDHCPReleased = KCurAddrNone;
       
   496 	TUint curAddrTypesDHCPRenewFailed = KCurAddrNone;
       
   497 	
       
   498 	if( dhcpEnabledForIAP && !isStatic )
       
   499 		{
       
   500 		// Read lease time
       
   501 		TConnectionLeaseInfoBuf remainingLease1, remainingLease2;
       
   502 		remainingLease2().iAddressFamily = IpAddressFamilyL();
       
   503 		connNET1.Ioctl(KCOLConfiguration, KConnGetAddrLeaseTimeRemain, stat, &remainingLease2);
       
   504 		User::WaitForRequest(stat);
       
   505 		
       
   506 		// Check to see if a lease time is supported or if the DHCPv6
       
   507 		// 'M' and 'O' flags are both false.
       
   508 		if( stat.Int() == KErrNone )
       
   509 			{
       
   510 			// Release the address and wait for the operation to finish.
       
   511 			connNET1.Ioctl( KCOLConfiguration, KConnAddrRelease, stat );
       
   512 			User::WaitForRequest(stat);
       
   513 			TESTEL(stat == KErrNone, stat.Int());
       
   514 			
       
   515 			// Check to see if a link local is configured after the address is released (there should not be).
       
   516 			INFO_PRINTF1(_L("Testing address types after DHCP release..."));
       
   517 			curAddrTypesDHCPReleased = GetCurrentAddressTypesL( socket );
       
   518 
       
   519 			// Set debug flags.
       
   520 			INFO_PRINTF1(_L("Setting debug option to ensure short lease for first renewal..."));
       
   521 		    TDhcpMemDbgParamBuf dhcpMemDbgParamBuf;
       
   522 			dhcpMemDbgParamBuf() = KDHCP_SetShortLease;
       
   523 			debugSession.Ioctl(KCOLConfiguration, KDhcpMemDbgIoctl|KDHCP_DbgFlags, stat, &dhcpMemDbgParamBuf);
       
   524 			User::WaitForRequest(stat);
       
   525 			TESTEL(stat == KErrNone, stat.Int());
       
   526 
       
   527 			// Renew and ensure the lease will be short
       
   528 			connNET1.Ioctl( KCOLConfiguration, KConnAddrRenew, stat );
       
   529 			User::WaitForRequest(stat);
       
   530 			TESTEL(stat == KErrNone, stat.Int());
       
   531 
       
   532 			// Set debug flags.
       
   533 			INFO_PRINTF1(_L("Setting debug option to simulate DHCP renewal failure after second renewal..."));
       
   534 			dhcpMemDbgParamBuf() = KDHCP_FailDiscover | KDHCP_FailRenew | KDHCP_FailRebind;
       
   535 			debugSession.Ioctl(KCOLConfiguration, KDhcpMemDbgIoctl|KDHCP_DbgFlags, stat, &dhcpMemDbgParamBuf);
       
   536 			User::WaitForRequest(stat);
       
   537 			TESTEL(stat == KErrNone, stat.Int());
       
   538 
       
   539 			// Read initial remaining lease time
       
   540 			remainingLease1().iAddressFamily = IpAddressFamilyL();
       
   541 			connNET1.Ioctl(KCOLConfiguration, KConnGetAddrLeaseTimeRemain, stat, &remainingLease1);
       
   542 			User::WaitForRequest(stat);
       
   543 			TESTEL(stat == KErrNone, stat.Int());
       
   544 		    INFO_PRINTF2(_L("Remaining lease time: %d secs"),remainingLease1().iSecondsRemaining);
       
   545 		    
       
   546 		    const TUint KInterval = 5 * 1000000;
       
   547 		    TUint timeToWait = KInterval;
       
   548 		    
       
   549 			// Start loop for reading lease time.
       
   550 			while( ETrue )
       
   551 				{
       
   552 				// Wait for 5 seconds to run down some of the lease or forever
       
   553 				// until a state change occurs if the lease has expired...
       
   554 				if( timeToWait == KMaxTUint32 )
       
   555 					{
       
   556 					DHCP_DEBUG_SUBSCRIBEL( DHCPDebug::EState + iDebugHandle );
       
   557 					}
       
   558 				else
       
   559 					{
       
   560 					timeToWait -= WAIT_FOR_STATE_CHANGE_WITH_TIMEOUTL( timeToWait );
       
   561 					}
       
   562 			
       
   563 				// Check to see if we should report another interval has elapsed.
       
   564 				if( timeToWait == 0 )
       
   565 					{
       
   566 					// Read lease time
       
   567 					remainingLease2().iAddressFamily = IpAddressFamilyL();
       
   568 					connNET1.Ioctl(KCOLConfiguration, KConnGetAddrLeaseTimeRemain, stat, &remainingLease2);
       
   569 					User::WaitForRequest(stat);
       
   570 					TESTEL(stat == KErrNone, stat.Int());
       
   571 
       
   572 					// Output the remaining lease time.
       
   573 				    INFO_PRINTF2(_L("Remaining lease time: %d secs"),remainingLease2().iSecondsRemaining);
       
   574 					timeToWait = KInterval;
       
   575 
       
   576 					if( remainingLease2().iSecondsRemaining <= 0 )
       
   577 						{
       
   578 						// The lease has expired.
       
   579 						timeToWait = KMaxTUint32;
       
   580 						}
       
   581 					}
       
   582 				
       
   583 				// Test is complete when renewal fails.
       
   584 				DHCPDebug::State state;
       
   585 				QUERY_STATEL( state );
       
   586 				if( ( state == DHCPDebug::EDHCPIPAddressAcquisition ) || ( state == DHCPDebug::EDHCPIP6Solicit ) || ( state == DHCPDebug::EDHCPIP4Select ) || ( state == DHCPDebug::EDHCPIP6Select ) )
       
   587 					{
       
   588 				    INFO_PRINTF2(_L("Renewal failed."),remainingLease2().iSecondsRemaining);
       
   589 					
       
   590 					break;
       
   591 					}
       
   592 				}
       
   593 
       
   594 			// Check to see if a link local is configured after the DHCP renewal
       
   595 			// process fails.
       
   596 			curAddrTypesDHCPRenewFailed = GetCurrentAddressTypesL( socket );
       
   597 
       
   598 			// Remove debug flags.
       
   599 			INFO_PRINTF1(_L("Clearing debug options."));
       
   600 			dhcpMemDbgParamBuf() = 0;
       
   601 			debugSession.Ioctl(KCOLConfiguration, KDhcpMemDbgIoctl|KDHCP_DbgFlags, stat, &dhcpMemDbgParamBuf);
       
   602 			User::WaitForRequest(stat);
       
   603 			TESTEL(stat == KErrNone, stat.Int());
       
   604 			}
       
   605 		else
       
   606 			{
       
   607 			if( stat.Int() != KErrNotReady )
       
   608 				{
       
   609 				User::Leave( stat.Int() );
       
   610 				}
       
   611 			}
       
   612 		}
       
   613 	
       
   614 	err = connNET1.Stop();
       
   615 	TESTEL(err == KErrNone, err);
       
   616 
       
   617 	CleanupStack::PopAndDestroy(&socket);
       
   618 	CleanupStack::PopAndDestroy(&connNET1);
       
   619 	CleanupStack::PopAndDestroy(&eSock);
       
   620 	
       
   621 	//Close DHCP debug session
       
   622 	CleanupStack::PopAndDestroy(&debugSession);
       
   623 	
       
   624 	// If the link local option is enabled, verify that a link local address
       
   625 	// is configured after the DHCP discovery process fails.
       
   626 	if( UsingIPv6L() )
       
   627 		{
       
   628 		SetTestStepResult(EPass);
       
   629 		}
       
   630 	else
       
   631 		{
       
   632 		switch( ipv4linklocal )
       
   633 			{
       
   634 			// EV4LLDisabled
       
   635 			case 0:
       
   636 				{
       
   637 	  	 		INFO_PRINTF1(_L("Link local option is set to EV4LLDisabled."));
       
   638 
       
   639 				// Link locals are always disabled - the TCP/IP stack should not create
       
   640 				// one for any test step.
       
   641 				if( !( curAddrTypesDHCPDiscoverFailed & KCurAddrIPv4LinkLocal ) &&
       
   642 					!( curAddrTypesDHCP & KCurAddrIPv4LinkLocal ) &&
       
   643 					!( curAddrTypesDHCPReleased & KCurAddrIPv4LinkLocal ) &&
       
   644 					!( curAddrTypesDHCPRenewFailed & KCurAddrIPv4LinkLocal ) )
       
   645 					{
       
   646 					SetTestStepResult(EPass);
       
   647 					}
       
   648 				else
       
   649 					{
       
   650 					INFO_PRINTF1(_L("Link local address management is incorrect."));
       
   651 			
       
   652 			        SetTestStepResult(EFail);
       
   653 					}
       
   654 				}
       
   655 			break;	
       
   656 
       
   657 			// EV4LLAlways
       
   658 			case 1:
       
   659 				{
       
   660 	  	 		INFO_PRINTF1(_L("Link local option is set to EV4LLAlways."));
       
   661 
       
   662 				// Link locals are always enabled - the TCP/IP stack should create
       
   663 				// one regardless of any assigned address.
       
   664 				if( isStatic )
       
   665 					{
       
   666 					if( ( curAddrTypesDHCPDiscoverFailed & KCurAddrIPv4LinkLocal ) &&
       
   667 						( curAddrTypesDHCP & KCurAddrIPv4LinkLocal ) )
       
   668 						{
       
   669 						SetTestStepResult(EPass);
       
   670 						}
       
   671 					else
       
   672 						{
       
   673 						INFO_PRINTF1(_L("Link local address management is incorrect."));
       
   674 			
       
   675 				        SetTestStepResult(EFail);
       
   676 						}
       
   677 					}
       
   678 				else
       
   679 					{
       
   680 					if( ( curAddrTypesDHCP & KCurAddrIPv4LinkLocal ) &&
       
   681 						( curAddrTypesDHCPReleased & KCurAddrIPv4LinkLocal ) &&
       
   682 						( curAddrTypesDHCPRenewFailed & KCurAddrIPv4LinkLocal ) )
       
   683 						{
       
   684 						SetTestStepResult(EPass);
       
   685 						}
       
   686 					else
       
   687 						{
       
   688 						INFO_PRINTF1(_L("Link local address management is incorrect."));
       
   689 			
       
   690 				        SetTestStepResult(EFail);
       
   691 						}
       
   692 					}
       
   693 				}
       
   694 			break;	
       
   695 
       
   696 			// EV4LLConditional
       
   697 			case 2:
       
   698 				{
       
   699 	  	 		INFO_PRINTF1(_L("Link local option is set to EV4LLConditional."));
       
   700 
       
   701 				// Link locals are conditional - the TCP/IP stack should create
       
   702 				// one if there is no statically assigned address.
       
   703 				if( isStatic )
       
   704 					{
       
   705 					if( !( curAddrTypesDHCPDiscoverFailed & KCurAddrIPv4LinkLocal ) &&
       
   706 						!( curAddrTypesDHCP & KCurAddrIPv4LinkLocal ) &&
       
   707 						!( curAddrTypesDHCPReleased & KCurAddrIPv4LinkLocal ) &&
       
   708 						!( curAddrTypesDHCPRenewFailed & KCurAddrIPv4LinkLocal ) )
       
   709 						{
       
   710 						SetTestStepResult(EPass);
       
   711 						}
       
   712 					else
       
   713 						{
       
   714 						INFO_PRINTF1(_L("Link local address management is incorrect."));
       
   715 			
       
   716 				        SetTestStepResult(EFail);
       
   717 						}
       
   718 					}
       
   719 				else
       
   720 					{
       
   721 					if( ( curAddrTypesDHCP & KCurAddrIPv4LinkLocal ) &&
       
   722 						( curAddrTypesDHCPReleased & KCurAddrIPv4LinkLocal ) &&
       
   723 						( curAddrTypesDHCPRenewFailed & KCurAddrIPv4LinkLocal ) )
       
   724 						{
       
   725 						SetTestStepResult(EPass);
       
   726 						}
       
   727 					else
       
   728 						{
       
   729 						INFO_PRINTF1(_L("Link local address management is incorrect."));
       
   730 			
       
   731 				        SetTestStepResult(EFail);
       
   732 						}
       
   733 					}
       
   734 				}
       
   735 			break;
       
   736 
       
   737 			// EV4LLConfigDaemonControlled
       
   738 			case 3:
       
   739 				{
       
   740 	  	 		INFO_PRINTF1(_L("Link local option is set to EV4LLConfigDaemonControlled."));
       
   741 
       
   742 				// Link locals are controlled by the configuration daemon -
       
   743 				// the TCP/IP stack should create one if no address was assigned
       
   744 				// by DHCP and there is no static address.
       
   745 				if( isStatic )
       
   746 					{
       
   747 					if( !( curAddrTypesDHCPDiscoverFailed & KCurAddrIPv4LinkLocal ) &&
       
   748 						!( curAddrTypesDHCP & KCurAddrIPv4LinkLocal ) &&
       
   749 						!( curAddrTypesDHCPReleased & KCurAddrIPv4LinkLocal ) &&
       
   750 						!( curAddrTypesDHCPRenewFailed & KCurAddrIPv4LinkLocal ) )
       
   751 						{
       
   752 						SetTestStepResult(EPass);
       
   753 						}
       
   754 					else
       
   755 						{
       
   756 						INFO_PRINTF1(_L("Link local address management is incorrect."));
       
   757 			
       
   758 				        SetTestStepResult(EFail);
       
   759 						}
       
   760 					}
       
   761 				else
       
   762 					{
       
   763 					if( ( curAddrTypesDHCPDiscoverFailed & KCurAddrIPv4LinkLocal ) &&
       
   764 						!( curAddrTypesDHCP & KCurAddrIPv4LinkLocal ) &&
       
   765 						!( curAddrTypesDHCPReleased & KCurAddrIPv4LinkLocal ) &&
       
   766 						( curAddrTypesDHCPRenewFailed & KCurAddrIPv4LinkLocal ) )
       
   767 						{
       
   768 						SetTestStepResult(EPass);
       
   769 						}
       
   770 					else
       
   771 						{
       
   772 						INFO_PRINTF1(_L("Link local address management is incorrect."));
       
   773 			
       
   774 				        SetTestStepResult(EFail);
       
   775 						}
       
   776 					}
       
   777 				}
       
   778 			break;
       
   779 			
       
   780 			default:
       
   781 				{
       
   782 				ASSERT( false ); // should never get here
       
   783 				}
       
   784 			break;
       
   785 			}
       
   786 		}
       
   787 
       
   788 	return TestStepResult();
       
   789 	
       
   790 	#endif // __DHCP_HEAP_CHECK_CONTROL
       
   791 	}