From patchwork Wed Apr 29 05:50:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Hershberger X-Patchwork-Id: 465891 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 71F0414032D for ; Wed, 29 Apr 2015 15:54:00 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3A5EE4BB69; Wed, 29 Apr 2015 07:53:46 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Qx0gDISMhW0f; Wed, 29 Apr 2015 07:53:46 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1C95B4BAFF; Wed, 29 Apr 2015 07:53:30 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 177D64BA80 for ; Wed, 29 Apr 2015 07:53:22 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K1EhCjkVIHXs for ; Wed, 29 Apr 2015 07:53:21 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from ni.com (skprod3.natinst.com [130.164.80.24]) by theia.denx.de (Postfix) with ESMTPS id A04C44BA79 for ; Wed, 29 Apr 2015 07:53:17 +0200 (CEST) Received: from us-aus-mgwout1.amer.corp.natinst.com (nb-chan1-1338.natinst.com [130.164.19.134]) by us-aus-skprod3.natinst.com (8.15.0.59/8.15.0.59) with ESMTP id t3T5rELQ004339; Wed, 29 Apr 2015 00:53:14 -0500 Received: from linux-xvxi.natinst.com ([130.164.14.198]) by us-aus-mgwout1.amer.corp.natinst.com (Lotus Domino Release 8.5.3FP6) with ESMTP id 2015042900531529-380894 ; Wed, 29 Apr 2015 00:53:15 -0500 From: Joe Hershberger To: u-boot@lists.denx.de Date: Wed, 29 Apr 2015 00:50:56 -0500 Message-Id: <1430286666-392-10-git-send-email-joe.hershberger@ni.com> X-Mailer: git-send-email 1.7.11.5 In-Reply-To: <1430286666-392-1-git-send-email-joe.hershberger@ni.com> References: <1429653771-11676-1-git-send-email-joe.hershberger@ni.com> <1430286666-392-1-git-send-email-joe.hershberger@ni.com> X-MIMETrack: Itemize by SMTP Server on US-AUS-MGWOut1/AUS/H/NIC(Release 8.5.3FP6|November 21, 2013) at 04/29/2015 12:53:15 AM, Serialize by Router on US-AUS-MGWOut1/AUS/H/NIC(Release 8.5.3FP6|November 21, 2013) at 04/29/2015 12:53:15 AM, Serialize complete at 04/29/2015 12:53:15 AM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2015-04-29_01:, , signatures=0 Cc: Tom Rini , Joe Hershberger Subject: [U-Boot] [PATCH v2 09/19] net: Apply default format rules to all ethaddr X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Use a regular expression to apply the default formatting flags for all ethaddr env vars. Signed-off-by: Joe Hershberger Reviewed-by: Simon Glass --- Changes in v2: -Added comments about the use of .flags in the dm eth test include/env_flags.h | 11 ++++++++--- test/dm/eth.c | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/env_flags.h b/include/env_flags.h index 3ef6311..fc6d0d8 100644 --- a/include/env_flags.h +++ b/include/env_flags.h @@ -38,13 +38,18 @@ enum env_flags_varaccess { #endif #ifdef CONFIG_CMD_NET +#ifdef CONFIG_REGEX +#define ETHADDR_WILDCARD "\\d?" +#else +#define ETHADDR_WILDCARD +#endif #ifdef CONFIG_ENV_OVERWRITE -#define ETHADDR_FLAGS "ethaddr:ma," +#define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:ma," #else #ifdef CONFIG_OVERWRITE_ETHADDR_ONCE -#define ETHADDR_FLAGS "ethaddr:mc," +#define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:mc," #else -#define ETHADDR_FLAGS "ethaddr:mo," +#define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:mo," #endif #endif #else diff --git a/test/dm/eth.c b/test/dm/eth.c index 4891f3a..0c173b4 100644 --- a/test/dm/eth.c +++ b/test/dm/eth.c @@ -89,6 +89,8 @@ static int dm_test_eth_rotate(struct dm_test_state *dms) /* Invalidate eth1's MAC address */ net_ping_ip = string_to_ip("1.1.2.2"); strcpy(ethaddr, getenv("eth1addr")); + /* Must disable access protection for eth1addr before clearing */ + setenv(".flags", "eth1addr"); setenv("eth1addr", NULL); /* Make sure that the default is to rotate to the next interface */ @@ -108,6 +110,7 @@ static int dm_test_eth_rotate(struct dm_test_state *dms) /* Invalidate eth0's MAC address */ strcpy(ethaddr, getenv("ethaddr")); + /* Must disable access protection for ethaddr before clearing */ setenv(".flags", "ethaddr"); setenv("ethaddr", NULL);