From d594c953a187c8164f8a98eb2c372f4d3f26ff5a Mon Sep 17 00:00:00 2001 From: gaohedong Date: Sun, 11 Jan 2026 11:51:54 +0800 Subject: [PATCH] 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 --- netutils/netlib/netlib_addvlan.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/netutils/netlib/netlib_addvlan.c b/netutils/netlib/netlib_addvlan.c index 87cbcf712..db1369578 100644 --- a/netutils/netlib/netlib_addvlan.c +++ b/netutils/netlib/netlib_addvlan.c @@ -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);