From c7d5ddfadc507d1cc9811229f938abe8c8004c0d Mon Sep 17 00:00:00 2001 From: laforge Date: Mon, 20 Nov 2000 11:43:22 +0000 Subject: huge reorganization for 0.9 - added hashtables everywhere - no more dynamic allocation for each packet - mysql output plugin - more keys in ulogd_BASE - moved libipulog into ulogd directory - introduced autoconf --- ulogd/extensions/ulogd_OPRINT.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'ulogd/extensions/ulogd_OPRINT.c') diff --git a/ulogd/extensions/ulogd_OPRINT.c b/ulogd/extensions/ulogd_OPRINT.c index 3fa42ed..fc00b46 100644 --- a/ulogd/extensions/ulogd_OPRINT.c +++ b/ulogd/extensions/ulogd_OPRINT.c @@ -1,11 +1,11 @@ -/* ulogd_MAC.c, Version $Revision: 1.4 $ +/* ulogd_MAC.c, Version $Revision: 1.5 $ * * ulogd output target for logging to a file * * (C) 2000 by Harald Welte * This software is released under the terms of GNU GPL * - * $Id: ulogd_OPRINT.c,v 1.4 2000/09/22 06:54:33 laforge Exp $ + * $Id: ulogd_OPRINT.c,v 1.5 2000/11/16 17:20:52 laforge Exp $ * */ @@ -15,6 +15,10 @@ #include "ulogd.h" #include "conffile.h" +#ifndef ULOGD_OPRINT_DEFAULT +#define ULOGD_OPRINT_DEFAULT "/var/log/ulogd.pktlog" +#endif + #define NIPQUAD(addr) \ ((unsigned char *)&addr)[0], \ ((unsigned char *)&addr)[1], \ @@ -42,22 +46,14 @@ int _output_print(ulog_iret_t *res) break; case ULOGD_RET_BOOL: case ULOGD_RET_INT8: - fprintf(of, "%d\n", ret->value.i8); - break; case ULOGD_RET_INT16: - fprintf(of, "%d\n", ret->value.i16); - break; case ULOGD_RET_INT32: - fprintf(of, "%ld\n", ret->value.i32); + fprintf(of, "%d\n", ret->value.i32); break; case ULOGD_RET_UINT8: - fprintf(of, "%u\n", ret->value.ui8); - break; case ULOGD_RET_UINT16: - fprintf(of, "%u\n", ret->value.ui16); - break; case ULOGD_RET_UINT32: - fprintf(of, "%lu\n", ret->value.ui32); + fprintf(of, "%u\n", ret->value.ui32); break; case ULOGD_RET_IPADDR: fprintf(of, "%u.%u.%u.%u\n", @@ -72,7 +68,7 @@ int _output_print(ulog_iret_t *res) } static ulog_output_t base_op[] = { - { NULL, "print", &_output_print }, + { NULL, "oprint", &_output_print }, { NULL, "", NULL }, }; @@ -88,7 +84,7 @@ static void _base_reg_op(void) static config_entry_t outf_ce = { NULL, "dumpfile", CONFIG_TYPE_STRING, CONFIG_OPT_NONE, 0, - { string: "/var/log/ulogd.pktlog" } }; + { string: ULOGD_OPRINT_DEFAULT } }; void _init(void) { #ifdef DEBUG @@ -99,7 +95,8 @@ void _init(void) of = fopen(outf_ce.u.string, "a"); if (!of) { - ulogd_error("ulogd_OPRINT: can't open PKTLOG: %s\n", strerror(errno)); + ulogd_log(ULOGD_FATAL, "can't open PKTLOG: %s\n", + strerror(errno)); exit(2); } #endif -- cgit v1.2.3