summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/bootp.c9
-rw-r--r--net/net.c7
2 files changed, 11 insertions, 5 deletions
diff --git a/net/bootp.c b/net/bootp.c
index b760b88..9eae34f 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -117,10 +117,15 @@ static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len)
*/
static void BootpCopyNetParams(Bootp_t *bp)
{
+ IPaddr_t tmp_ip;
+
NetCopyIP(&NetOurIP, &bp->bp_yiaddr);
- NetCopyIP(&NetServerIP, &bp->bp_siaddr);
+ NetCopyIP(&tmp_ip, &bp->bp_siaddr);
+ if (tmp_ip != 0)
+ NetCopyIP(&NetServerIP, &bp->bp_siaddr);
memcpy (NetServerEther, ((Ethernet_t *)NetRxPkt)->et_src, 6);
- copy_filename (BootFile, bp->bp_file, sizeof(BootFile));
+ if (strlen(bp->bp_file) > 0)
+ copy_filename (BootFile, bp->bp_file, sizeof(BootFile));
debug ("Bootfile: %s\n", BootFile);
diff --git a/net/net.c b/net/net.c
index 47c2007..907cd73 100644
--- a/net/net.c
+++ b/net/net.c
@@ -323,7 +323,7 @@ restart:
* IP addr assigned to us by the BOOTP / RARP server
*/
NetOurIP = 0;
- NetServerIP = 0;
+ NetServerIP = getenv_IPaddr ("serverip");
break;
default:
break;
@@ -354,7 +354,7 @@ restart:
case DHCP:
/* Start with a clean slate... */
NetOurIP = 0;
- NetServerIP = 0;
+ NetServerIP = getenv_IPaddr ("serverip");
DhcpRequest(); /* Basically same as BOOTP */
break;
#endif /* CFG_CMD_DHCP */
@@ -832,7 +832,8 @@ NetReceive(volatile uchar * pkt, int len)
printf("invalid RARP header\n");
} else {
NetCopyIP(&NetOurIP, &arp->ar_data[16]);
- NetCopyIP(&NetServerIP, &arp->ar_data[ 6]);
+ if (NetServerIP == 0)
+ NetCopyIP(&NetServerIP, &arp->ar_data[ 6]);
memcpy (NetServerEther, &arp->ar_data[ 0], 6);
(*packetHandler)(0,0,0,0);