zhhyu7 opened a new pull request, #4163:
URL: https://github.com/apache/nuttx-apps/pull/4163
## Summary
netlib_add_vlan() filled in only three fields of struct vlan_ioctl_args and
left rx_type and rx_priority with whatever the stack held. vlan_register()
refuses an rx_type above NETDEV_RX_DEFAULT, so "vconfig add eth0 10" failed
with EINVAL whenever the garbage value happened to be out of range: creating a
VLAN device from nsh did not work.
Pass both fields in, defaulting rx_type to NETDEV_RX_DEFAULT so the child
inherits the RX mode of the real device, and let vconfig override them.
netlib_add_vlan() takes two more arguments; nshlib is its only caller.
## Impact
nsh:vconfig
netutils/netlib/netlib_addvlan.c
nshlib/nsh_command.c
nshlib/nsh_netcmds.c
## Testing
before:
```
nsh> vconfig add eth0 10
Failed to add VLAN: Invalid argument
nsh> ifconfig
eth0 ... RUNNING
lo ... RUNNING
<- 没有 eth0.10
nsh> vconfig rem eth0.10
Failed to remove VLAN: No such device
```
with this patch
```
nsh> vconfig add eth0 10
nsh> ifconfig
eth0 Link encap:Ethernet HWaddr 42:f1:a6:1f:20:95 at RUNNING mtu 1500
lo Link encap:Local Loopback at RUNNING mtu 1518
eth0.10 Link encap:Ethernet HWaddr 42:f1:a6:1f:20:95 at DOWN mtu 1500
nsh> vconfig rem eth0.10
nsh> vconfig add eth0 -> nsh: vconfig: missing required
argument(s)
nsh> echo SURVIVED_SHORT_FORM -> SURVIVED_SHORT_FORM (不再崩溃)
nsh> vconfig add eth0 10 -> ok, eth0.10 created
nsh> vconfig add eth0 20 3 -> ok, eth0.20 created
nsh> vconfig add eth0 30 3 1 -> Failed to add VLAN: Out of memory
(NET_VLAN_COUNT=2 已满,预期行为)
nsh> echo ALIVE_AT_END -> ALIVE_AT_END
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]