Skip to contentSkip to conversation

ip: Allow rules to accept a specified protocol

PATCH In review Donald Sharp 1 participant 1 message Feb 17, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 ip: Allow rules to accept a specified protocol

Allow the specification of a protocol when the user adds/modifies/deletes a rule.

---
 ip/iprule.c | 6 ++++++
 1 file changed, 6 insertions(+)
ip/iprule.c +6 -0
index 5703d6e4..8fc6ac48 100644
@@ -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();
Signature · 1 line
2.14.3