Skip to content

Commit

Permalink
Print error message and exit if interface is not in RUNNING status - c…
Browse files Browse the repository at this point in the history
…loses appneta#96
  • Loading branch information
fklassen committed Jul 22, 2014
1 parent a289ab4 commit c8d8744
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
06/21/2014 Version 4.0.5beta1
- Fix netmap hang if network cables unplugged (#96)
- Support for Vale Switch (#91)
- Prevent file retransmissions when selecting multiple files (#86)
- Fix max replay rate for all loops except first when omitting --mbps (#85)
Expand Down
12 changes: 11 additions & 1 deletion src/common/sendpacket.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ sendpacket_open(const char *device, char *errbuf, tcpr_dir_t direction,
sp->open = 1;
sp->cache_dir = direction;
} else {
errx(-1, "failed to open device %s", device);
errx(-1, "failed to open device %s: %s", device, errbuf);
}
return sp;
}
Expand Down Expand Up @@ -1082,6 +1082,12 @@ sendpacket_open_netmap(const char *device, char *errbuf)
sp->if_flags |= IFF_UP;
}

if ((sp->if_flags & IFF_RUNNING) == 0) {
dbgx(1, "sendpacket_open_netmap: %s is not running", device);
snprintf (errbuf, SENDPACKET_ERRBUF_SIZE, "interface %s is not running - check cables\n", device);
goto NETMAP_IF_NOT_RUNNING;
}

if (sp->is_vale == 0) {

/* set promiscuous mode */
Expand Down Expand Up @@ -1116,6 +1122,10 @@ sendpacket_open_netmap(const char *device, char *errbuf)

NM_DO_IOCTL_FAILED:
snprintf (errbuf, SENDPACKET_ERRBUF_SIZE, "nm_do_ioctl: %s", strerror (errno));
NETMAP_IF_NOT_RUNNING:
fprintf(stderr, " failed!!\nSwitching network driver for %s to normal mode... ",
sp->device);
fflush(NULL);
munmap(sp->mmap_addr, sp->mmap_size);
MMAP_FAILED:
#if NETMAP_API < 10
Expand Down

0 comments on commit c8d8744

Please sign in to comment.