From patchwork Tue Apr 21 22:02:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Hershberger X-Patchwork-Id: 463519 X-Patchwork-Delegate: trini@ti.com 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 91BF31402E5 for ; Wed, 22 Apr 2015 08:05:07 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3170CB37D7; Wed, 22 Apr 2015 00:05:03 +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 2oGrhcvqqafP; Wed, 22 Apr 2015 00:05:03 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CCC03B37C8; Wed, 22 Apr 2015 00:05:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9B282B37D8 for ; Wed, 22 Apr 2015 00:04:59 +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 aVK49sqKNRhU for ; Wed, 22 Apr 2015 00:04:59 +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 (skprod2.natinst.com [130.164.80.23]) by theia.denx.de (Postfix) with ESMTPS id 23B40B37B5 for ; Wed, 22 Apr 2015 00:04:57 +0200 (CEST) Received: from us-aus-mgwout2.amer.corp.natinst.com (nb-chan1-1338.natinst.com [130.164.19.134]) by us-aus-skprod2.natinst.com (8.15.0.59/8.15.0.59) with ESMTP id t3LM4sZK016607; Tue, 21 Apr 2015 17:04:54 -0500 Received: from linux-xvxi.natinst.com ([130.164.14.198]) by us-aus-mgwout2.amer.corp.natinst.com (Lotus Domino Release 8.5.3FP6) with ESMTP id 2015042117045469-104433 ; Tue, 21 Apr 2015 17:04:54 -0500 From: Joe Hershberger To: u-boot@lists.denx.de Date: Tue, 21 Apr 2015 17:02:49 -0500 Message-Id: <1429653771-11676-10-git-send-email-joe.hershberger@ni.com> X-Mailer: git-send-email 1.7.11.5 In-Reply-To: <1429653771-11676-1-git-send-email-joe.hershberger@ni.com> References: <1429653771-11676-1-git-send-email-joe.hershberger@ni.com> X-MIMETrack: Itemize by SMTP Server on US-AUS-MGWOut2/AUS/H/NIC(Release 8.5.3FP6|November 21, 2013) at 04/21/2015 05:04:54 PM, Serialize by Router on US-AUS-MGWOut2/AUS/H/NIC(Release 8.5.3FP6|November 21, 2013) at 04/21/2015 05:04:54 PM, Serialize complete at 04/21/2015 05:04:54 PM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2015-04-21_07:, , signatures=0 Cc: Tom Rini , Joe Hershberger Subject: [U-Boot] [PATCH 09/11] 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 --- include/env_flags.h | 11 ++++++++--- test/dm/eth.c | 1 + 2 files changed, 9 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..9b714a1 100644 --- a/test/dm/eth.c +++ b/test/dm/eth.c @@ -89,6 +89,7 @@ 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")); + setenv(".flags", "eth1addr"); setenv("eth1addr", NULL); /* Make sure that the default is to rotate to the next interface */