Skip to content

Commit

Permalink
Revert "netdev2_tap: return actual byte number on read request"
Browse files Browse the repository at this point in the history
This reverts commit 613bcee.

FIONREAD seems to be unsupported for tun/tap interfaces in Linux.
  • Loading branch information
Cenk Gündoğan committed Dec 14, 2016
1 parent 7b272c5 commit 0b85959
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions cpu/native/include/cpu_conf.h
Expand Up @@ -55,6 +55,11 @@ extern "C" {
*/
#define NATIVE_ETH_PROTO 0x1234

#if (defined(GNRC_PKTBUF_SIZE)) && (GNRC_PKTBUF_SIZE < 2048)
# undef GNRC_PKTBUF_SIZE
# define GNRC_PKTBUF_SIZE (2048)
#endif

#ifdef __cplusplus
}
#endif
Expand Down
8 changes: 3 additions & 5 deletions cpu/native/netdev2_tap/netdev2_tap.c
Expand Up @@ -215,8 +215,6 @@ static int _recv(netdev2_t *netdev2, void *buf, size_t len, void *info)
(void)info;

if (!buf) {
int waiting_bytes;

if (len > 0) {
/* no memory available in pktbuf, discarding the frame */
DEBUG("netdev2_tap: discarding the frame\n");
Expand All @@ -236,9 +234,9 @@ static int _recv(netdev2_t *netdev2, void *buf, size_t len, void *info)
_continue_reading(dev);
}

/* get number of waiting bytes at dev->tap_fd */
real_ioctl(dev->tap_fd, FIONREAD, &waiting_bytes);
return waiting_bytes;
/* no way of figuring out packet size without racey buffering,
* so we return the maximum possible size */
return ETHERNET_FRAME_LEN;
}

int nread = real_read(dev->tap_fd, buf, len);
Expand Down

0 comments on commit 0b85959

Please sign in to comment.