From 8d92004979dc68a6fcfb2bb8ee32f374088490da Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Wed, 28 Nov 2018 12:15:09 +0100 Subject: [PATCH] lib: do not convert ip prefixes without '.' There are cases where the passed parameter for a vty command is either an interface name or an ip address. Because the interface name can be a number, and because the user may want to use a number to define an IP ( for instance 'ping 0' is valid from shell purpose), there is a choice that needs to be done at frr level. either from the application point of view, the interface name will be priorized, or each number will be considered as an ip address. In that commit, the inet_aton procedure is replaced with the inet_pton procedure that ignores ips with just a number. Signed-off-by: Philippe Guibert --- lib/prefix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/prefix.c b/lib/prefix.c index 21c3af7d49..858f860ee8 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -853,7 +853,7 @@ int str2prefix_ipv4(const char *str, struct prefix_ipv4 *p) /* String doesn't contail slash. */ if (pnt == NULL) { /* Convert string to prefix. */ - ret = inet_aton(str, &p->prefix); + ret = inet_pton(AF_INET, str, &p->prefix); if (ret == 0) return 0; -- 2.39.5