summaryrefslogtreecommitdiff
path: root/lib/yang_wrappers.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2019-05-06 15:57:02 -0300
committerRenato Westphal <renato@opensourcerouting.org>2019-05-06 22:07:18 -0300
commit1b8de275c84f2bd079666364d899c243274dbf50 (patch)
treeb45075413b344b4f58c41daff1053a39c5dd0a57 /lib/yang_wrappers.c
parent95f092540e525aac639863743373b789fed0b3ec (diff)
lib, yang: disable libyang custom user types temporarily
libyang 1.0 introduced a few changes in the user types API, and these changes made FRR incompatible with libyang 1.x. In order to ease our migration from libyang 0.x to libyang 1.x, let's disable our libyang custom user types temporarily so that FRR can work with both libyang 0.x and libyang 1.x. This should be especially helpful to the CI systems during the transition. Once the migration to libyang 1.x is complete, this commit will be reverted. Disabling our libyang custom user types should have only minimal performance implications when processing configuration transactions. The user types infrastructure should be more important in the future to perform canonization of YANG data values when necessary. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/yang_wrappers.c')
-rw-r--r--lib/yang_wrappers.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/yang_wrappers.c b/lib/yang_wrappers.c
index 7ecea5f445..0558383823 100644
--- a/lib/yang_wrappers.c
+++ b/lib/yang_wrappers.c
@@ -817,7 +817,7 @@ void yang_dnode_get_ipv4(struct in_addr *addr, const struct lyd_node *dnode,
dleaf = (const struct lyd_node_leaf_list *)dnode;
assert(dleaf->value_type == LY_TYPE_STRING);
- memcpy(addr, dleaf->value.ptr, sizeof(*addr));
+ (void)inet_pton(AF_INET, dleaf->value_str, addr);
}
void yang_get_default_ipv4(struct in_addr *var, const char *xpath_fmt, ...)
@@ -874,7 +874,7 @@ void yang_dnode_get_ipv4p(union prefixptr prefix, const struct lyd_node *dnode,
dleaf = (const struct lyd_node_leaf_list *)dnode;
assert(dleaf->value_type == LY_TYPE_STRING);
- memcpy(prefix4, dleaf->value.ptr, sizeof(*prefix4));
+ (void)str2prefix_ipv4(dleaf->value_str, prefix4);
}
void yang_get_default_ipv4p(union prefixptr var, const char *xpath_fmt, ...)
@@ -927,7 +927,7 @@ void yang_dnode_get_ipv6(struct in6_addr *addr, const struct lyd_node *dnode,
dleaf = (const struct lyd_node_leaf_list *)dnode;
assert(dleaf->value_type == LY_TYPE_STRING);
- memcpy(addr, dleaf->value.ptr, sizeof(*addr));
+ (void)inet_pton(AF_INET6, dleaf->value_str, addr);
}
void yang_get_default_ipv6(struct in6_addr *var, const char *xpath_fmt, ...)
@@ -984,7 +984,7 @@ void yang_dnode_get_ipv6p(union prefixptr prefix, const struct lyd_node *dnode,
dleaf = (const struct lyd_node_leaf_list *)dnode;
assert(dleaf->value_type == LY_TYPE_STRING);
- memcpy(prefix6, dleaf->value.ptr, sizeof(*prefix6));
+ (void)str2prefix_ipv6(dleaf->value_str, prefix6);
}
void yang_get_default_ipv6p(union prefixptr var, const char *xpath_fmt, ...)