On Fri 10 Jul 2009 12:27, Robin Getz pondered: > http://git.denx.de/?p=u-boot/u-boot-net.git;a=commitdiff;h=3c172c4fdbbb5 > 858fae38478d6399be4a16be3fc > > causes a regression on my network's DHCP server. > > The part of the diff that causes the problem: > > #if defined(CONFIG_CMD_DHCP) > > case DHCP: > - /* Start with a clean slate... */ > BootpTry = 0; > - NetOurIP = 0; > - NetServerIP = getenv_IPaddr ("serverip"); > DhcpRequest(); /* Basically same as > BOOTP */ > break; > > Since we are leaving the "NetOurIP" to whatever it was... The test at: > NetReceive(): > > case PROT_IP: > [snip] > tmp = NetReadIP(&ip->ip_dst); > if (NetOurIP && tmp != NetOurIP && tmp != 0xFFFFFFFF) { > #ifdef CONFIG_MCAST_TFTP > if (Mcast_addr != tmp) > #endif > return; > } > > Will return - (we leave the 'NetOurIP' set to the old value, the offered > > address (what is in tmp) is not our's and tmp is not 0xFFFFFFFF). > > You never process the DHCP_OFFER... > > There are multiple ways of fixing things - setting "NetOurIP = 0;" > (revert one line of the change, which may expose the bug that Michael > was trying to fix) or try to be more tricky in the "not our address" > check.... >
I did verify that reverting the line exposes the bug that Michael fixed, and so did this -- which seemed to work for my limited testing... Index: net/bootp.c =================================================================== --- net/bootp.c (revision 1961) +++ net/bootp.c (working copy) @@ -83,7 +83,7 @@ #endif -static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len) +int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len) { Bootp_t *bp = (Bootp_t *) pkt; int retval = 0; Index: net/net.c =================================================================== --- net/net.c (revision 1961) +++ net/net.c (working copy) @@ -1368,7 +1377,11 @@ return; } tmp = NetReadIP(&ip->ip_dst); - if (NetOurIP && tmp != NetOurIP && tmp != 0xFFFFFFFF) { + if (NetOurIP && tmp != NetOurIP && tmp != 0xFFFFFFFF && + BootpCheckPkt((uchar *)ip +IP_HDR_SIZE, + ntohs(ip->udp_dst), + ntohs(ip->udp_src), + ntohs(ip->udp_len) - 8)) { #ifdef CONFIG_MCAST_TFTP if (Mcast_addr != tmp) #endif _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot