System startup needs to wait for tun device to be created before
continuing on use of the tun device. Add -D option to fork a daemon of
isotptun and exit(EXIT_SUCCESS) when the tun device can be used.
Log errors to syslog when daemonized or to stderr when in foreground.
Signed-off-by: Marko Kohtala <marko.kohtala@gmail.com>
Command line parsing error messages are printed to stdout. Other errors
and usage goes to stderr.
Change to print errors to stderr.
Signed-off-by: Marko Kohtala <marko.kohtala@gmail.com>
Exit code does not tell if the service was provided or if it was not
provided due to command line or setup errors.
Change errors to return EXIT_FAILURE instead of 0. Also change other uses
of 0 to EXIT_SUCCESS and 1 to EXIT_FAILURE for clarity and POSIX
conformance.
Signed-off-by: Marko Kohtala <marko.kohtala@gmail.com>
replaced strcpy(if_name, argv[x]) + ioctl by if_idx = if_nametoindex(argv[x])
to avoid overflows caused by long user input.
Signed-off-by: Sven Schmitt <sven.schmitt@gmx.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>