mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
net/vlan: fix issue of vlan pcp config
Fix a issue of vlan pcp config. `vconfig add eth0 10` will create eth0.10 with VID=10 and no PCP(0) `vconfig add eth0 10 3` will create eth0.10 with VID=10 and PCP=3 Signed-off-by: gaohedong <gaohedong@xiaomi.com>
This commit is contained in:
parent
21f4156048
commit
d594c953a1
1 changed files with 5 additions and 3 deletions
|
|
@ -42,13 +42,14 @@
|
|||
* Parameters:
|
||||
* ifname - The name of the existing network device
|
||||
* vlanid - The VLAN identifier to be added
|
||||
* prio - The default VLAN priority (PCP)
|
||||
*
|
||||
* Return:
|
||||
* 0 on success; -1 on failure
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int netlib_add_vlan(FAR const char *ifname, int vlanid)
|
||||
int netlib_add_vlan(FAR const char *ifname, int vlanid, int prio)
|
||||
{
|
||||
int ret = ERROR;
|
||||
|
||||
|
|
@ -60,8 +61,9 @@ int netlib_add_vlan(FAR const char *ifname, int vlanid)
|
|||
struct vlan_ioctl_args ifv;
|
||||
|
||||
strlcpy(ifv.device1, ifname, sizeof(ifv.device1));
|
||||
ifv.u.VID = vlanid;
|
||||
ifv.cmd = ADD_VLAN_CMD;
|
||||
ifv.u.VID = vlanid;
|
||||
ifv.vlan_qos = prio;
|
||||
ifv.cmd = ADD_VLAN_CMD;
|
||||
|
||||
ret = ioctl(sockfd, SIOCSIFVLAN, &ifv);
|
||||
close(sockfd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue