mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 12:33:02 +02:00
statd: ignore parent interface for kind dsa
DSA ports such as pX has "link" (parent) set to dsaY. We don't see it that way from an networking perspective. In this commit we avoid adding parent to the statd data structure if the linkinfo -> info_kind is dsa. This means the ports shows up as regular interfaces, which is what we want. Signed-off-by: Richard Alpe <richard@bit42.se>
This commit is contained in:
committed by
Joachim Wiberg
parent
4a84ab95d0
commit
1654773bc6
@@ -228,6 +228,29 @@ static int ly_add_ip_link_br(const struct ly_ctx *ctx, struct lyd_node **parent,
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
static int ip_link_kind_is_dsa(json_t *j_iface)
|
||||
{
|
||||
json_t *j_linkinfo;
|
||||
json_t *j_val;
|
||||
|
||||
j_linkinfo = json_object_get(j_iface, "linkinfo");
|
||||
if (!j_linkinfo)
|
||||
return 0;
|
||||
|
||||
j_val = json_object_get(j_linkinfo, "info_kind");
|
||||
if (!j_val)
|
||||
return 0;
|
||||
|
||||
if (!json_is_string(j_val))
|
||||
return 0;
|
||||
|
||||
if (strcmp("dsa", json_string_value(j_val)) != 0)
|
||||
return 0;
|
||||
|
||||
/* This interface has linkinfo -> info_kind = "dsa" */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ly_add_ip_link_parent(const struct ly_ctx *ctx, struct lyd_node **parent,
|
||||
char *xpath, json_t *j_iface)
|
||||
{
|
||||
@@ -240,6 +263,11 @@ static int ly_add_ip_link_parent(const struct ly_ctx *ctx, struct lyd_node **par
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
if (ip_link_kind_is_dsa(j_iface)) {
|
||||
/* Skip adding parent interface data for dsa child */
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
if (!json_is_string(j_val)) {
|
||||
ERROR("Expected a JSON string for 'link'");
|
||||
return SR_ERR_SYS;
|
||||
|
||||
Reference in New Issue
Block a user