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 shift;
|
||||||
int sockfd;
|
int sockfd;
|
||||||
int ret;
|
int ret;
|
||||||
|
FAR char *sptr;
|
||||||
|
|
||||||
/* First, check if we are setting the default route */
|
/* 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;
|
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 */
|
/* Convert the target IP address string into its binary form */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user