RULE_GOTO,
RULE_SUP_PREFIXLEN,
RULE_UIDRANGE,
+ RULE_IPPROTO,
RULE_DISABLED,
__RULE_MAX
};
[RULE_UIDRANGE] = { .name = "uidrange", .type = BLOBMSG_TYPE_STRING },
[RULE_ACTION] = { .name = "action", .type = BLOBMSG_TYPE_STRING },
[RULE_GOTO] = { .name = "goto", .type = BLOBMSG_TYPE_INT32 },
+ [RULE_IPPROTO] = { .name = "ipproto", .type = BLOBMSG_TYPE_INT32 },
[RULE_DISABLED] = { .name = "disabled", .type = BLOBMSG_TYPE_BOOL },
};
rule->flags |= IPRULE_GOTO;
}
+ if ((cur = tb[RULE_IPPROTO]) != NULL) {
+ if ((rule->ipproto = blobmsg_get_u32(cur)) > 255) {
+ D(INTERFACE, "Invalid ipproto value: %u", blobmsg_get_u32(cur));
+ goto error;
+ }
+ rule->flags |= IPRULE_IPPROTO;
+ }
+
vlist_add(&iprules, &rule->node, rule);
return;
/* rule specifies uidrange */
IPRULE_UIDRANGE = (1 << 14),
+
+ /* rule specifies ipproto */
+ IPRULE_IPPROTO = (1 << 15),
};
struct iprule {
unsigned int uidrange_end;
unsigned int action;
unsigned int gotoid;
+ unsigned int ipproto;
};
extern struct vlist_tree iprules;
if (rule->flags & IPRULE_GOTO)
nla_put_u32(msg, FRA_GOTO, rule->gotoid);
+ if (rule->flags & IPRULE_IPPROTO)
+ nla_put_u32(msg, FRA_IP_PROTO, rule->ipproto);
+
return system_rtnl_call(msg);
}