From patchwork Sat Feb 17 12:47:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donald Sharp X-Patchwork-Id: 874747 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=cumulusnetworks.com header.i=@cumulusnetworks.com header.b="K0bIec6O"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zk8v64jjwz9s0v for ; Sat, 17 Feb 2018 23:48:18 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751150AbeBQMsQ (ORCPT ); Sat, 17 Feb 2018 07:48:16 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:35457 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751090AbeBQMsO (ORCPT ); Sat, 17 Feb 2018 07:48:14 -0500 Received: by mail-qt0-f196.google.com with SMTP id g14so7070399qti.2 for ; Sat, 17 Feb 2018 04:48:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cumulusnetworks.com; s=google; h=from:to:subject:date:message-id; bh=Vikj4y3wVQoDvAq12sea68Aq6QuwL8OeouN2weqar4I=; b=K0bIec6OvNFVGIQTV5sC2ZF2/Wp9Gbphq5mO8lfGR3Ilemtp6RxTi/Qynq5x9nBuGG sAKgsSB3WL1vm9ItTBCCOkaW/rSDYQrYq9862gXVmW8BsPKm3hiYLV/QGfjOLec1evzP PoB+xk2mdRxWXGBHJIVt2y0uWrdmW2PDs+uv8= 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; bh=Vikj4y3wVQoDvAq12sea68Aq6QuwL8OeouN2weqar4I=; b=eJDrqC7hAaBFdGZCC4tRUl38YEbu5JY/edrqDKkmzvtBvVj6YvlK0s3K4++kiaMKO6 moiLfK12KBGP4bLIN7ZCbjc145COxmeLOCnV/n1IcyPcQVz3Pxd+6I3S2MxqHJxzViDq cTj+N8Uz4KFnpBihieQrAWgnxjEfQEe9uwZmlmeR7cA1SCf62CxdatPh6211dL/BO4JG ibAnwadbz6+r0Kg3Xf3+jTpPrzsrh7koT7pwSbhTs4d7jHo7qLtPfbhtn446rvauWB2a oM2VmC4SzQAh1jdbFNxFGZvtp0V3hNwbU8XtrCVaRZaUK/yOFpzOrqnCkcvhqTEDAzUR 9tGA== X-Gm-Message-State: APf1xPBg3KisknwP15ymwIoq329FvjkwzPObkb+0XFDXjeAW1ej1Yncf zCUGR/yhi51WpFI4hIf9FjcsHkAa X-Google-Smtp-Source: AH8x225pY6yquaG+TZ3r0I7nR87QT2GZJIURHPDQeUFT/8JGTEyMHJI34psnhjSpYLFuhNEUK/rllQ== X-Received: by 10.237.58.133 with SMTP id o5mr14731370qte.307.1518871693644; Sat, 17 Feb 2018 04:48:13 -0800 (PST) Received: from robot.nc.rr.com (cpe-2606-A000-111D-803E-4980-482B-47BB-96B9.dyn6.twc.com. [2606:a000:111d:803e:4980:482b:47bb:96b9]) by smtp.googlemail.com with ESMTPSA id v1sm1450827qtg.43.2018.02.17.04.48.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Feb 2018 04:48:12 -0800 (PST) From: Donald Sharp To: netdev@vger.kernel.org Subject: [PATCH 3/3] ip: Allow rules to accept a specified protocol Date: Sat, 17 Feb 2018 07:47:53 -0500 Message-Id: <20180217124753.2879-4-sharpd@cumulusnetworks.com> X-Mailer: git-send-email 2.14.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Allow the specification of a protocol when the user adds/modifies/deletes a rule. Signed-off-by: Donald Sharp --- ip/iprule.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ip/iprule.c b/ip/iprule.c index 5703d6e4..8fc6ac48 100644 --- a/ip/iprule.c +++ b/ip/iprule.c @@ -324,6 +324,12 @@ static int iprule_modify(int cmd, int argc, char **argv) if (get_rt_realms(&realm, *argv)) invarg("invalid realms\n", *argv); addattr32(&req.n, sizeof(req), FRA_FLOW, realm); + } else if (matches(*argv, "protocol") == 0) { + __u32 proto; + NEXT_ARG(); + if (rtnl_rtprot_a2n(&proto, *argv)) + invarg("\"protocol\" value is invalid\n", *argv); + req.frh.proto = proto; } else if (matches(*argv, "table") == 0 || strcmp(*argv, "lookup") == 0) { NEXT_ARG();