Skip to content

Commit d594c95

Browse files
HedongGaoxiaoxiang781216
authored andcommitted
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>
1 parent 21f4156 commit d594c95

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

netutils/netlib/netlib_addvlan.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@
4242
* Parameters:
4343
* ifname - The name of the existing network device
4444
* vlanid - The VLAN identifier to be added
45+
* prio - The default VLAN priority (PCP)
4546
*
4647
* Return:
4748
* 0 on success; -1 on failure
4849
*
4950
****************************************************************************/
5051

51-
int netlib_add_vlan(FAR const char *ifname, int vlanid)
52+
int netlib_add_vlan(FAR const char *ifname, int vlanid, int prio)
5253
{
5354
int ret = ERROR;
5455

@@ -60,8 +61,9 @@ int netlib_add_vlan(FAR const char *ifname, int vlanid)
6061
struct vlan_ioctl_args ifv;
6162

6263
strlcpy(ifv.device1, ifname, sizeof(ifv.device1));
63-
ifv.u.VID = vlanid;
64-
ifv.cmd = ADD_VLAN_CMD;
64+
ifv.u.VID = vlanid;
65+
ifv.vlan_qos = prio;
66+
ifv.cmd = ADD_VLAN_CMD;
6567

6668
ret = ioctl(sockfd, SIOCSIFVLAN, &ifv);
6769
close(sockfd);

0 commit comments

Comments
 (0)