iptables logging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Would you want something like this?

Unfortunately the following code was written for a non-standard libc, so 
it might (will) require some tweaking to get it to compile.

/*
  * GPLv2 (c) Copyright 1999-2005 by Maciej Zenczykowski.
  *
  * Program redirects all kernel messages to tty1
  * (the first virtual terminal).
  */

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>

int main() {
   int fd, res;
   char table[2];
   table[0] = 11; // TIOCLINUX 11 -> set_kernel_message_redirect
   table[1] = 1;  // ttyN=1, 0 to turn off redirection

   fd = open("/dev/tty0", O_RDONLY, 0);
   if (fd < 0) {
     fprintf(stderr, "ERROR #%d: open_console /dev/tty0\n", errno);
     return 1;
   };
   res = ioctl(fd, TIOCLINUX, &table);
   if (res < 0) {
     fprintf(stderr, "ERROR #%d: set_kmsg_redirect\n", errno);
     close(fd);
     return 2;
   };

   close(fd);
   return 0;
};

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux