weed out network interfaces that have no ip address
This commit is contained in:
		
							parent
							
								
									554e241136
								
							
						
					
					
						commit
						8716d916c7
					
				
							
								
								
									
										19
									
								
								src/sigar.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/sigar.c
									
									
									
									
									
								
							@ -845,6 +845,18 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
 | 
				
			|||||||
#  define MY_SIOCGIFCONF SIOCGIFCONF
 | 
					#  define MY_SIOCGIFCONF SIOCGIFCONF
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __osf__
 | 
				
			||||||
 | 
					static int sigar_netif_configured(sigar_t *sigar, char *name)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    int status;
 | 
				
			||||||
 | 
					    sigar_net_interface_config_t ifconfig;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    status = sigar_net_interface_config_get(sigar, name, &ifconfig);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return status == SIGAR_OK;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int sigar_net_interface_list_get(sigar_t *sigar,
 | 
					int sigar_net_interface_list_get(sigar_t *sigar,
 | 
				
			||||||
                                 sigar_net_interface_list_t *iflist)
 | 
					                                 sigar_net_interface_list_t *iflist)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -906,6 +918,13 @@ int sigar_net_interface_list_get(sigar_t *sigar,
 | 
				
			|||||||
             */
 | 
					             */
 | 
				
			||||||
            continue;
 | 
					            continue;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					#   ifdef __osf__
 | 
				
			||||||
 | 
					        /* weed out "sl0", "tun0" and the like */
 | 
				
			||||||
 | 
					        /* XXX must be a better way to check this */
 | 
				
			||||||
 | 
					        if (!sigar_netif_configured(sigar, ifr->ifr_name)) {
 | 
				
			||||||
 | 
					            continue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					#   endif        
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
        iflist->data[iflist->number++] = strdup(ifr->ifr_name);
 | 
					        iflist->data[iflist->number++] = strdup(ifr->ifr_name);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user