Nichlite TCP stack DHCP bug

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Nichlite TCP stack DHCP bug

556 Views
TrevorCurry_in
Contributor I

I have been using the Nichlite TCP stack on a released product for several years now without any problems (due to the stack). The code may be missing some bug fixes reported here but I thought it would be worth reporting one I found recently.

 

The stack is used in a serial to Ethernet gateway that may be fitted in different instruments and our Quality department tried starting two at the same time. Occasionally, if the instruments were signaling the DHCP server at the same time, they ended up with the same IP address.

 

Examination of the dhc_rx_offer() function seems to reveal that it only checks the transaction ident (xid) and not the MAC address of the requesting client in the DHCP_OFFER packet. In my condition, both gateways were using the startup transaction ident (0x22334455) and therefore they both responded to the first DHCP OFFER.

 

Is this a new bug?

 

Cheers,

Trevor

Labels (1)
0 Kudos
2 Replies

310 Views
vier_kuifjes
Senior Contributor I

I'm not sure if this is to be considered a bug, but I assume the variable xids should be initialised by a random number instead of the fixed value 0x22334455.

 

This was never a problem to me, but after reading your post I made a modification that writes the 4 lower bytes of the MAC address of the network port over the value in xids. This should at least result in a different initial value of xids on every board.

0 Kudos

310 Views
TrevorCurry_in
Contributor I

That was not seen as ideal for us since customers tend to buy several modules and may end up with consecutive MAC addresses. A *much* smaller window for the bug but with a 100% fix available, we went that way...

 

It was simple to fetch the DHCP_OFFER MAC address from the bp structure and compare it with the local value.

 

Cheers,

Trevor

0 Kudos