[En-Nut-Discussion] Ethernut network configuration bug

Pavel Celeda ceba at vabo.cz
Fri Feb 27 11:40:07 CET 2004


This week I have discovered racecondition during setting up eth0 network
configuration. This bug affects both static eeprom and dhcp
configuration.

Nut/OS version 3.4.1.1 - CVS snapshot

Initial situation:

Ethernut I. board with static eeprom configuration. Device is UP and
runnig on the local network. 

PC1(Linux) ----> router ----> Ethernut I. (IP1)

ping IP1, everything works fine. Ping is running continually. 

1) static eeprom configuration

I change Ethernut's IP addres (IP1->IP2) via serial terminal and save it
to the eeprom - NutNetSaveConfig(). Now I press reset button and the
Ethernut starts with IP1 instead with IP2.

I use following procedure for configuring eth0 device. 

NutNetLoadConfig();
NutRegisterDevice();

... configuration racecondition in NutIpInput() ...

NutNetIfConfig();
NutIpRouteAdd();

ICMP datagrams are still comming from PC1. I have discovered that
NutIpInput() contains code which calls NutNetIfSetup() and this piece of
code kill my previous eeprom configuration (IP2->IP1 and discards rest
of network configuration). I known "That's not a bug, that's a feature"
used to setup IP address via dynamic IP ARP method. But I thing nowadays
when we can use dhcp for setting up network configuration this feature
should be by default disabled.

2) dhcp configuration

The same configuration (PC1, router, Ethernut). Ethernut will get IP
address from dhcp server (FreeBSD - ISC DHCPv3.0.1rc11) on the same
local network segment. Now I start ping IP1 and press reset on Ethernut
board. NetDhcpIfConfig fails and I can't obtain valid configuration from
dhcp server.

I patched the NutIpInput() and removed the code with NutNetIfSetup() and
now everything works fine.

with best regards
Pavel









More information about the En-Nut-Discussion mailing list