You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/09/05 14:42:11 UTC
[GitHub] [incubator-nuttx-apps] anchao opened a new pull request, #1308: nshlib/netcmd: add sanity check for netdev
anchao opened a new pull request, #1308:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1308
## Summary
nshlib/netcmd: add sanity check for netdev
add sanity check for nsh_foreach_netdev() to avoid unnecessary messages being printed
Signed-off-by: chao an <an...@xiaomi.com>
## Impact
## Testing
enable CONFIG_NET_MLD, CONFIG_NET_STATISTICS
```
nsh> ls /proc/net
/proc/net:
stat
mld
tcp
route/
eth0
```
Before:
(The message of proc node mld is printed out by ifconfig)
```
nsh> ifconfig
Joins: 0000 Leaves: 0000
Sent Sched Sent
Queries: 0000 0000
Reports:
Ver 1: ---- 0000
Ver 2: 0000 0000
Done: 0000 0000
Received:
Queries:
Gen: 0000
MAS: 0000
MASS: 0000
Ucast: 0000
Bad: 0000
Reports:
Ver 1: 0000
Ver 2: 0000
Done: 0000
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 at RUNNING
inet addr:10.0.0.2 DRaddr:10.0.0.1 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64
inet6 DRaddr: ::/64
IPv4 IPv6 TCP UDP ICMP ICMPv6
Received 0000 0000 0000 0000 0000 0000
Dropped 0000 0000 0000 0000 0000 0000
IPv4 VHL: 0000 Frg: 0000
IPv6 VHL: 0000
Checksum 0000 ---- 0000 0000 ---- ----
TCP ACK: 0000 SYN: 0000
RST: 0000 0000
Type 0000 0000 ---- ---- 0000 0000
Sent 0000 000b 0000 0000 0000 000b
Rexmit ---- ---- 0000 ---- ---- ----
```
after:
```
nsh> ifconfig
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 at RUNNING
inet addr:10.0.0.2 DRaddr:10.0.0.1 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64
inet6 DRaddr: ::/64
IPv4 IPv6 TCP UDP ICMP ICMPv6
Received 0000 0000 0000 0000 0000 0000
Dropped 0000 0000 0000 0000 0000 0000
IPv4 VHL: 0000 Frg: 0000
IPv6 VHL: 0000
Checksum 0000 ---- 0000 0000 ---- ----
TCP ACK: 0000 SYN: 0000
RST: 0000 0000
Type 0000 0000 ---- ---- 0000 0000
Sent 0000 000b 0000 0000 0000 000b
Rexmit ---- ---- 0000 ---- ---- ----
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1308: nshlib/netcmd: add sanity check for netdev
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #1308:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1308#discussion_r962984576
##########
nshlib/nsh_netcmds.c:
##########
@@ -392,7 +393,7 @@ static int nsh_foreach_netdev(nsh_netdev_callback_t callback,
*/
if (entry->d_type == DTYPE_FILE &&
- strcmp(entry->d_name, "stat") != 0)
+ netlib_getmacaddr(entry->d_name, mac) >= 0)
Review Comment:
but not all device has mac address
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1308: nshlib/netcmd: add sanity check for netdev
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #1308:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1308#discussion_r962984576
##########
nshlib/nsh_netcmds.c:
##########
@@ -392,7 +393,7 @@ static int nsh_foreach_netdev(nsh_netdev_callback_t callback,
*/
if (entry->d_type == DTYPE_FILE &&
- strcmp(entry->d_name, "stat") != 0)
+ netlib_getmacaddr(entry->d_name, mac) >= 0)
Review Comment:
but not all device has mac address, it's better to check status
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #1308: nshlib/netcmd: add sanity check for netdev
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #1308:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1308
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx-apps] anchao commented on a diff in pull request #1308: nshlib/netcmd: add sanity check for netdev
Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #1308:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1308#discussion_r963626929
##########
nshlib/nsh_netcmds.c:
##########
@@ -392,7 +393,7 @@ static int nsh_foreach_netdev(nsh_netdev_callback_t callback,
*/
if (entry->d_type == DTYPE_FILE &&
- strcmp(entry->d_name, "stat") != 0)
+ netlib_getmacaddr(entry->d_name, mac) >= 0)
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org