149 |
struct tapif *tapif; |
struct tapif *tapif; |
150 |
|
|
151 |
tapif = netif->state; |
tapif = netif->state; |
152 |
|
#if 0 |
153 |
|
if(((double)rand()/(double)RAND_MAX) < 0.2) { |
154 |
|
printf("drop output\n"); |
155 |
|
return ERR_OK; |
156 |
|
} |
157 |
|
#endif |
158 |
/* initiate transfer(); */ |
/* initiate transfer(); */ |
159 |
|
|
160 |
bufptr = &buf[0]; |
bufptr = &buf[0]; |
194 |
/* Obtain the size of the packet and put it into the "len" |
/* Obtain the size of the packet and put it into the "len" |
195 |
variable. */ |
variable. */ |
196 |
len = read(tapif->fd, buf, sizeof(buf)); |
len = read(tapif->fd, buf, sizeof(buf)); |
197 |
|
#if 0 |
198 |
/* if(((double)rand()/(double)RAND_MAX) < 0.1) { |
if(((double)rand()/(double)RAND_MAX) < 0.2) { |
199 |
printf("drop\n"); |
printf("drop\n"); |
200 |
return NULL; |
return NULL; |
201 |
}*/ |
} |
202 |
|
#endif |
203 |
|
|
204 |
/* We allocate a pbuf chain of pbufs from the pool. */ |
/* We allocate a pbuf chain of pbufs from the pool. */ |
205 |
p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL); |
p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL); |