Ticket #2246: pcap.diff
File pcap.diff, 2.1 KB (added by , 16 years ago) |
---|
-
libpcap/pcap-haiku.cpp
250 250 extern "C" int 251 251 pcap_platform_finddevs(pcap_if_t** _allDevices, char* errorBuffer) 252 252 { 253 // If Haiku supports a Linux-like pseudo device, it should be 254 // added here. See pcap-linux.c for more info. 255 int flags; 256 253 257 // we need a socket to talk to the networking stack 254 258 int socket = ::socket(AF_INET, SOCK_DGRAM, 0); 255 259 if (socket < 0) { … … 290 294 } 291 295 292 296 ifreq *interface = (ifreq *)buffer; 293 pcap_if_t* last = NULL;294 297 295 298 for (uint32 i = 0; i < count; i++) { 296 pcap_if_t* pcapInterface = (pcap_if_t*)malloc(sizeof(pcap_if_t)); 297 if (pcapInterface == NULL) 298 continue; 299 flags = 0; 299 300 300 if (last == NULL)301 *_allDevices = pcapInterface;302 else303 last->next = pcapInterface;304 305 pcapInterface->next = NULL;306 pcapInterface->name = strdup(interface->ifr_name);307 pcapInterface->description = NULL;308 pcapInterface->addresses = NULL;309 pcapInterface->flags = 0;310 311 301 // get interface type 312 302 313 303 int linkSocket = ::socket(AF_LINK, SOCK_DGRAM, 0); … … 331 321 sockaddr_dl &link = *(sockaddr_dl *)&request.ifr_addr; 332 322 333 323 if (link.sdl_type == IFT_LOOP) 334 pcapInterface->flags = PCAP_IF_LOOPBACK;324 flags = IFF_LOOPBACK; 335 325 } 336 326 } 337 327 close(linkSocket); 338 328 } 339 329 330 pcap_add_if(_allDevices, interface->ifr_name, flags, NULL, errorBuffer); 331 340 332 interface = (ifreq *)((addr_t)interface + IF_NAMESIZE 341 333 + interface->ifr_addr.sa_len); 342 334 } -
config.h
192 192 /* #undef HAVE_PCAP_DUMP_FLUSH */ 193 193 194 194 /* Define to 1 if you have the `pcap_findalldevs' function. */ 195 /* #undef HAVE_PCAP_FINDALLDEVS */ 195 #define HAVE_PCAP_FINDALLDEVS 1 196 196 197 197 /* Define to 1 if the system has the type `pcap_if_t'. */ 198 /* #undef HAVE_PCAP_IF_T */ 198 #define HAVE_PCAP_IF_T 1 199 199 200 200 /* Define to 1 if you have the `pcap_lib_version' function. */ 201 201 /* #undef HAVE_PCAP_LIB_VERSION */