From 4c64878f7c3e971e38542a285ddd2881c5751db6 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sat, 28 Aug 2021 13:15:54 -0700 Subject: [PATCH] ETHER: When opening an unused interface , avoid invoking non existent programs --- sim_ether.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sim_ether.c b/sim_ether.c index f566ece8..7fd2883e 100644 --- a/sim_ether.c +++ b/sim_ether.c @@ -2394,8 +2394,7 @@ else { /* !tap: */ char command[1024]; /* try to force an otherwise unused interface to be turned on */ - memset(command, 0, sizeof(command)); - snprintf(command, sizeof(command)-1, "ifconfig %s up", savname); + snprintf(command, sizeof(command), (sim_get_tool_path ("ifconfig")[0] != '\0') ? "ifconfig %s up" : "ip link set dev %s up", savname); if (system(command)) {}; errbuf[0] = '\0'; *handle = (void*) pcap_open_live(savname, bufsz, ETH_PROMISC, PCAP_READ_TIMEOUT, errbuf);