i've got a puzzling quesition about pcap-dlpi.c

In 0.5's pcap-dlpi.c:156, i see:

        if (getmsg(p->fd, &ctl, &data, &flags) < 0) {

And at line 126:

        static bpf_u_int32 ctlbuf[MAXDLBUF];
        static struct strbuf ctl = {
                MAXDLBUF,
                0,
                (char *)ctlbuf
        };

Now, according to man getmsg:
        ...
        int getmsg(int fildes, struct strbuf *ctlptr, struct  strbuf
                 *dataptr, int *flagsp);
        ...
        The fildes argument specifies a file descriptor  referencing
        an open stream.  The ctlptr and dataptr arguments each point
        to a strbuf structure, which contains the following members:

        int    maxlen;      /* maximum buffer length */
        int    len;         /* length of data */
        char   *buf;        /* ptr to buffer */
        ...

And in particular:

        The buf member points to a buffer into  which  the  data  or
        control  information  is to be placed, and the maxlen member
        indicates the maximum number of bytes this buffer can  hold.

Now, if i'm not mistaken, MAXDLBUF is  pcap-dlpi.c line 92:

        #define MAXDLBUF        8192

Shouldn't static struct strbuf be:

        static bpf_u_int32 ctlbuf[MAXDLBUF];
        static struct strbuf ctl = {
                        sizeof(ctlbuf),
                        0,
                        (char *)ctlbuf
        };

what am i missing?
And if i've got that right, shouldn't 153 be:

        data.maxlen = sizeof(ctlbuf);

(we'll that's not exactly right, i think this would be better)
        data.maxlen = p->bufsize;

mts.
-
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