tcpdump mailing list archives
Re: [PATCH] SocketCAN support for libpcap -
From: Felix Obenhuber <felix () obenhuber de>
Date: Sun, 11 Oct 2009 11:27:18 +0200
On Sun, 2009-10-04 at 16:40 -0700, Guy Harris wrote:
3. The identification of the device index is quite a hack. I'm "parsing" the device name for an int before $. Any Ideas how to improve?That's what pcap-usb-linux.c does, so I'm not sure any improvement is needed, other than having having the format be "can%d" rather than "%s %d" - the string preceding the number will be "can".
Think instead of that stopgap solution, the usage of the ioctl SIOCGIFINDEX might be a better option. Thus I've added to static int can_activate(pcap_t* handle): /* get interface index */ memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name)); if ((handle->fd, SIOCGIFINDEX, &ifr) < 0) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Unable to get interface index: %s", pcap_strerror(errno)); pcap_cleanup_live_common(handle); return PCAP_ERROR; } handle->md.ifindex = ifr.ifr_ifindex; Felix - This is the tcpdump-workers list. Visit https://cod.sandelman.ca/ to unsubscribe.
Current thread:
- [PATCH] SocketCAN support for libpcap - draft implementation, (continued)
- [PATCH] SocketCAN support for libpcap - draft implementation Felix Obenhuber (Oct 03)
- [PATCH] SocketCAN support for libpcap - draft implementation Felix Obenhuber (Oct 04)
- Re: [PATCH] SocketCAN support for libpcap - draft implementation Guy Harris (Oct 04)
- Re: [PATCH] SocketCAN support for libpcap - Felix Obenhuber (Oct 05)
- Re: [PATCH] SocketCAN support for libpcap - Gianluca Varenni (Oct 05)
- Re: [PATCH] SocketCAN support for libpcap - Michael Richardson (Oct 05)
- Re: [PATCH] SocketCAN support for libpcap - Felix Obenhuber (Oct 06)
- Re: [PATCH] SocketCAN support for libpcap - Michael Richardson (Oct 06)
- Re: [PATCH] SocketCAN support for libpcap - draft implementation Guy Harris (Oct 04)
- Re: [PATCH] SocketCAN support for libpcap - draft implementation Gianluca Varenni (Oct 05)
- Re: [PATCH] SocketCAN support for libpcap - draft implementation Gianluca Varenni (Oct 05)
- Re: [PATCH] SocketCAN support for libpcap - Felix Obenhuber (Oct 11)
- Re: [PATCH] SocketCAN support for libpcap - draft implementation Felix Obenhuber (Oct 11)
- Re: [PATCH] SocketCAN support for libpcap - draft implementation Guy Harris (Oct 11)
- Re: [PATCH] SocketCAN support for libpcap - draft Alexander Dupuy (Oct 11)
- Re: [PATCH] SocketCAN support for libpcap - draft Felix Obenhuber (Oct 25)
- Re: [PATCH] SocketCAN support for libpcap - draft Guy Harris (Dec 07)
- Re: [PATCH] SocketCAN support for libpcap - draft Felix Obenhuber (Dec 07)
- Re: [PATCH] SocketCAN support for libpcap - draft Guy Harris (Dec 07)
- Re: [PATCH] SocketCAN support for libpcap - draft Felix Obenhuber (Dec 08)