summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorchenyong <[email protected]>2019-04-27 17:27:27 +0800
committerchenyong <[email protected]>2019-04-28 00:53:58 +0800
commitc9bea68240cbc0fb9bc5823c928021333a603026 (patch)
tree54217664fff996b20256e7ce76ab250f791d0500 /components
parent2721e7189a0a07c7ac576c7015dfc2146246380e (diff)
[net][lwip] Fix open the netdev and the lwip component, ping command export error issue
Signed-off-by: chenyong <[email protected]>
Diffstat (limited to 'components')
-rw-r--r--components/net/lwip-1.4.1/src/apps/ping/ping.c4
-rw-r--r--components/net/lwip-2.0.2/src/apps/ping/ping.c4
-rw-r--r--components/net/lwip-2.1.0/src/apps/ping/ping.c4
-rw-r--r--components/net/sal_socket/src/sal_socket.c19
4 files changed, 16 insertions, 15 deletions
diff --git a/components/net/lwip-1.4.1/src/apps/ping/ping.c b/components/net/lwip-1.4.1/src/apps/ping/ping.c
index 1075e2ddfd..6d3cfe0fc3 100644
--- a/components/net/lwip-1.4.1/src/apps/ping/ping.c
+++ b/components/net/lwip-1.4.1/src/apps/ping/ping.c
@@ -130,7 +130,7 @@ int lwip_ping_recv(int s, int *ttl)
return len;
}
-#ifndef RT_USING_SAL
+#ifndef RT_USING_NETDEV
/* using the lwIP custom ping */
rt_err_t ping(char* target_name, rt_uint32_t times, rt_size_t size)
@@ -239,7 +239,7 @@ int cmd_ping(int argc, char **argv)
FINSH_FUNCTION_EXPORT_ALIAS(cmd_ping, __cmd_ping, ping network host);
#endif /* RT_USING_FINSH */
-#endif /* RT_USING_SAL */
+#endif /* RT_USING_NETDEV */
#endif /* RT_LWIP_ICMP */
diff --git a/components/net/lwip-2.0.2/src/apps/ping/ping.c b/components/net/lwip-2.0.2/src/apps/ping/ping.c
index 1075e2ddfd..6d3cfe0fc3 100644
--- a/components/net/lwip-2.0.2/src/apps/ping/ping.c
+++ b/components/net/lwip-2.0.2/src/apps/ping/ping.c
@@ -130,7 +130,7 @@ int lwip_ping_recv(int s, int *ttl)
return len;
}
-#ifndef RT_USING_SAL
+#ifndef RT_USING_NETDEV
/* using the lwIP custom ping */
rt_err_t ping(char* target_name, rt_uint32_t times, rt_size_t size)
@@ -239,7 +239,7 @@ int cmd_ping(int argc, char **argv)
FINSH_FUNCTION_EXPORT_ALIAS(cmd_ping, __cmd_ping, ping network host);
#endif /* RT_USING_FINSH */
-#endif /* RT_USING_SAL */
+#endif /* RT_USING_NETDEV */
#endif /* RT_LWIP_ICMP */
diff --git a/components/net/lwip-2.1.0/src/apps/ping/ping.c b/components/net/lwip-2.1.0/src/apps/ping/ping.c
index 1075e2ddfd..6d3cfe0fc3 100644
--- a/components/net/lwip-2.1.0/src/apps/ping/ping.c
+++ b/components/net/lwip-2.1.0/src/apps/ping/ping.c
@@ -130,7 +130,7 @@ int lwip_ping_recv(int s, int *ttl)
return len;
}
-#ifndef RT_USING_SAL
+#ifndef RT_USING_NETDEV
/* using the lwIP custom ping */
rt_err_t ping(char* target_name, rt_uint32_t times, rt_size_t size)
@@ -239,7 +239,7 @@ int cmd_ping(int argc, char **argv)
FINSH_FUNCTION_EXPORT_ALIAS(cmd_ping, __cmd_ping, ping network host);
#endif /* RT_USING_FINSH */
-#endif /* RT_USING_SAL */
+#endif /* RT_USING_NETDEV */
#endif /* RT_LWIP_ICMP */
diff --git a/components/net/sal_socket/src/sal_socket.c b/components/net/sal_socket/src/sal_socket.c
index 4117ab51e7..68e1375849 100644
--- a/components/net/sal_socket/src/sal_socket.c
+++ b/components/net/sal_socket/src/sal_socket.c
@@ -370,7 +370,7 @@ static int socket_init(int family, int type, int protocol, struct sal_socket **r
struct sal_proto_family *pf;
struct netdev *netdv_def = netdev_default;
struct netdev *netdev = RT_NULL;
- rt_bool_t falgs = RT_FALSE;
+ rt_bool_t flag = RT_FALSE;
if (family < 0 || family > AF_MAX)
{
@@ -388,23 +388,24 @@ static int socket_init(int family, int type, int protocol, struct sal_socket **r
sock->protocol = protocol;
/* get socket operations from network interface device */
- if (netdv_def && netdev_is_up(netdv_def))
+ if (netdv_def == RT_NULL)
+ {
+ LOG_E("not find default network interface device for socket create.");
+ return -3;
+ }
+
+ if (netdev_is_up(netdv_def))
{
/* check default network interface device protocol family */
pf = (struct sal_proto_family *) netdv_def->sal_user_data;
if (pf != RT_NULL && pf->skt_ops && (pf->family == family || pf->sec_family == family))
{
sock->netdev = netdv_def;
- falgs = RT_TRUE;
+ flag = RT_TRUE;
}
}
- else
- {
- LOG_E("not find default network interface device for socket create.");
- return -3;
- }
- if (falgs == RT_FALSE)
+ if (flag == RT_FALSE)
{
/* get network interface device by protocol family */
netdev = netdev_get_by_family(family);