From patchwork Tue Apr 18 14:17:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Balogh X-Patchwork-Id: 751842 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w6nJw46Qxz9s0m for ; Wed, 19 Apr 2017 00:17:36 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.onmicrosoft.com header.i=@ericsson.onmicrosoft.com header.b="YKQlKHU5"; dkim-atps=neutral Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id DCDB0C11; Tue, 18 Apr 2017 14:17:33 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id EC6BEC01 for ; Tue, 18 Apr 2017 14:17:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sessmg22.ericsson.net (sessmg22.ericsson.net [193.180.251.58]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6877A124 for ; Tue, 18 Apr 2017 14:17:31 +0000 (UTC) X-AuditID: c1b4fb3a-7cfff70000005492-b6-58f61ff9a2aa Received: from ESESSHC021.ericsson.se (Unknown_Domain [153.88.183.81]) by (Symantec Mail Security) with SMTP id 67.FF.21650.9FF16F85; Tue, 18 Apr 2017 16:17:29 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.81) with Microsoft SMTP Server (TLS) id 14.3.339.0; Tue, 18 Apr 2017 16:17:28 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.onmicrosoft.com; s=selector1-ericsson-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LJewdn+44DbJwqtm+gVZslhy90x2w8hogJ07fgFaNVY=; b=YKQlKHU5CvJQVLC+FAuFe39Czzu0+Z6N+dtM+zlRgYbaVne4Gs/3QiW2ghTKN9KGog1PgbhmN5GN19I6vbLmZCqrXTr/PRu55y/mH5d4VshLFVMrU54WYl5aT23kvnb3K5fsn1EvfyU0PPE2wStwpV1+iom3Ih4O5azXUM5lytY= Received: from AM2PR07MB1042.eurprd07.prod.outlook.com (10.162.37.27) by AM2PR07MB1042.eurprd07.prod.outlook.com (10.162.37.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.6; Tue, 18 Apr 2017 14:17:28 +0000 Received: from AM2PR07MB1042.eurprd07.prod.outlook.com ([fe80::90cd:8ba4:2442:e4d]) by AM2PR07MB1042.eurprd07.prod.outlook.com ([fe80::90cd:8ba4:2442:e4d%15]) with mapi id 15.01.1047.006; Tue, 18 Apr 2017 14:17:28 +0000 From: =?iso-8859-1?Q?Zolt=E1n_Balogh?= To: "'dev@openvswitch.org'" Thread-Topic: [PATCH 07/10] match: Format match with packet_type (OFPHTN_ETHERTYPE,x) Thread-Index: AdK4TmT9arosGlFqSICE72BKLJHFgg== Date: Tue, 18 Apr 2017 14:17:27 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: openvswitch.org; dkim=none (message not signed) header.d=none;openvswitch.org; dmarc=none action=none header.from=ericsson.com; x-originating-ip: [91.82.100.59] x-microsoft-exchange-diagnostics: 1; AM2PR07MB1042; 7:M25IspvvyLyOPB2T32cPtuTrEDzG4uxEoy9GwopVrEXQnNzyyQRx8ZSBD0dPIP+WUv5y+vS7z2NUENouXqZWVqyIkJPhqlDHapkiX3LL6k7Lw8w3NoBxoPmdBbESO3aWg5K6r7K+uFcSfSorZGS2H6SzK1z9p0wHrXI/dCahSfbv5gUB7JlwnK7/h4WHRFfLwJmsA5tr5gZSzYb2/qURywqDxEiaePJW9lN7lbnzMDkMwnDBkCAHfdWp/9P7SEIYkWT7haVQdV69SBgtFWfRflqoSHVRZCUmcx3r8ClV2cWjYglmMi0xvjiIqH4X5OMNHcdqHrbXx4z9aw4nYZoUhQ== x-ld-processed: 92e84ceb-fbfd-47ab-be52-080c6b87953f,ExtAddr x-ms-office365-filtering-correlation-id: 63a685ee-3e17-4349-a769-08d48665a4de x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:AM2PR07MB1042; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(37575265505322); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123555025)(20161123562025)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(6072148); SRVR:AM2PR07MB1042; BCL:0; PCL:0; RULEID:; SRVR:AM2PR07MB1042; x-forefront-prvs: 028166BF91 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39400400002)(39410400002)(39850400002)(39840400002)(39450400003)(39860400002)(6916009)(81166006)(6506006)(86362001)(8676002)(7736002)(4326008)(6436002)(575784001)(66066001)(8936002)(7696004)(102836003)(33656002)(2906002)(3846002)(189998001)(53936002)(107886003)(3280700002)(110136004)(38730400002)(9686003)(25786009)(5660300001)(55016002)(50986999)(6116002)(74316002)(3660700001)(2900100001)(99286003)(305945005)(54356999)(491001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR07MB1042; H:AM2PR07MB1042.eurprd07.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2017 14:17:27.9995 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR07MB1042 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNIsWRmVeSWpSXmKPExsUyM2J7oO5P+W8RBmf7lC2Ont7D7MDo8ezm f8YAxigum5TUnMyy1CJ9uwSujOkHeApuG1Uc2nmdtYHxuEoXIyeHhICJxLObh9m6GLk4hATW M0rMvrQKyjnBKHH49UxGkCoWgV5miV9/ZSESU5gkFnUvZYRwHjJKbHrWxwZSxSbgLHF990sw W0TAUOLSpJOsIDazQIrEvcl7mUBsYYEgiR/PGpghasIlVu2YzAhh60nsuvaYHWKbqsTML1PA angFYiSWfVkNNodRQEzi+6k1TBAzxSVuPZnPBPGDgMSSPeeZIWxRiZeP/7GCHMcoMJtR4u/O FqgiBYlNC96zgyQkBHqYJZZN2AyVsJGY0T0dqttX4lXzSTaIon5GiX+zLrBCJLIlLu9dCNTA AWRbScw7EwsRvsgksXW7FIQtI7H55RJGiN77LBIz//1ghnhZSuLulU5GCFtG4sWdvdBg0ZO4 MXUK2wRGjVlIPpqFJAVha0ssW/iaeRY4NAQlTs58wrKAkWUVo2hxanFxbrqRkV5qUWZycXF+ nl5easkmRmCSOLjlt9UOxoPPHQ8xCnAwKvHwPpD+FiHEmlhWXJl7iFGCg1lJhHfdh68RQrwp iZVVqUX58UWlOanFhxilOViUxHkd9l2IEBJITyxJzU5NLUgtgskycXBKNTCqJE5d96dmGeva 8qZ8xvNLfj/K3igerFia5SzxZ/Vkn4+ydblLEm48bp0WtFpBc2ZC4+cVR1YduXFZl9U9WaX2 8rKT1Yysf5/O5b9kv++noVudi4eODeP7oqDFYjO+Ht6y46Lbyls7RTlOnX3ifGiNXdoX2Ut3 Ct/GPWY49+NzPFtE5v01nNzeSizFGYmGWsxFxYkA53i5yw4DAAA= X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 07/10] match: Format match with packet_type (OFPHTN_ETHERTYPE, x) X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Jan Scheurich Include the L3&L4 match fields in the match string also when there is no dl_type in the match, but the Ethertype encoded in the packet type. Signed-off-by: Jan Scheurich --- lib/match.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/lib/match.c b/lib/match.c index 4855c74..eddbc7d 100644 --- a/lib/match.c +++ b/lib/match.c @@ -1171,8 +1171,8 @@ match_format(const struct match *match, struct ds *s, int priority) size_t start_len = s->length; const struct flow *f = &match->flow; bool skip_type = false; - bool skip_proto = false; + ovs_be16 dl_type; int i; @@ -1267,11 +1267,15 @@ match_format(const struct match *match, struct ds *s, int priority) pt_ns_type(f->packet_type), pt_ns_type(wc->masks.packet_type)); } + if (pt_ns(f->packet_type) == OFPHTN_ETHERTYPE) { + dl_type = pt_ns_type_be(f->packet_type); + } } if (wc->masks.dl_type) { + dl_type = f->dl_type; skip_type = true; - if (f->dl_type == htons(ETH_TYPE_IP)) { + if (dl_type == htons(ETH_TYPE_IP)) { if (wc->masks.nw_proto) { skip_proto = true; if (f->nw_proto == IPPROTO_ICMP) { @@ -1291,7 +1295,7 @@ match_format(const struct match *match, struct ds *s, int priority) } else { ds_put_format(s, "%sip%s,", colors.value, colors.end); } - } else if (f->dl_type == htons(ETH_TYPE_IPV6)) { + } else if (dl_type == htons(ETH_TYPE_IPV6)) { if (wc->masks.nw_proto) { skip_proto = true; if (f->nw_proto == IPPROTO_ICMPV6) { @@ -1309,13 +1313,13 @@ match_format(const struct match *match, struct ds *s, int priority) } else { ds_put_format(s, "%sipv6%s,", colors.value, colors.end); } - } else if (f->dl_type == htons(ETH_TYPE_ARP)) { + } else if (dl_type == htons(ETH_TYPE_ARP)) { ds_put_format(s, "%sarp%s,", colors.value, colors.end); - } else if (f->dl_type == htons(ETH_TYPE_RARP)) { + } else if (dl_type == htons(ETH_TYPE_RARP)) { ds_put_format(s, "%srarp%s,", colors.value, colors.end); - } else if (f->dl_type == htons(ETH_TYPE_MPLS)) { + } else if (dl_type == htons(ETH_TYPE_MPLS)) { ds_put_format(s, "%smpls%s,", colors.value, colors.end); - } else if (f->dl_type == htons(ETH_TYPE_MPLS_MCAST)) { + } else if (dl_type == htons(ETH_TYPE_MPLS_MCAST)) { ds_put_format(s, "%smplsm%s,", colors.value, colors.end); } else { skip_type = false; @@ -1387,9 +1391,9 @@ match_format(const struct match *match, struct ds *s, int priority) if (!skip_type && wc->masks.dl_type) { ds_put_format(s, "%sdl_type=%s0x%04"PRIx16",", - colors.param, colors.end, ntohs(f->dl_type)); + colors.param, colors.end, ntohs(dl_type)); } - if (f->dl_type == htons(ETH_TYPE_IPV6)) { + if (dl_type == htons(ETH_TYPE_IPV6)) { format_ipv6_netmask(s, "ipv6_src", &f->ipv6_src, &wc->masks.ipv6_src); format_ipv6_netmask(s, "ipv6_dst", &f->ipv6_dst, &wc->masks.ipv6_dst); if (wc->masks.ipv6_label) { @@ -1403,8 +1407,8 @@ match_format(const struct match *match, struct ds *s, int priority) ntohl(wc->masks.ipv6_label)); } } - } else if (f->dl_type == htons(ETH_TYPE_ARP) || - f->dl_type == htons(ETH_TYPE_RARP)) { + } else if (dl_type == htons(ETH_TYPE_ARP) || + dl_type == htons(ETH_TYPE_RARP)) { format_ip_netmask(s, "arp_spa", f->nw_src, wc->masks.nw_src); format_ip_netmask(s, "arp_tpa", f->nw_dst, wc->masks.nw_dst); } else { @@ -1412,8 +1416,8 @@ match_format(const struct match *match, struct ds *s, int priority) format_ip_netmask(s, "nw_dst", f->nw_dst, wc->masks.nw_dst); } if (!skip_proto && wc->masks.nw_proto) { - if (f->dl_type == htons(ETH_TYPE_ARP) || - f->dl_type == htons(ETH_TYPE_RARP)) { + if (dl_type == htons(ETH_TYPE_ARP) || + dl_type == htons(ETH_TYPE_RARP)) { ds_put_format(s, "%sarp_op=%s%"PRIu8",", colors.param, colors.end, f->nw_proto); } else { @@ -1421,8 +1425,8 @@ match_format(const struct match *match, struct ds *s, int priority) colors.param, colors.end, f->nw_proto); } } - if (f->dl_type == htons(ETH_TYPE_ARP) || - f->dl_type == htons(ETH_TYPE_RARP)) { + if (dl_type == htons(ETH_TYPE_ARP) || + dl_type == htons(ETH_TYPE_RARP)) { format_eth_masked(s, "arp_sha", f->arp_sha, wc->masks.arp_sha); format_eth_masked(s, "arp_tha", f->arp_tha, wc->masks.arp_tha); } @@ -1475,15 +1479,15 @@ match_format(const struct match *match, struct ds *s, int priority) f->nw_frag & FLOW_NW_FRAG_LATER ? "later" : "not_later"); break; } - if (f->dl_type == htons(ETH_TYPE_IP) && + if (dl_type == htons(ETH_TYPE_IP) && f->nw_proto == IPPROTO_ICMP) { format_be16_masked(s, "icmp_type", f->tp_src, wc->masks.tp_src); format_be16_masked(s, "icmp_code", f->tp_dst, wc->masks.tp_dst); - } else if (f->dl_type == htons(ETH_TYPE_IP) && + } else if (dl_type == htons(ETH_TYPE_IP) && f->nw_proto == IPPROTO_IGMP) { format_be16_masked(s, "igmp_type", f->tp_src, wc->masks.tp_src); format_be16_masked(s, "igmp_code", f->tp_dst, wc->masks.tp_dst); - } else if (f->dl_type == htons(ETH_TYPE_IPV6) && + } else if (dl_type == htons(ETH_TYPE_IPV6) && f->nw_proto == IPPROTO_ICMPV6) { format_be16_masked(s, "icmp_type", f->tp_src, wc->masks.tp_src); format_be16_masked(s, "icmp_code", f->tp_dst, wc->masks.tp_dst);