From mboxrd@z Thu Jan 1 00:00:00 1970 From: Donald Sharp 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> To: netdev@vger.kernel.org Return-path: 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) 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) Sender: netdev-owner@vger.kernel.org List-ID: 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(); -- 2.14.3