[En-Nut-Discussion] DHCP and four Ethernuts, IP conflict
Lars Andersson
laran at ikp.liu.se
Mon May 5 11:23:30 CEST 2003
I have had some problem getting the NUT DHCP to work properly with a Linux machine. Do you thing that the acceptance of the unicast UDP datagrams may solve this problem?
I plan to try to implement some random value alg. using the MAC and the timer for generating the xid. Is the xid parameter supposed to be unique for each device and then repeat this value each time or is it supposed to be unique for each request made?
Regards,
Lars Andersson
variable Regarding this xid
-----Original Message-----
From: Mgr. Pavel Chromy [mailto:chromy at asix.cz]
Sent: den 30 april 2003 11:32
To: Lars Andersson
Subject: Re[2]: [En-Nut-Discussion] DHCP and four Ethernuts, IP conflict
Wednesday, April 30, 2003, 11:13:23 AM Lars wrote:
> If I understand it correctly the xid variable will be assigned the value equal to the address where the nif struct is pointing to. In case I liked to generate some random value for xid, is this the
> place where this should be done?
That's right.
But it is not that easy to obtain a real random value, pseudorandom
common pseudorandom generator is not good for this task, especially
when several devices are powered from single power suply, in this case
taking system timer as initialization value for random generator may
also fail. Good solution is to use some kind of hash from mac address
or from combination of mac address and system timer.
Another aproach is to enable NutOS to receive unicast UDP datagrams
when IP is unconfigured, which would enable using unicast DHCP
(Linux dhcpd is using this by default).
This could be done in NutIpInpuit() in ipin.c
by changing this:
/*
* Silently discard datagrams for other destinations.
* However, if we haven't got an IP address yet, we
* allow ICMP datagrams to support dynamic IP ARP method.
*/
if (dst == 0 || dst != nif->if_local_ip) {
to:
if (dst == 0 || (dst!=nif->if_local_ip &&
(nif->if_local_ip || ip->ip_p!=IPPROTO_UDP || bcast))) {
Mgr. Pavel Chromy
ASIX s.r.o.
Staropramenna 4
150 00 Praha 5
_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo/en-nut-discussion
More information about the En-Nut-Discussion
mailing list