You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2022/09/08 09:09:48 UTC

[incubator-nuttx] branch master updated: net/procfs: interface index should begin from 1

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

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


The following commit(s) were added to refs/heads/master by this push:
     new b6e76966b9 net/procfs: interface index should begin from 1
b6e76966b9 is described below

commit b6e76966b9562ee76ba18c182c6b1a77fc7e3a6d
Author: chao an <an...@xiaomi.com>
AuthorDate: Thu Sep 8 14:50:11 2022 +0800

    net/procfs: interface index should begin from 1
    
    Signed-off-by: chao an <an...@xiaomi.com>
---
 net/procfs/net_procfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/procfs/net_procfs.c b/net/procfs/net_procfs.c
index 6a174c6ac7..0e8f3f7d98 100644
--- a/net/procfs/net_procfs.c
+++ b/net/procfs/net_procfs.c
@@ -535,9 +535,11 @@ static int netprocfs_readdir(FAR struct fs_dirent_s *dir,
 
           level1->ifindex = ifindex + 1;
 #else
-          /* Get the raw index */
+          /* Get the raw index, (why +2 ? The ifindex should remove device
+           * entry of last g_net_entries(-1) and start the devidx from 1)
+           */
 
-          ifindex = index - ARRAY_SIZE(g_net_entries) + 1;
+          ifindex = index + 2 - ARRAY_SIZE(g_net_entries);
 #endif
           /* Find the device corresponding to this device index */