This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new d594c953a net/vlan: fix issue of vlan pcp config
d594c953a is described below

commit d594c953a187c8164f8a98eb2c372f4d3f26ff5a
Author: gaohedong <[email protected]>
AuthorDate: Sun Jan 11 11:51:54 2026 +0800

    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 <[email protected]>
---
 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);

Reply via email to