Browse Source

Fix: Suppress netsh output

nodeinfo-routing-update
jeka 1 month ago
parent
commit
fc32d756e6
  1. 4
      src/tun_route.c

4
src/tun_route.c

@ -212,7 +212,7 @@ int tun_route_add(uint32_t ifindex, uint32_t network, uint8_t prefix_len) {
char cmd[256]; char cmd[256];
struct in_addr dest_addr; struct in_addr dest_addr;
dest_addr.s_addr = dest; dest_addr.s_addr = dest;
snprintf(cmd, sizeof(cmd), "netsh interface ip add route %s/%d interface=%lu store=active", snprintf(cmd, sizeof(cmd), "netsh interface ip add route %s/%d interface=%lu store=active >NUL 2>&1",
inet_ntoa(dest_addr), prefix_len, (unsigned long)ifindex); inet_ntoa(dest_addr), prefix_len, (unsigned long)ifindex);
int sys_ret = system(cmd); int sys_ret = system(cmd);
if (sys_ret == 0) { if (sys_ret == 0) {
@ -257,7 +257,7 @@ int tun_route_del(uint32_t ifindex, uint32_t network, uint8_t prefix_len) {
struct in_addr dest_addr; struct in_addr dest_addr;
dest_addr.s_addr = htonl(network); dest_addr.s_addr = htonl(network);
char cmd[256]; char cmd[256];
snprintf(cmd, sizeof(cmd), "netsh interface ip delete route %s/%d interface=%lu store=active", snprintf(cmd, sizeof(cmd), "netsh interface ip delete route %s/%d interface=%lu store=active >NUL 2>&1",
inet_ntoa(dest_addr), prefix_len, (unsigned long)ifindex); inet_ntoa(dest_addr), prefix_len, (unsigned long)ifindex);
int sys_ret = system(cmd); int sys_ret = system(cmd);
if (sys_ret == 0) { if (sys_ret == 0) {

Loading…
Cancel
Save