This repository has been archived on 2019-11-14. You can view files and clone it, but cannot push or open issues or pull requests.
rip-vm2/partage/test/iftun.c

26 lines
515 B
C
Raw Normal View History

2019-10-25 18:07:02 +02:00
#include "iftun.h"
#include <stdio.h>
2019-11-13 17:33:17 +01:00
#include <unistd.h>
2019-10-25 18:07:02 +02:00
int main(int argc, char *argv[argc]) {
if (argc != 2) {
fprintf(stderr, "Utilisation : %s interface\n", argv[0]);
return 1;
}
2019-11-13 17:33:17 +01:00
if (getuid() != 0) {
fprintf(stderr, "%s doit être lancé en tant que superutilisateur.\n", argv[0]);
return 1;
}
2019-10-25 18:07:02 +02:00
int tun = tun_alloc(argv[1]);
2019-10-25 23:53:43 +02:00
fprintf(stderr, "Configurez linterface puis appuyez sur <Entrée>... ");
fflush(stderr);
2019-10-25 18:07:02 +02:00
getchar();
2019-10-25 23:53:43 +02:00
fprintf(stderr, "Démarrage.");
2019-10-25 18:07:02 +02:00
copy(tun, 1);
return 0;
}