]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip: Allow rules to accept a specified protocol
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 28 Feb 2018 23:44:00 +0000 (18:44 -0500)
committerDavid Ahern <dsahern@gmail.com>
Thu, 1 Mar 2018 03:32:37 +0000 (19:32 -0800)
Allow the specification of a protocol when the user
adds/modifies/deletes a rule.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
ip/iprule.c

index 8120520e412564006ae6f4be37d1b919b0741426..6fdc9b5efa00fe606917a168f03d2540ed36efc9 100644 (file)
@@ -697,6 +697,13 @@ static int iprule_modify(int cmd, int argc, char **argv)
                        if (get_rt_realms_or_raw(&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);
+                       addattr8(&req.n, sizeof(req), FRA_PROTOCOL, proto);
                } else if (matches(*argv, "table") == 0 ||
                           strcmp(*argv, "lookup") == 0) {
                        NEXT_ARG();