1/* 2 * Copyright (c) 2011 Jakub Zawadzki 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 438 unchanged lines hidden (view full) --- 447int 448netfilter_platform_finddevs(pcap_if_t **alldevsp, char *err_str) 449{ 450 pcap_if_t *found_dev = *alldevsp; 451 int sock; 452 453 sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER); 454 if (sock < 0) { |
455 /* if netlink is not supported this is not fatal */ 456 if (errno == EAFNOSUPPORT || errno == EPROTONOSUPPORT) |
457 return 0; 458 snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't open netlink socket %d:%s", 459 errno, pcap_strerror(errno)); 460 return -1; 461 } 462 close(sock); 463 464 if (pcap_add_if(&found_dev, NFLOG_IFACE, 0, "Linux netfilter log (NFLOG) interface", err_str) < 0) 465 return -1; 466 return 0; 467} 468 |