* Added TODO about how to implement pcap_inject_haiku() - it's not used for

tcpdump, though.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37917 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-08-05 08:48:47 +00:00
parent 07ad8bb60e
commit e4e72487c2
1 changed files with 6 additions and 5 deletions

View File

@ -29,9 +29,8 @@
bool bool
prepare_request(struct ifreq& request, const char* name) prepare_request(struct ifreq& request, const char* name)
{ {
if (strlen(name) >= IF_NAMESIZE) { if (strlen(name) >= IF_NAMESIZE)
return false; return false;
}
strcpy(request.ifr_name, name); strcpy(request.ifr_name, name);
return true; return true;
@ -103,6 +102,8 @@ static int
pcap_inject_haiku(pcap_t *handle, const void *buffer, size_t size) pcap_inject_haiku(pcap_t *handle, const void *buffer, size_t size)
{ {
// we don't support injecting packets yet // we don't support injecting packets yet
// TODO: use the AF_LINK protocol (we need another socket for this) to
// inject the packets
strlcpy(handle->errbuf, "Sending packets isn't supported yet", strlcpy(handle->errbuf, "Sending packets isn't supported yet",
PCAP_ERRBUF_SIZE); PCAP_ERRBUF_SIZE);
return -1; return -1;
@ -322,8 +323,8 @@ pcap_platform_finddevs(pcap_if_t** _allDevices, char* errorBuffer)
pcap_add_if(_allDevices, interface->ifr_name, flags, NULL, errorBuffer); pcap_add_if(_allDevices, interface->ifr_name, flags, NULL, errorBuffer);
interface = (ifreq *)((addr_t)interface + IF_NAMESIZE interface = (ifreq*)((uint8*)interface
+ interface->ifr_addr.sa_len); + _SIZEOF_ADDR_IFREQ(interface[0]));
} }
free(buffer); free(buffer);