From: Peter Tyser <ptyser@xes-inc.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 06/30] net: get mac address from environment and use eth util funcs
Date: Tue, 17 Feb 2009 10:21:42 -0600 [thread overview]
Message-ID: <1234887702.5138.1222.camel@localhost.localdomain> (raw)
In-Reply-To: <1234847451-3210-7-git-send-email-vapier@gentoo.org>
On Tue, 2009-02-17 at 00:10 -0500, Mike Frysinger wrote:
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> CC: Ben Warren <biggerbadderben@gmail.com>
> ---
> net/bootp.c | 13 ++-----------
> net/net.c | 17 +++++------------
> 2 files changed, 7 insertions(+), 23 deletions(-)
>
> diff --git a/net/bootp.c b/net/bootp.c
> index d1cbd39..3dea70a 100644
> --- a/net/bootp.c
> +++ b/net/bootp.c
> @@ -573,21 +573,12 @@ BootpRequest (void)
> #ifdef CONFIG_BOOTP_RANDOM_DELAY /* Random BOOTP delay */
> unsigned char bi_enetaddr[6];
> int reg;
> - char *e,*s;
> - char tmp[64];
> ulong tst1, tst2, sum, m_mask, m_value = 0;
>
> if (BootpTry ==0) {
> /* get our mac */
> - reg = getenv_r ("ethaddr", tmp, sizeof(tmp));
> - s = (reg > 0) ? tmp : NULL;
> + eth_getenv_enetaddr("ethaddr", bi_enetaddr);
>
> - for (reg=0; reg<6; ++reg) {
> - bi_enetaddr[reg] = s ? simple_strtoul(s, &e, 16) : 0;
> - if (s) {
> - s = (*e) ? e+1 : e;
> - }
> - }
> #ifdef DEBUG
> puts ("BootpRequest => Our Mac: ");
> for (reg=0; reg<6; reg++) {
> diff --git a/net/net.c b/net/net.c
> index 9740f38..3fe5cb8 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -330,7 +330,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;
> @@ -693,8 +693,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;
> @@ -915,11 +914,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, "%pM", NetOurEther);
> memcpy((uchar *)s, buf, 16);
> s += 16 / 2;
It looks like CONFIG_CDP_DEVICE_ID_PREFIX was accidentally removed. The
formatting of "%pM" will also have ':'s where the original field did
not.
Awesome changes!
Best,
Peter
next prev parent reply other threads:[~2009-02-17 16:21 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-17 5:10 [U-Boot] [PATCH 00/30] standardize mac address handling in u-boot (v2) Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 01/30] vsprintf: pull updates from Linux kernel Mike Frysinger
2009-02-18 15:18 ` Jean-Christophe PLAGNIOL-VILLARD
2009-02-18 16:40 ` Mike Frysinger
2009-02-18 16:55 ` Jean-Christophe PLAGNIOL-VILLARD
2009-02-18 17:05 ` Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 02/30] convert print_IPaddr() to %pI4 Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 03/30] net: new utility functions for working with enetaddr's Mike Frysinger
2009-02-17 21:53 ` Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 04/30] doc/README.enetaddr: document proper MAC usage Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 05/30] Blackfin: bfin_mac: force boards to setup the MAC themselves Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 06/30] net: get mac address from environment and use eth util funcs Mike Frysinger
2009-02-17 16:21 ` Peter Tyser [this message]
2009-02-17 16:54 ` Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 07/30] bdinfo: get mac address from environment Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 08/30] bootvx: " Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 09/30] lynxkdi: " Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 10/30] nvedit: do not update global bi_enetaddr and do not call eth_set_enetaddr() Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 11/30] AmigaOneG3SE/enet: get mac address from environment Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 12/30] boards: " Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 13/30] drivers/net/: " Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 14/30] bcm570x: " Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 15/30] cs8900: " Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 16/30] sh_eth: " Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 17/30] lan91c96/smc91111/smc911x: " Mike Frysinger
2009-06-09 11:53 ` Wolfgang Denk
2009-06-10 0:30 ` Mike Frysinger
2009-07-13 21:58 ` Wolfgang Denk
2009-07-16 0:36 ` Mike Frysinger
2009-07-16 17:41 ` Ben Warren
2009-07-16 18:30 ` Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 18/30] cpu/: " Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 19/30] npe: " Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 20/30] lib_*/board.c: do not initialize bi_enet*addr in global data Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 21/30] nx823: get mac address from environment Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 22/30] arm: " Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 23/30] boards: move board_get_enetaddr() into board-specific init Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 24/30] cmc_pu2: get mac address from environment Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 25/30] pcs440ep: get mac address from environment and move load_sernum_ethaddr() to board init Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 26/30] kup4k/kup4x: rename load_sernum_ethaddr() to kup_load_sernum_ethaddr() Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 27/30] tqm8xx: rename load_sernum_ethaddr() to tqc_load_sernum_ethaddr() Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 28/30] ppc: mark global bi_enet*addr as legacy Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 29/30] drop now unused load_sernum_ethaddr() function Mike Frysinger
2009-02-17 5:10 ` [U-Boot] [PATCH 30/30] remove bi_enet*addr from global data for all arches Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1234887702.5138.1222.camel@localhost.localdomain \
--to=ptyser@xes-inc.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox