addroute: inet_pton cannot accept slash notation. We must fixup the argument before calling.
This commit is contained in:
parent
80eba3aad1
commit
267aba6467
@ -151,6 +151,7 @@ int cmd_addroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
int shift;
|
||||
int sockfd;
|
||||
int ret;
|
||||
FAR char *sptr;
|
||||
|
||||
/* First, check if we are setting the default route */
|
||||
|
||||
@ -236,6 +237,17 @@ int cmd_addroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* We need to remove the slash notation before passing it to inet_pton */
|
||||
|
||||
if (shift > 0)
|
||||
{
|
||||
sptr = strchr(argv[1], '/');
|
||||
if (sptr != NULL)
|
||||
{
|
||||
*sptr = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert the target IP address string into its binary form */
|
||||
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
|
Loading…
Reference in New Issue
Block a user