bug in ethernet dhcp.bas

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Post Reply
Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

bug in ethernet dhcp.bas

Post by Jerry Messina » Mon Jun 29, 2009 1:22 pm

just ran across a subtle bug in the dhcp.bas file. The file has

Code: Select all

Public Sub DHCPEnable()
   If smDHCPState = SM_DHCP_DISABLED Then
      AppConfig.Flags.bIsDHCPEnabled = 
      smDHCPState = SM_DHCP_GET_SOCKET
      DHCPBindCount = 0
      DHCPFlags.Bits.bIsBound = false
   EndIf
End Sub
The correct code should be

Code: Select all

Public Sub DHCPEnable()
   If smDHCPState = SM_DHCP_DISABLED Then
      AppConfig.Flags.bIsDHCPEnabled = true
      smDHCPState = SM_DHCP_GET_SOCKET
      DHCPBindCount = 0
      DHCPFlags.Bits.bIsBound = false
   EndIf
End Sub
notice the missing assignment to AppConfig.Flags.bIsDHCPEnabled in the first routine, causing the code to evaluate to

Code: Select all

AppConfig.Flags.bIsDHCPEnabled = smDHCPState = SM_DHCP_GET_SOCKET
which probably isn't what you want!

Post Reply