X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=iprule.c;h=7cf7422f4168d8c33fdb051865f7fe4846d62487;hp=a31db9929ef79e9dd37e390a4b6b20f794a976a6;hb=86a0e7c5e6934206e2f5624e2f8d3c3c25bf25b4;hpb=d095bf24cf7879150d008c23998676bfedebbde6 diff --git a/iprule.c b/iprule.c index a31db99..7cf7422 100644 --- a/iprule.c +++ b/iprule.c @@ -15,7 +15,6 @@ #include #include #include -#include #include @@ -43,6 +42,7 @@ enum { RULE_LOOKUP, RULE_ACTION, RULE_GOTO, + RULE_SUP_PREFIXLEN, __RULE_MAX }; @@ -56,6 +56,7 @@ static const struct blobmsg_policy rule_attr[__RULE_MAX] = { [RULE_TOS] = { .name = "tos", .type = BLOBMSG_TYPE_INT32 }, [RULE_FWMARK] = { .name = "mark", .type = BLOBMSG_TYPE_STRING }, [RULE_LOOKUP] = { .name = "lookup", .type = BLOBMSG_TYPE_STRING }, + [RULE_SUP_PREFIXLEN] = { .name = "suppress_prefixlength", .type = BLOBMSG_TYPE_INT32 }, [RULE_ACTION] = { .name = "action", .type = BLOBMSG_TYPE_STRING }, [RULE_GOTO] = { .name = "goto", .type = BLOBMSG_TYPE_INT32 }, }; @@ -186,6 +187,11 @@ iprule_add(struct blob_attr *attr, bool v6) rule->flags |= IPRULE_LOOKUP; } + if ((cur = tb[RULE_SUP_PREFIXLEN]) != NULL) { + rule->sup_prefixlen = blobmsg_get_u32(cur); + rule->flags |= IPRULE_SUP_PREFIXLEN; + } + if ((cur = tb[RULE_ACTION]) != NULL) { if (!system_resolve_iprule_action(blobmsg_data(cur), &rule->action)) { DPRINTF("Failed to parse rule action: %s\n", (char *) blobmsg_data(cur)); @@ -234,7 +240,7 @@ rule_cmp(const void *k1, const void *k2, void *ptr) static void iprule_update_rule(struct vlist_tree *tree, - struct vlist_node *node_new, struct vlist_node *node_old) + struct vlist_node *node_new, struct vlist_node *node_old) { struct iprule *rule_old, *rule_new;