Skip to content

Commit 61437ae

Browse files
committed
Fixups
1 parent 998b2e7 commit 61437ae

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/confd/src/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ int sr_plugin_init_cb(sr_session_ctx_t *session, void **priv)
269269
REGISTER_CHANGE(confd.session, "ietf-routing", "//.",
270270
SR_SUBSCR_CHANGE_ALL_MODULES, change_cb, &confd, &confd.sub);
271271

272-
REGISTER_CHANGE(confd.session, "ietf-hardware", "//",
272+
REGISTER_CHANGE(confd.session, "ietf-hardware", "//.",
273273
SR_SUBSCR_CHANGE_ALL_MODULES, change_cb, &confd, &confd.sub);
274274
REGISTER_CHANGE(confd.session, "infix-firewall", "//.",
275275
SR_SUBSCR_CHANGE_ALL_MODULES, change_cb, &confd, &confd.sub);

src/confd/src/ietf-routing.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,16 @@ static int parse_static_routes(sr_session_ctx_t *session, struct lyd_node *paren
247247
int ietf_routing_change(sr_session_ctx_t *session, struct lyd_node *config, struct lyd_node *diff, sr_event_t event, struct confd *confd)
248248
{
249249
int staticd_enabled = 0, ospfd_enabled = 0, bfdd_enabled = 0;
250+
struct lyd_node *cplane, *cplanes;
250251
bool ospfd_running, bfdd_running;
251-
struct lyd_node *cplane, *tmp;
252252
bool restart_zebra = false;
253253
int rc = SR_ERR_OK;
254254
FILE *fp;
255255

256-
if (!lydx_get_xpathf(diff, "/ietf-routing:routing/control-plane-protocols"))
256+
if (!lydx_get_xpathf(diff, "/ietf-routing:routing"))
257257
return SR_ERR_OK;
258258

259+
ERROR("Now setting up routing");
259260
switch (event) {
260261
case SR_EV_ENABLED: /* first time, on register. */
261262
case SR_EV_CHANGE: /* regular change (copy cand running) */
@@ -352,16 +353,15 @@ int ietf_routing_change(sr_session_ctx_t *session, struct lyd_node *config, stru
352353
return SR_ERR_OK;
353354
}
354355

355-
LY_LIST_FOR(lyd_child(config), tmp) {
356-
LY_LIST_FOR(lyd_child(tmp), cplane) {
357-
const char *type;
356+
cplanes = lydx_get_descendant(config, "routing", "control-plane-protocols", "control-plane-protocol", NULL);
357+
LYX_LIST_FOR_EACH(cplanes, cplane, "control-plane-protocol") {
358+
const char *type;
358359

359-
type = lydx_get_cattr(cplane, "type");
360-
if (!strcmp(type, "infix-routing:static")) {
361-
staticd_enabled = parse_static_routes(session, lydx_get_child(cplane, "static-routes"), fp);
362-
} else if (!strcmp(type, "infix-routing:ospfv2")) {
363-
parse_ospf(session, lydx_get_child(cplane, "ospf"));
364-
}
360+
type = lydx_get_cattr(cplane, "type");
361+
if (!strcmp(type, "infix-routing:static")) {
362+
staticd_enabled = parse_static_routes(session, lydx_get_child(cplane, "static-routes"), fp);
363+
} else if (!strcmp(type, "infix-routing:ospfv2")) {
364+
parse_ospf(session, lydx_get_child(cplane, "ospf"));
365365
}
366366
}
367367

0 commit comments

Comments
 (0)