version 1.1.2.3, 2013/06/24 14:43:00
|
version 1.1.2.5, 2013/06/24 14:48:04
|
Line 95 allocZCbuf(u_int len)
|
Line 95 allocZCbuf(u_int len)
|
* return: -1 error or >-1 bpf handle |
* return: -1 error or >-1 bpf handle |
*/ |
*/ |
int |
int |
io_etherOpen(const char *csIface, int flags, int whdr, u_int buflen, void **zcbuf) | io_etherOpen(const char *csIface, int flags, int whdr, u_int *buflen, void **zcbuf) |
{ |
{ |
int n = 1, eth = -1; |
int n = 1, eth = -1; |
register int i; |
register int i; |
Line 124 io_etherOpen(const char *csIface, int flags, int whdr,
|
Line 124 io_etherOpen(const char *csIface, int flags, int whdr,
|
close(eth); |
close(eth); |
return -1; |
return -1; |
} |
} |
if (buflen) { | if (buflen && *buflen) { |
if (!zcbuf) { |
if (!zcbuf) { |
if (ioctl(eth, BIOCSBLEN, &buflen) == -1) { | if (ioctl(eth, BIOCSBLEN, buflen) == -1) { |
LOGERR; |
LOGERR; |
close(eth); |
close(eth); |
return -1; |
return -1; |
Line 143 io_etherOpen(const char *csIface, int flags, int whdr,
|
Line 143 io_etherOpen(const char *csIface, int flags, int whdr,
|
LOGERR; |
LOGERR; |
close(eth); |
close(eth); |
return -1; |
return -1; |
} | } else |
if (!(*zcbuf = allocZCbuf(MIN(n, buflen)))) { | *buflen = MIN(n, *buflen); |
| if (!(*zcbuf = allocZCbuf(*buflen))) { |
close(eth); |
close(eth); |
return -1; |
return -1; |
} |
} |