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 <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2018-11-28 12:15:09 +01:00
parent 6c241117f8
commit 8d92004979

View File

@ -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;