--- libaitio/src/bpf.c 2013/06/25 08:53:22 1.1.2.8 +++ libaitio/src/bpf.c 2013/06/25 09:29:34 1.1.2.10 @@ -163,6 +163,7 @@ io_etherOpen(const char *csIface, int flags, int whdr, io_etherClose(eth, zcbuf); return -1; } + memset(&ifr, 0, sizeof ifr); strlcpy(ifr.ifr_name, szStr, sizeof ifr.ifr_name); if (ioctl(eth, BIOCSETIF, &ifr) == -1) { LOGERR; @@ -226,7 +227,8 @@ nextZCbuf(void ** __restrict zcache, struct bpf_zbuf * if (buf) buf = ((caddr_t) *zcache) + sizeof(struct bpf_zbuf_header); ackZCbuf(bzh); - } + } else + io_SetErr(EAGAIN, "kernel owns the buffer"); } else if (*zcache == zbuf->bz_bufa) { bzh = (struct bpf_zbuf_header *) zbuf->bz_bufb; if (chkZCbuf(bzh)) { @@ -235,7 +237,8 @@ nextZCbuf(void ** __restrict zcache, struct bpf_zbuf * if (buf) buf = ((caddr_t) *zcache) + sizeof(struct bpf_zbuf_header); ackZCbuf(bzh); - } + } else + io_SetErr(EAGAIN, "kernel owns the buffer"); } return rlen;