ETHER: When opening an unused interface , avoid invoking non existent programs

This commit is contained in:
Mark Pizzolato 2021-08-28 13:15:54 -07:00
parent 153d849c13
commit 4c64878f7c

View file

@ -2394,8 +2394,7 @@ else { /* !tap: */
char command[1024]; char command[1024];
/* try to force an otherwise unused interface to be turned on */ /* try to force an otherwise unused interface to be turned on */
memset(command, 0, sizeof(command)); snprintf(command, sizeof(command), (sim_get_tool_path ("ifconfig")[0] != '\0') ? "ifconfig %s up" : "ip link set dev %s up", savname);
snprintf(command, sizeof(command)-1, "ifconfig %s up", savname);
if (system(command)) {}; if (system(command)) {};
errbuf[0] = '\0'; errbuf[0] = '\0';
*handle = (void*) pcap_open_live(savname, bufsz, ETH_PROMISC, PCAP_READ_TIMEOUT, errbuf); *handle = (void*) pcap_open_live(savname, bufsz, ETH_PROMISC, PCAP_READ_TIMEOUT, errbuf);