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.git


The following commit(s) were added to refs/heads/master by this push:
     new 7dcbd235fc netdev:In netdev_default,If there is only one loopback 
network devices, it returns NULL
7dcbd235fc is described below

commit 7dcbd235fc691ce360d0177c39c5d35f1856568b
Author: wangchen <[email protected]>
AuthorDate: Thu Sep 19 10:42:54 2024 +0800

    netdev:In netdev_default,If there is only one loopback network devices, it 
returns NULL
    
    Referring to Linux,if there is only a loopback network device and the 
destination address does not belong to the loopback address, then the loopback 
network devices is not selected
    
    Signed-off-by: wangchen <[email protected]>
---
 net/netdev/netdev_default.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netdev/netdev_default.c b/net/netdev/netdev_default.c
index 6163197b40..a8454d07cd 100644
--- a/net/netdev/netdev_default.c
+++ b/net/netdev/netdev_default.c
@@ -75,9 +75,9 @@ FAR struct net_driver_s *netdev_default(void)
            * device).
            */
 
-          ret = dev;
           if (dev->d_lltype != NET_LL_LOOPBACK)
             {
+              ret = dev;
               break;
             }
         }

Reply via email to