summaryrefslogtreecommitdiff
path: root/net/net.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-02-11 18:23:48 -0500
committerWolfgang Denk <wd@denx.de>2009-03-20 22:39:09 +0100
commit95823ca0773356860e622ee3304a4b7cafcbf19a (patch)
tree5e983fbf257efdff153278feff36e151a4cc45bf /net/net.c
parent500b6c51e4c41f4562cb48344af98deb7e342731 (diff)
downloadu-boot-imx-95823ca0773356860e622ee3304a4b7cafcbf19a.zip
u-boot-imx-95823ca0773356860e622ee3304a4b7cafcbf19a.tar.gz
u-boot-imx-95823ca0773356860e622ee3304a4b7cafcbf19a.tar.bz2
net: get mac address from environment and use eth util funcs
Signed-off-by: Mike Frysinger <vapier@gentoo.org> CC: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'net/net.c')
-rw-r--r--net/net.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/net/net.c b/net/net.c
index da3f4cd..a89f6a0 100644
--- a/net/net.c
+++ b/net/net.c
@@ -404,7 +404,7 @@ restart:
#ifdef CONFIG_NET_MULTI
memcpy (NetOurEther, eth_get_dev()->enetaddr, 6);
#else
- memcpy (NetOurEther, bd->bi_enetaddr, 6);
+ eth_getenv_enetaddr("ethaddr", NetOurEther);
#endif
NetState = NETLOOP_CONTINUE;
@@ -709,8 +709,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
}
#ifdef ET_DEBUG
- printf("sending UDP to %08lx/%02x:%02x:%02x:%02x:%02x:%02x\n",
- dest, ether[0], ether[1], ether[2], ether[3], ether[4], ether[5]);
+ printf("sending UDP to %08lx/%pM\n", dest, ether);
#endif
pkt = (uchar *)NetTxPacket;
@@ -931,11 +930,7 @@ int CDPSendTrigger(void)
#ifdef CONFIG_CDP_DEVICE_ID
*s++ = htons(CDP_DEVICE_ID_TLV);
*s++ = htons(CONFIG_CDP_DEVICE_ID);
- memset(buf, 0, sizeof(buf));
- sprintf(buf, CONFIG_CDP_DEVICE_ID_PREFIX "%02X%02X%02X%02X%02X%02X",
- NetOurEther[0] & 0xff, NetOurEther[1] & 0xff,
- NetOurEther[2] & 0xff, NetOurEther[3] & 0xff,
- NetOurEther[4] & 0xff, NetOurEther[5] & 0xff);
+ sprintf(buf, CONFIG_CDP_DEVICE_ID_PREFIX "%pm", NetOurEther);
memcpy((uchar *)s, buf, 16);
s += 16 / 2;
#endif
@@ -1335,10 +1330,8 @@ NetReceive(volatile uchar * inpkt, int len)
if (!NetArpWaitPacketIP || !NetArpWaitPacketMAC)
break;
#ifdef ET_DEBUG
- printf("Got ARP REPLY, set server/gtwy eth addr (%02x:%02x:%02x:%02x:%02x:%02x)\n",
- arp->ar_data[0], arp->ar_data[1],
- arp->ar_data[2], arp->ar_data[3],
- arp->ar_data[4], arp->ar_data[5]);
+ printf("Got ARP REPLY, set server/gtwy eth addr (%pM)\n",
+ arp->ar_data);
#endif
tmp = NetReadIP(&arp->ar_data[6]);