summaryrefslogtreecommitdiffstats
path: root/lib/prefix.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2019-08-07 03:13:20 +0200
committerRenato Westphal <renato@opensourcerouting.org>2019-08-21 16:41:10 +0200
commitef231ac76ca6bf5dae1f6ab09a16c6f4e39b90af (patch)
treef7f60e706ac563e4f0eab74b947d41cdee897b4f /lib/prefix.c
parentlib: fix doc comment of the "cli_show_end" northbound callback (diff)
downloadfrr-ef231ac76ca6bf5dae1f6ab09a16c6f4e39b90af.tar.xz
frr-ef231ac76ca6bf5dae1f6ab09a16c6f4e39b90af.zip
lib: switch str2prefix_ipv4() to use inet_pton()
This is the second part of commit 8d92004979dc68, which converted only one of the two calls to inet_aton(). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/prefix.c')
-rw-r--r--lib/prefix.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/prefix.c b/lib/prefix.c
index 1a4a914e0..4780801bd 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -881,8 +881,10 @@ int str2prefix_ipv4(const char *str, struct prefix_ipv4 *p)
cp = XMALLOC(MTYPE_TMP, (pnt - str) + 1);
memcpy(cp, str, pnt - str);
*(cp + (pnt - str)) = '\0';
- ret = inet_aton(cp, &p->prefix);
+ ret = inet_pton(AF_INET, cp, &p->prefix);
XFREE(MTYPE_TMP, cp);
+ if (ret == 0)
+ return 0;
/* Get prefix length. */
plen = (uint8_t)atoi(++pnt);