system_del_address(dev, a_old);
}
+ free(a_old->pclass);
free(a_old);
}
/* ipv6 only */
time_t valid_until;
time_t preferred_until;
+ char *pclass;
/* must be last */
enum device_addr_flags flags;
ADDR_PREFERRED,
ADDR_VALID,
ADDR_OFFLINK,
+ ADDR_CLASS,
__ADDR_MAX
};
[ADDR_PREFERRED] = { .name = "preferred", .type = BLOBMSG_TYPE_INT32 },
[ADDR_VALID] = { .name = "valid", .type = BLOBMSG_TYPE_INT32 },
[ADDR_OFFLINK] = { .name = "offlink", .type = BLOBMSG_TYPE_BOOL },
+ [ADDR_CLASS] = { .name = "class", .type = BLOBMSG_TYPE_STRING },
};
static struct device_addr *
else if (addr->preferred_until > addr->valid_until)
goto error;
}
+
+ if ((cur = tb[ADDR_CLASS]))
+ addr->pclass = strdup(blobmsg_get_string(cur));
}
return addr;
local preferred="$3"
local valid="$4"
local offlink="$5"
+ local class="$6"
- append PROTO_IP6ADDR "$address/$mask/$preferred/$valid/$offlink"
+ append PROTO_IP6ADDR "$address/$mask/$preferred/$valid/$offlink/$class"
}
proto_add_ipv4_route() {
valid="${str%%/*}"
str="${str#*/}"
offlink="${str%%/*}"
+ str="${str#*/}"
+ class="${str%%/*}"
json_add_object ""
json_add_string ipaddr "$address"
[ -n "$preferred" ] && json_add_int preferred "$preferred"
[ -n "$valid" ] && json_add_int valid "$valid"
[ -n "$offlink" ] && json_add_boolean offlink "$offlink"
+ [ -n "$class" ] && json_add_string class "$class"
json_close_object
}
if (addr->valid_until)
blobmsg_add_u32(&b, "valid", addr->valid_until - now);
+ if (addr->pclass)
+ blobmsg_add_string(&b, "class", addr->pclass);
+
blobmsg_close_table(&b, a);
}
}