[CentOS] iptables logging

Wed May 25 11:25:48 UTC 2005
Peter Farrow <peter at farrows.org>

This is exactly want I want

Thanks very much!

Pete


Maciej Żenczykowski wrote:

> 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;
> };
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________