Skip to content

Commit

Permalink
Make osdep rtap header usage transparent. (Fixes 39 out of 30 bytes e…
Browse files Browse the repository at this point in the history
…rror)

git-svn-id: http://svn.aircrack-ng.org/trunk@1038 28c6078b-6c39-48e3-add9-af49d547ecab
  • Loading branch information
Martin Beck committed May 2, 2008
1 parent 3d6fe57 commit 5fd577a
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/osdep/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ static int linux_write(struct wif *wi, unsigned char *buf, int count,
{
struct priv_linux *dev = wi_priv(wi);
unsigned char maddr[6];
int ret;
int ret, usedrtap=0;
unsigned char tmpbuf[4096];
unsigned char rate;

Expand Down Expand Up @@ -620,7 +620,7 @@ static int linux_write(struct wif *wi, unsigned char *buf, int count,
count += sizeof (u8aRadiotap);

buf = tmpbuf;

usedrtap = 1;
break;

case DT_WLANNG:
Expand Down Expand Up @@ -692,6 +692,22 @@ static int linux_write(struct wif *wi, unsigned char *buf, int count,
return( -1 );
}

if(usedrtap)
ret-=9;

if( ret < 0 )
{
if( errno == EAGAIN || errno == EWOULDBLOCK ||
errno == ENOBUFS || errno == ENOMEM )
{
usleep( 10000 );
return( 0 );
}

perror( "write failed" );
return( -1 );
}

return( ret );
}

Expand Down

0 comments on commit 5fd577a

Please sign in to comment.