Просмотр исходного кода

NCDInterfaceMonitor: don't rely on interface flags provided from netlink; instead, query them
manually. Fixes an issue when a wireless device is pulled out and the device is reported to be down
and then again up, incorrectly.

ambrop7 15 лет назад
Родитель
Сommit
a93bfbaf07
1 измененных файлов с 1 добавлено и 11 удалено
  1. 1 11
      ncd/NCDInterfaceMonitor.c

+ 1 - 11
ncd/NCDInterfaceMonitor.c

@@ -84,16 +84,6 @@ void process_buffer (NCDInterfaceMonitor *o)
         }
         struct ifinfomsg *im = (void *)pl;
         
-        int report_flags = 0;
-        
-        if (o->buf_nh->nlmsg_type == RTM_NEWLINK) {
-            report_flags |= NCDIFCONFIG_FLAG_EXISTS;
-            
-            if ((im->ifi_flags&IFF_RUNNING)) {
-                report_flags |= NCDIFCONFIG_FLAG_RUNNING;
-            }
-        }
-        
         // parse attributes to get interface name
         
         char *ifname = NULL;
@@ -117,7 +107,7 @@ void process_buffer (NCDInterfaceMonitor *o)
         BPending_Set(&o->more_job);
         
         // dispatch event
-        o->handler(o->user, ifname, report_flags);
+        o->handler(o->user, ifname, NCDIfConfig_query(ifname));
         return;
     }