Deleted Added
full compact
30c30
< "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.110.2.6 2005/08/16 04:25:26 guy Exp $ (LBL)";
---
> "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.110.2.14 2006/10/12 17:26:58 guy Exp $ (LBL)";
396a397,401
> *
> * If we're in cooked mode, make the snapshot length
> * large enough to hold a "cooked mode" header plus
> * 1 byte of packet data (so we don't pass a byte
> * count of 0 to "recvfrom()").
397a403,406
> if (handle->md.cooked) {
> if (handle->snapshot < SLL_HDR_LEN + 1)
> handle->snapshot = SLL_HDR_LEN + 1;
> }
520a530,545
> * Unfortunately, there is a window between socket() and
> * bind() where the kernel may queue packets from any
> * interface. If we're bound to a particular interface,
> * discard packets not from that interface.
> *
> * (If socket filters are supported, we could do the
> * same thing we do when changing the filter; however,
> * that won't handle packet sockets without socket
> * filter support, and it's a bit more complicated.
> * It would save some instructions per packet, however.)
> */
> if (handle->md.ifindex != -1 &&
> from.sll_ifindex != handle->md.ifindex)
> return 0;
>
> /*
660c685
< "ioctl: %s", pcap_strerror(errno));
---
> "SIOCGSTAMP: %s", pcap_strerror(errno));
697a723,732
> *
> * We keep the count in "md.packets_read", and use that for
> * "ps_recv" if we can't get the statistics from the kernel.
> * We do that because, if we *can* get the statistics from
> * the kernel, we use "md.stat.ps_recv" and "md.stat.ps_drop"
> * as running counts, as reading the statistics from the
> * kernel resets the kernel statistics, and if we directly
> * increment "md.stat.ps_recv" here, that means it will
> * count packets *twice* on systems where we can get kernel
> * statistics - once here, and once in pcap_stats_linux().
699c734
< handle->md.stat.ps_recv++;
---
> handle->md.packets_read++;
772a808,824
> * On systems where the PACKET_STATISTICS "getsockopt()"
> * argument is supported on PF_PACKET sockets:
> *
> * "ps_recv" counts only packets that *passed* the
> * filter, not packets that didn't pass the filter.
> * This includes packets later dropped because we
> * ran out of buffer space.
> *
> * "ps_drop" counts packets dropped because we ran
> * out of buffer space. It doesn't count packets
> * dropped by the interface driver. It counts only
> * packets that passed the filter.
> *
> * Both statistics include packets not yet read from
> * the kernel by libpcap, and thus not yet seen by
> * the application.
> *
801a854,855
> *stats = handle->md.stat;
> return 0;
821,835d874
< * is supported on PF_PACKET sockets:
< *
< * "ps_recv" counts only packets that *passed* the filter,
< * not packets that didn't pass the filter. This includes
< * packets later dropped because we ran out of buffer space.
< *
< * "ps_drop" counts packets dropped because we ran out of
< * buffer space. It doesn't count packets dropped by the
< * interface driver. It counts only packets that passed
< * the filter.
< *
< * Both statistics include packets not yet read from the
< * kernel by libpcap, and thus not yet seen by the application.
< *
< * On systems where the PACKET_STATISTICS "getsockopt()" argument
846a886,890
> *
> * We maintain the count of packets processed by libpcap in
> * "md.packets_read", for reasons described in the comment
> * at the end of pcap_read_packet(). We have no idea how many
> * packets were dropped.
848c892,893
< *stats = handle->md.stat;
---
> stats->ps_recv = handle->md.packets_read;
> stats->ps_drop = 0;
919a965
> fcode.len = 0;
1317a1364,1373
> /* ARPHRD_LAPD is unofficial and randomly allocated, if reallocation
> * is needed, please report it to <daniele@orlandi.com> */
> #ifndef ARPHRD_LAPD
> #define ARPHRD_LAPD 8445
> #endif
> case ARPHRD_LAPD:
> /* Don't expect IP packet out of this interfaces... */
> handle->linktype = DLT_LINUX_LAPD;
> break;
>
1398a1455
> handle->linktype == DLT_LINUX_LAPD ||
1452c1509,1510
< if (handle->linktype != DLT_LINUX_IRDA)
---
> if (handle->linktype != DLT_LINUX_IRDA &&
> handle->linktype != DLT_LINUX_LAPD)
1560c1618
< "ioctl: %s", pcap_strerror(errno));
---
> "SIOCGIFINDEX: %s", pcap_strerror(errno));
1777c1835
< "ioctl: %s", pcap_strerror(errno));
---
> "SIOCGIFFLAGS: %s", pcap_strerror(errno));
1811c1869
< "ioctl: %s",
---
> "SIOCSIFFLAGS: %s",
1895c1953
< "ioctl: %s", pcap_strerror(errno));
---
> "SIOCGIFMTU: %s", pcap_strerror(errno));
1915c1973
< "ioctl: %s", pcap_strerror(errno));
---
> "SIOCGIFHWADDR: %s", pcap_strerror(errno));
2152,2153c2210,2216
< /* setsockopt() barfs unless it get a dummy parameter */
< int dummy;
---
> /*
> * setsockopt() barfs unless it get a dummy parameter.
> * valgrind whines unless the value is initialized,
> * as it has no idea that setsockopt() ignores its
> * parameter.
> */
> int dummy = 0;