From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com [209.85.128.175]) by dpdk.org (Postfix) with ESMTP id 55D7C7CD1 for ; Thu, 4 May 2017 19:08:32 +0200 (CEST) Received: by mail-wr0-f175.google.com with SMTP id w50so11385190wrc.0 for ; Thu, 04 May 2017 10:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=8JQ4qaT3ou5SR7bm34+OVQFM+nDaj+JaGjOnsGJFYVE=; b=ptHWaRp6G8KIiW1qHgglMreaXQR/KSKW02munu0UCu+tArQ9denbDxqgCnZzjASGvj kYxwBuSnaOaxBniTfOY0AB4ZS7+K7YDLWa4o7N8h0PLbMpwI7yftqIQJTdCSnWi6VYfv 8Lx1M5oHadk/Ki58J7dZVqu7VaiUKx5CzTjwOL56q7fDB21YvkqJ41rIzuNdu/DKSGFR uB3ewk31bd2+xEcLtPMDPTMnjWnCxDH6N2Vqrqg1nyUuYGENHM3+rQmLqf45S7N2Kxmd jefEeXOlmFJP1JEmavX1/64ZrS8ckRsNV3RDHVue0SXpC//tnLpH03TToOLphcqRR2FX BcNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=8JQ4qaT3ou5SR7bm34+OVQFM+nDaj+JaGjOnsGJFYVE=; b=ACmG+KO+342YwcRqbL4qNIGtk0rUHu1eIK8ULGBTXYPxIvbfhnthQ9uEDA5jtD93zJ JPrZonN1okSlA/euskP0IAKJnwVrPmix0i1StJI9iemtzYFki4Ft7WWBSYaB6oh5Dmtn JwNkUQxcUuP+HLeIJZ4efJ2zlSSkHFtO3qTNCxDWITOBJ79vjpnTKk7RgCC72K2qbZWw p62BcasWx0WqHENw91u0v64Q9XlEVEYxFPqT5n4WNmcNc8cycSnBVTfDcQd/t/2UQT8g wX8r8vXXInPKjPMICX/R9hnR+o6wrJMTVAD2vsn94TbzjIoqMqyP41r+WpS5xvga10a3 6E9Q== X-Gm-Message-State: AN3rC/7vEZjSoodaW9VCFkO/0HaS+9vL45YBomXshNugZvS0B3aL+S1j se2eQJTJTOneKR0ERZU= X-Received: by 10.223.173.74 with SMTP id p68mr27602164wrc.163.1493917711865; Thu, 04 May 2017 10:08:31 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id s81sm1845020wms.6.2017.05.04.10.08.31 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 04 May 2017 10:08:31 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Thu, 4 May 2017 19:08:23 +0200 Message-Id: <2f565661121fe816a097d41dd375cb7c44932cf4.1493917362.git.adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <76e59d59935ffccf9996c536866fcef64d6319b0.1493917362.git.adrien.mazarguil@6wind.com> References: <76e59d59935ffccf9996c536866fcef64d6319b0.1493917362.git.adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH 2/2] app/testpmd: fix MAC endian issue in flow command X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 17:08:32 -0000 MAC addresses are implicitly handled in network order since they are actually byte strings, however this is not properly enforced with MAC masks provided as prefix lengths, which end up inverted on little endian systems. Fixes: 6df81b325fa4 ("app/testpmd: add items eth/vlan to flow command") Signed-off-by: Adrien Mazarguil --- app/test-pmd/cmdline_flow.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index e952c91..0fd69f9 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -1057,13 +1057,13 @@ static const struct token token_list[] = { .name = "dst", .help = "destination MAC", .next = NEXT(item_eth, NEXT_ENTRY(MAC_ADDR), item_param), - .args = ARGS(ARGS_ENTRY(struct rte_flow_item_eth, dst)), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_eth, dst)), }, [ITEM_ETH_SRC] = { .name = "src", .help = "source MAC", .next = NEXT(item_eth, NEXT_ENTRY(MAC_ADDR), item_param), - .args = ARGS(ARGS_ENTRY(struct rte_flow_item_eth, src)), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_eth, src)), }, [ITEM_ETH_TYPE] = { .name = "type", @@ -2238,6 +2238,9 @@ parse_mac_addr(struct context *ctx, const struct token *token, /* Bit-mask fill is not supported. */ if (arg->mask || size != sizeof(tmp)) goto error; + /* Only network endian is supported. */ + if (!arg->hton) + goto error; ret = cmdline_parse_etheraddr(NULL, str, &tmp, size); if (ret < 0 || (unsigned int)ret != len) goto error; -- 2.1.4