On Sat, Oct 28, 2000 at 02:03:25PM +0900, Jun-ichiro itojun Hagino wrote:
>       with the current code, we have no way for pcap_compile_nopcap() to
>       get error return code.  the following patch (from netbsd) should allow
>       us to return error code.  any objections?

As per my other mail, doing so would mean we'd be synced up with NetBSD.

Unfortunately, were FreeBSD or OpenBSD to pick that up, they'd have to
change the *major* version number of libpcap.  I don't know whether
they'd be willing to do that.

(Having just checked in the change to make "pcap_compile_nopcap()" a
wrapper around "pcap_open_dead()" and "pcap_compile()", the change in
question would now just be

Index: gencode.c
===================================================================
RCS file: /tcpdump/master/libpcap/gencode.c,v
retrieving revision 1.137
diff -c -r1.137 gencode.c
*** gencode.c   2000/12/12 03:26:16     1.137
--- gencode.c   2000/12/12 03:34:29
***************
*** 339,345 ****
  int
  pcap_compile_nopcap(int snaplen_arg, int linktype_arg,
                    struct bpf_program *program,
!            char *buf, int optimize, bpf_u_int32 mask)
  {
        pcap_t *p;
        int ret;
--- 339,345 ----
  int
  pcap_compile_nopcap(int snaplen_arg, int linktype_arg,
                    struct bpf_program *program,
!            char *buf, int optimize, bpf_u_int32 mask, char *errbuf)
  {
        pcap_t *p;
        int ret;
***************
*** 348,353 ****
--- 348,355 ----
        if (p == NULL)
                return (-1);
        ret = pcap_compile(p, program, buf, optimize, mask);
+       if (ret < 0)
+               strlcpy(errbuf, pcap_geterr(p), PCAP_ERRBUF_SIZE);
        pcap_close(p);
        return (ret);
  }

plus the change to "pcap.h" to change the prototype.)
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe

Reply via email to