--- ansh/src/utils.c 2011/10/10 13:56:30 1.1.1.1.2.3 +++ ansh/src/utils.c 2011/10/10 14:15:40 1.1.1.1.2.4 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ - * $Id: utils.c,v 1.1.1.1.2.3 2011/10/10 13:56:30 misho Exp $ + * $Id: utils.c,v 1.1.1.1.2.4 2011/10/10 14:15:40 misho Exp $ * *************************************************************************/ #include "global.h" @@ -84,8 +84,10 @@ PrepareL2(const char *psDev, int *bpflen) return -1; } + /* n = fcntl(h, F_GETFL); fcntl(h, F_SETFL, n | O_NONBLOCK); + */ VERB(3) LOG("Openned device handle %d with bpf buflen %d", h, *bpflen); return h; @@ -354,7 +356,7 @@ pktRecv(int s, u_int * __restrict crypted, u_char * __ if (data) { memset(data, 0, *datlen); *datlen = ntohs(hdr->ansh_len) - sizeof(struct ansh_hdr); - memcpy(data, hdr + sizeof(struct ansh_hdr), *datlen); + memcpy(data, buf + bpf->bh_hdrlen + ETHER_HDR_LEN + sizeof(struct ansh_hdr), *datlen); } ret = (char) hdr->ansh_flg;