Browse Source

Remove deprecated vfork call on Mac, and make Mac route application more robust.

Adam Ierymenko 3 years ago
parent
commit
594853e251
2 changed files with 6 additions and 6 deletions
  1. 1 1
      osdep/MacEthernetTapAgent.c
  2. 5 5
      osdep/ManagedRoute.cpp

+ 1 - 1
osdep/MacEthernetTapAgent.c

@@ -157,7 +157,7 @@ static int run(const char *path,...)
 	args[argNo++] = (char *)0;
 	va_end(ap);
 
-	pid_t pid = vfork();
+	pid_t pid = fork();
 	if (pid < 0) {
 		return -1;
 	} else if (pid == 0) {

+ 5 - 5
osdep/ManagedRoute.cpp

@@ -507,15 +507,15 @@ bool ManagedRoute::sync()
 		}
 	}
 
-	if (!_applied.count(leftt)) {
+	//if (!_applied.count(leftt)) {
 		_applied[leftt] = !_via;
-		_routeCmd("delete",leftt,_via,(const char *)0,(_via) ? (const char *)0 : _device);
+		//_routeCmd("delete",leftt,_via,(const char *)0,(_via) ? (const char *)0 : _device);
 		_routeCmd("add",leftt,_via,(const char *)0,(_via) ? (const char *)0 : _device);
 		//_routeCmd("change",leftt,_via,(const char *)0,(_via) ? (const char *)0 : _device);
-	}
-	if ((rightt)&&(!_applied.count(rightt))) {
+	//}
+	if (rightt) {
 		_applied[rightt] = !_via;
-		_routeCmd("delete",rightt,_via,(const char *)0,(_via) ? (const char *)0 : _device);
+		//_routeCmd("delete",rightt,_via,(const char *)0,(_via) ? (const char *)0 : _device);
 		_routeCmd("add",rightt,_via,(const char *)0,(_via) ? (const char *)0 : _device);
 		//_routeCmd("change",rightt,_via,(const char *)0,(_via) ? (const char *)0 : _device);
 	}