diff options
author | Peter Volkov <pva@gentoo.org> | 2006-06-14 13:33:31 +0000 |
---|---|---|
committer | Peter Volkov <pva@gentoo.org> | 2006-06-14 13:33:31 +0000 |
commit | 1a0994d7f1ecb6ca41d8c0ea0712bb51d400c838 (patch) | |
tree | e51935e6a8d03dc0648ace702eb7cf12ebeb0c30 /net-analyzer | |
parent | Stable on amd64 wrt security bug #136759. (diff) | |
download | gentoo-2-1a0994d7f1ecb6ca41d8c0ea0712bb51d400c838.tar.gz gentoo-2-1a0994d7f1ecb6ca41d8c0ea0712bb51d400c838.tar.bz2 gentoo-2-1a0994d7f1ecb6ca41d8c0ea0712bb51d400c838.zip |
Fixed compilation problem with flex. Upstream suggested to create patch from cvs version, thus we have nearly ipcad-3.7.2 now. Removed DEPEND on >=sys-apps/sed-4 as it belong to BASE system profile and there no sed below 4.0.9 in portage. Some cleaning of init scripts, see bug 122786 for ideas.
(Portage version: 2.0.54-r2)
Diffstat (limited to 'net-analyzer')
-rw-r--r-- | net-analyzer/ipcad/ChangeLog | 10 | ||||
-rw-r--r-- | net-analyzer/ipcad/files/ipcad-3.7-20060614-cvs.patch | 766 | ||||
-rw-r--r-- | net-analyzer/ipcad/files/ipcad.conf.d | 5 | ||||
-rw-r--r-- | net-analyzer/ipcad/files/ipcad.init | 12 | ||||
-rw-r--r-- | net-analyzer/ipcad/ipcad-3.7.ebuild | 15 |
5 files changed, 797 insertions, 11 deletions
diff --git a/net-analyzer/ipcad/ChangeLog b/net-analyzer/ipcad/ChangeLog index ece2a47eb3e7..e8eed7b5515d 100644 --- a/net-analyzer/ipcad/ChangeLog +++ b/net-analyzer/ipcad/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for net-analyzer/ipcad # Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/ipcad/ChangeLog,v 1.20 2006/06/01 21:13:58 jokey Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/ipcad/ChangeLog,v 1.21 2006/06/14 13:33:30 pva Exp $ + + 14 Jun 2006; Peter Volkov <pva@gentoo.org> + +files/ipcad-3.7-20060614-cvs.patch, files/ipcad.conf.d, files/ipcad.init, + ipcad-3.7.ebuild: + Fixed compilation problem with flex. Upstream suggested to create patch from + cvs version, thus we have nearly ipcad-3.7.2 now. Removed DEPEND on + >=sys-apps/sed-4 as it belong to BASE system profile and there no sed below + 4.0.9. Some cleaning of init scripts, see bug 122786 for ideas. 01 Jun 2006; Markus Ullmann <jokey@gentoo.org> files/ipcad.conf.d: Adjusting conf.d file, thanks to Ricardo Cordeiro in bug #135085 diff --git a/net-analyzer/ipcad/files/ipcad-3.7-20060614-cvs.patch b/net-analyzer/ipcad/files/ipcad-3.7-20060614-cvs.patch new file mode 100644 index 000000000000..a82f4e96ec32 --- /dev/null +++ b/net-analyzer/ipcad/files/ipcad-3.7-20060614-cvs.patch @@ -0,0 +1,766 @@ +diff -Naur ipcad-3.7/cfglex.c ipcad/cfglex.c +--- ipcad-3.7/cfglex.c 2005-11-21 07:41:06.000000000 +0300 ++++ ipcad/cfglex.c 2006-03-27 17:57:29.000000000 +0400 +@@ -19,7 +19,7 @@ + /* A lexical scanner generated by flex */ + + /* Scanner skeleton version: +- * $Header: /var/cvsroot/gentoo-x86/net-analyzer/ipcad/files/ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ ++ * $Header: /var/cvsroot/gentoo-x86/net-analyzer/ipcad/files/ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ + */ + + #define FLEX_SCANNER +diff -Naur ipcad-3.7/cfg.y ipcad/cfg.y +--- ipcad-3.7/cfg.y 2005-11-21 07:41:07.000000000 +0300 ++++ ipcad/cfg.y 2006-03-27 17:57:29.000000000 +0400 +@@ -171,7 +171,12 @@ + free($2); + } + | IFACE ULOG ulog_gmask optIFlags { +- char *p = malloc(16); ++ static int ulog_already_defined; ++ char *p; ++ if(ulog_already_defined++) { ++ return yyerror("Duplicate ULOG interface specification.\nUse \"interface ulog group X, group Y;\" format.\n"); ++ } ++ p = malloc(16); + assert(p); + snprintf(p, 16, "%u", $3); + if(cfg_add_iface("ulog", $4, p) == NULL) +@@ -424,7 +429,7 @@ + } + | NETFLOW TIMEOUT INACTIVE TOK_INTEGER { + if($4 < 1 || $4 > 600) +- return yyerror("Netflow active timeout " ++ return yyerror("Netflow inactive timeout " + "out of range 1..600"); + conf->netflow_timeout_inactive = $4; + } +diff -Naur ipcad-3.7/cfgy.c ipcad/cfgy.c +--- ipcad-3.7/cfgy.c 2005-11-21 07:41:07.000000000 +0300 ++++ ipcad/cfgy.c 2006-03-27 17:57:29.000000000 +0400 +@@ -185,11 +185,11 @@ + static const short yyrline[] = { 0, + 104, 107, 108, 111, 112, 114, 116, 117, 118, 119, + 120, 123, 125, 126, 127, 130, 132, 135, 137, 140, +- 144, 148, 153, 159, 163, 168, 173, 180, 184, 194, +- 201, 206, 209, 212, 218, 222, 232, 236, 240, 244, +- 248, 255, 256, 261, 268, 276, 314, 349, 369, 375, +- 380, 387, 389, 396, 404, 413, 419, 425, 431, 437, +- 443, 449 ++ 144, 148, 153, 159, 163, 168, 173, 185, 189, 199, ++ 206, 211, 214, 217, 223, 227, 237, 241, 245, 249, ++ 253, 260, 261, 266, 273, 281, 319, 354, 374, 380, ++ 385, 392, 394, 401, 409, 418, 424, 430, 436, 442, ++ 448, 454 + }; + #endif + +@@ -960,7 +960,12 @@ + case 27: + #line 173 "cfg.y" + { +- char *p = malloc(16); ++ static int ulog_already_defined; ++ char *p; ++ if(ulog_already_defined++) { ++ return yyerror("Duplicate ULOG interface specification.\nUse \"interface ulog group X, group Y;\" format.\n"); ++ } ++ p = malloc(16); + assert(p); + snprintf(p, 16, "%u", yyvsp[-1].tv_int); + if(cfg_add_iface("ulog", yyvsp[0].tv_int, p) == NULL) +@@ -968,14 +973,14 @@ + ; + break;} + case 28: +-#line 180 "cfg.y" ++#line 185 "cfg.y" + { + if(cfg_add_iface("ipq", yyvsp[0].tv_int, NULL) == NULL) + exit(EX_NOINPUT); + ; + break;} + case 29: +-#line 184 "cfg.y" ++#line 189 "cfg.y" + { + char *p; + if(yyvsp[-1].tv_int < 0 || yyvsp[-1].tv_int > 65535) +@@ -988,7 +993,7 @@ + ; + break;} + case 30: +-#line 194 "cfg.y" ++#line 199 "cfg.y" + { + char *p = malloc(16); + assert(p); +@@ -998,7 +1003,7 @@ + ; + break;} + case 31: +-#line 201 "cfg.y" ++#line 206 "cfg.y" + { + if( conf->dump_table_file ) + free(conf->dump_table_file); +@@ -1006,19 +1011,19 @@ + ; + break;} + case 32: +-#line 206 "cfg.y" ++#line 211 "cfg.y" + { + conf->capture_ports = 1; + ; + break;} + case 33: +-#line 209 "cfg.y" ++#line 214 "cfg.y" + { + conf->capture_ports = 0; + ; + break;} + case 34: +-#line 212 "cfg.y" ++#line 217 "cfg.y" + { + if(add_server(rsh_server, "RSH Server", &(yyvsp[0].tv_ip), 514)) + return yyerror("Failed to install RSH server"); +@@ -1027,14 +1032,14 @@ + ; + break;} + case 35: +-#line 218 "cfg.y" ++#line 223 "cfg.y" + { + fprintf(stderr, "Warning: Option at line %d has no effect\n", + ipcacfglineno); + ; + break;} + case 36: +-#line 222 "cfg.y" ++#line 227 "cfg.y" + { + int to_ms; + to_ms = atoi(yyvsp[0].tv_char); +@@ -1047,35 +1052,35 @@ + ; + break;} + case 37: +-#line 232 "cfg.y" ++#line 237 "cfg.y" + { + cfg_add_rsh_host("", yyvsp[-1].tv_char, yyvsp[0].tv_int); + free(yyvsp[-1].tv_char); + ; + break;} + case 38: +-#line 236 "cfg.y" ++#line 241 "cfg.y" + { + cfg_add_rsh_host("", yyvsp[-1].tv_char, yyvsp[0].tv_int); + free(yyvsp[-1].tv_char); + ; + break;} + case 39: +-#line 240 "cfg.y" ++#line 245 "cfg.y" + { + cfg_add_rsh_host(yyvsp[-3].tv_char, yyvsp[-1].tv_char, yyvsp[0].tv_int); + free(yyvsp[-3].tv_char); free(yyvsp[-1].tv_char); + ; + break;} + case 40: +-#line 244 "cfg.y" ++#line 249 "cfg.y" + { + conf->rsh_ttl = atoi(yyvsp[0].tv_char); + free(yyvsp[0].tv_char); + ; + break;} + case 41: +-#line 248 "cfg.y" ++#line 253 "cfg.y" + { + fprintf(stderr, "WARNING: \"ttl = %s;\" at line %d: " + "Obsolete syntax. Please use \"rsh ttl = %s;\"\n", +@@ -1085,7 +1090,7 @@ + ; + break;} + case 43: +-#line 256 "cfg.y" ++#line 261 "cfg.y" + { + if(conf->chroot_to) + free(conf->chroot_to); +@@ -1093,7 +1098,7 @@ + ; + break;} + case 44: +-#line 261 "cfg.y" ++#line 266 "cfg.y" + { + int id = yyvsp[0].tv_char ? atoi(yyvsp[0].tv_char) : -1; + free(yyvsp[0].tv_char); +@@ -1103,7 +1108,7 @@ + ; + break;} + case 45: +-#line 268 "cfg.y" ++#line 273 "cfg.y" + { + int id = yyvsp[0].tv_char ? atoi(yyvsp[0].tv_char) : -1; + free(yyvsp[0].tv_char); +@@ -1113,7 +1118,7 @@ + ; + break;} + case 46: +-#line 276 "cfg.y" ++#line 281 "cfg.y" + { + char *p = yyvsp[0].tv_char; + +@@ -1153,7 +1158,7 @@ + ; + break;} + case 47: +-#line 314 "cfg.y" ++#line 319 "cfg.y" + { + char *p = yyvsp[0].tv_char; + +@@ -1190,7 +1195,7 @@ + ; + break;} + case 48: +-#line 349 "cfg.y" ++#line 354 "cfg.y" + { + int ret; + yyvsp[0].tv_aggr.s1 = yyvsp[-1].tv_char; +@@ -1211,7 +1216,7 @@ + ; + break;} + case 49: +-#line 370 "cfg.y" ++#line 375 "cfg.y" + { + yyval.tv_aggr.is_ip_aggr = 1; + yyval.tv_aggr.s2 = yyvsp[-2].tv_char; +@@ -1219,7 +1224,7 @@ + ; + break;} + case 50: +-#line 375 "cfg.y" ++#line 380 "cfg.y" + { + yyval.tv_aggr.is_ip_aggr = 0; + yyval.tv_aggr.s2 = yyvsp[-2].tv_char; +@@ -1227,7 +1232,7 @@ + ; + break;} + case 51: +-#line 380 "cfg.y" ++#line 385 "cfg.y" + { + yyval.tv_aggr.is_ip_aggr = 0; + yyval.tv_aggr.s2 = NULL; +@@ -1235,11 +1240,11 @@ + ; + break;} + case 52: +-#line 388 "cfg.y" ++#line 393 "cfg.y" + { yyval.tv_ip.s_addr = INADDR_ANY; ; + break;} + case 53: +-#line 389 "cfg.y" ++#line 394 "cfg.y" + { + if(inet_aton(yyvsp[0].tv_char, &(yyval.tv_ip)) != 1) + return yyerror("IP address expected"); +@@ -1247,7 +1252,7 @@ + ; + break;} + case 54: +-#line 397 "cfg.y" ++#line 402 "cfg.y" + { + if(inet_aton(yyvsp[0].tv_char, &(yyval.tv_ip)) != 1) + return yyerror("IP address expected"); +@@ -1255,7 +1260,7 @@ + ; + break;} + case 55: +-#line 405 "cfg.y" ++#line 410 "cfg.y" + { + conf->netflow_enabled = 1; + if(add_server(netflow_exporter, +@@ -1266,7 +1271,7 @@ + ; + break;} + case 56: +-#line 413 "cfg.y" ++#line 418 "cfg.y" + { + if(yyvsp[0].tv_int != 5 && yyvsp[0].tv_int != 1) + yyerror("NetFlow version: " +@@ -1275,7 +1280,7 @@ + ; + break;} + case 57: +-#line 419 "cfg.y" ++#line 424 "cfg.y" + { + if(yyvsp[0].tv_int < 1 || yyvsp[0].tv_int > 60) + return yyerror("Netflow active timeout " +@@ -1284,16 +1289,16 @@ + ; + break;} + case 58: +-#line 425 "cfg.y" ++#line 430 "cfg.y" + { + if(yyvsp[0].tv_int < 1 || yyvsp[0].tv_int > 600) +- return yyerror("Netflow active timeout " ++ return yyerror("Netflow inactive timeout " + "out of range 1..600"); + conf->netflow_timeout_inactive = yyvsp[0].tv_int; + ; + break;} + case 59: +-#line 431 "cfg.y" ++#line 436 "cfg.y" + { + if(yyvsp[0].tv_int < 0 || yyvsp[0].tv_int > 255) + return yyerror("Netflow engine-type " +@@ -1302,7 +1307,7 @@ + ; + break;} + case 60: +-#line 437 "cfg.y" ++#line 442 "cfg.y" + { + if(yyvsp[0].tv_int < 0 || yyvsp[0].tv_int > 255) + return yyerror("Netflow engine-id " +@@ -1311,7 +1316,7 @@ + ; + break;} + case 61: +-#line 443 "cfg.y" ++#line 448 "cfg.y" + { + if(yyvsp[0].tv_int < 10 || yyvsp[0].tv_int > 16382) + return yyerror("Netflow packet interval " +@@ -1320,7 +1325,7 @@ + ; + break;} + case 62: +-#line 449 "cfg.y" ++#line 454 "cfg.y" + { + if(yyvsp[-2].tv_int > yyvsp[0].tv_int) + return yyerror("NetFlow invalid range: %d..%d", +@@ -1405,7 +1410,7 @@ + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); +- x < (sizeof(yytname) / sizeof(char *)); x++) ++ x < (int)(sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); +@@ -1417,7 +1422,7 @@ + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); +- x < (sizeof(yytname) / sizeof(char *)); x++) ++ x < (int)(sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); +@@ -1553,7 +1558,7 @@ + } + return 1; + } +-#line 460 "cfg.y" ++#line 465 "cfg.y" + + + int +diff -Naur ipcad-3.7/ChangeLog ipcad/ChangeLog +--- ipcad-3.7/ChangeLog 2005-11-21 07:41:07.000000000 +0300 ++++ ipcad/ChangeLog 2006-04-07 22:58:28.000000000 +0400 +@@ -1,6 +1,11 @@ + + ipcad + ++3.7.2: 2006-Mar-27 ++ ++ * ULOG collector: ability to differentiate by hook id (nlgroup). ++ Suggested by Sergey Skachkov <srg11@mail.ru>. ++ + 3.7: 2005-Jul-06 + + * Added `interface file <filename>` possibility for reading from +diff -Naur ipcad-3.7/configure.in ipcad/configure.in +--- ipcad-3.7/configure.in 2005-11-21 07:41:07.000000000 +0300 ++++ ipcad/configure.in 2006-03-27 17:57:29.000000000 +0400 +@@ -2,7 +2,7 @@ + AC_INIT(ipcad.h) + AC_CONFIG_HEADER(config.h) + +-IPCAD_VERSION="3.7" ++IPCAD_VERSION="3.7.2" + export IPCAD_VERSION + AC_SUBST(IPCAD_VERSION) + +diff -Naur ipcad-3.7/contrib/ipcad.redhat.sh ipcad/contrib/ipcad.redhat.sh +--- ipcad-3.7/contrib/ipcad.redhat.sh 1970-01-01 03:00:00.000000000 +0300 ++++ ipcad/contrib/ipcad.redhat.sh 2004-09-28 17:15:30.000000000 +0400 +@@ -0,0 +1,45 @@ ++#!/bin/sh ++# ++# ipcad This shell script takes care of starting and stopping ++# the ipcad daemon. ++# ++# chkconfig: 2345 07 93 ++# description: IP Cisco Accounting Daemon ++# ++ ++# Source function library ++. /etc/rc.d/init.d/functions ++ ++OPTIONS="-rds" # Read tables on startup, daemonize, and save tables on exit ++IPCAD_PATH=/usr/sbin/ipcad ++ ++case "$1" in ++ start) ++ echo -n "Starting ipcad: " ++ daemon $IPCAD_PATH $OPTIONS ++ RETVAL=$? ++ echo ++ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ipcad ++ ;; ++ stop) ++ echo -n "Stopping ipcad: " ++ killproc $IPCAD_PATH ++ RETVAL=$? ++ echo ++ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ipcad ++ ;; ++ restart) ++ $0 stop ++ sleep 5 ++ $0 start ++ ;; ++ status) ++ status $IPCAD_PATH ++ ;; ++ *) ++ echo "Usage: $0 {start|stop|restart|status}" ++ exit 1 ++ ;; ++esac ++ ++exit 0 +diff -Naur ipcad-3.7/contrib/README ipcad/contrib/README +--- ipcad-3.7/contrib/README 1970-01-01 03:00:00.000000000 +0300 ++++ ipcad/contrib/README 2004-09-28 17:15:30.000000000 +0400 +@@ -0,0 +1 @@ ++ipcad.redhat.sh - The ipcad startup script for RedHat/Fedora +diff -Naur ipcad-3.7/import.c ipcad/import.c +--- ipcad-3.7/import.c 2005-11-21 07:41:06.000000000 +0300 ++++ ipcad/import.c 2006-04-07 23:24:58.000000000 +0400 +@@ -1,5 +1,5 @@ + /*- +- * Copyright (c) 2001, 2002 Lev Walkin <vlm@lionet.info>. ++ * Copyright (c) 2001, 2002, 2006 Lev Walkin <vlm@lionet.info>. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without +@@ -23,7 +23,7 @@ + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * +- * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ ++ * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ + */ + + #include "ipcad.h" +@@ -94,7 +94,8 @@ + } + + if((sb.st_mode & 0077)) { +- fprintf(msgstream, "Insecure dump file permissions.\n"); ++ fprintf(msgstream, "Insecure dump file permissions. " ++ "Try `chmod 600 %s`\n", dump_file); + fclose(f); + return -1; + } +@@ -195,16 +196,49 @@ + return 0; + } + +- if(clear) +- fprintf(msgstream, +- "%ld elements got from %s.\n", +- entries, dump_file); +- else +- fprintf(msgstream, +- "%ld elements added from %s.\n", +- entries, dump_file); ++ fprintf(msgstream, "%s %ld elements from %s.\n", ++ clear ? "Got" : "Added", entries, dump_file); ++ ++ if(clear && entries) { ++ /* Analyse hash for collisions */ ++ double sumsq = 0.0; ++ double sum = 0.0; ++ int longest_chain = 0; ++ int longest_chain_no = 0; ++ int numbuckets; ++ int bucket; /* Bucket number */ ++ ++ lock_storage(&active_storage); ++ for(bucket = 0; bucket < active_storage.numbuckets; bucket++) { ++ int chainLength = 0; ++ flow_el_t *cur; ++ ++ /* Allow others to run... */ ++ unlock_storage(&active_storage); ++ lock_storage(&active_storage); ++ ++ for(cur = active_storage.buckets[bucket]; ++ cur; cur = cur->bucket_next) ++ chainLength++; ++ if(longest_chain < chainLength) { ++ longest_chain = chainLength; ++ longest_chain_no = bucket; ++ } ++ ++ sumsq += ((double)chainLength) * chainLength; ++ sum += chainLength; ++ } ++ numbuckets = active_storage.numbuckets; ++ unlock_storage(&active_storage); ++ ++ fprintf(stderr, "Storage: chained %d in %d bucket out of %d, mean %.1f dev^2 %.1f\n", ++ longest_chain, longest_chain_no, numbuckets, ++ sum / numbuckets, ++ sumsq / numbuckets ++ - (sum * sum / numbuckets / numbuckets) ++ ); ++ } + + return 0; + } + +- +diff -Naur ipcad-3.7/ipcad.conf.5 ipcad/ipcad.conf.5 +--- ipcad-3.7/ipcad.conf.5 2005-11-21 07:41:07.000000000 +0300 ++++ ipcad/ipcad.conf.5 2006-01-21 14:30:04.000000000 +0300 +@@ -43,7 +43,7 @@ + .Bd -filled -offset indent + Defines a buffer size to use for transferring the data from the kernel. Using + larger buffers may increase the performance by lowering the number +-of expensive context switches, but using smaller values improves responsiveness. ++of expensive context switches, whereas using smaller values improves responsiveness. + .Pp + NOTE: This option has no effect on NetFlow operation. + .Ed +@@ -60,7 +60,7 @@ + .Pp + .Bd -filled -offset indent + Listen on specified interface using BPF or PCAP packet source. (Please refer to the +-.Nm Interface configuration ++.Nm Interface options + section below). + .Ed + .Pp +diff -Naur ipcad-3.7/loop-file.c ipcad/loop-file.c +--- ipcad-3.7/loop-file.c 2005-11-21 07:41:06.000000000 +0300 ++++ ipcad/loop-file.c 2006-04-07 22:58:02.000000000 +0400 +@@ -23,7 +23,7 @@ + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * +- * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ ++ * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ + */ + + #include "ipcad.h" +@@ -43,7 +43,7 @@ + assert(ps->iface_type == IFACE_FILE); + + while(!signoff_now) { +- assert(ps->iface.file.dev); ++ if(ps->iface.file.dev == NULL) { sleep(5); continue; } + pdr = pcap_loop(ps->iface.file.dev, 0, + pcap_callback, (unsigned char *)ps); + if(pdr <= 0) +diff -Naur ipcad-3.7/loop-ulog.c ipcad/loop-ulog.c +--- ipcad-3.7/loop-ulog.c 2005-11-21 07:41:06.000000000 +0300 ++++ ipcad/loop-ulog.c 2006-03-27 17:57:29.000000000 +0400 +@@ -1,5 +1,5 @@ + /*- +- * Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. ++ * Copyright (c) 2003, 2006 Lev Walkin <vlm@lionet.info>. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without +@@ -23,7 +23,7 @@ + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * +- * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ ++ * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ + */ + + #include "ipcad.h" +@@ -51,7 +51,7 @@ + ulog_packet_msg_t *upkt; + packet_source_t *ps = psp; + ssize_t len = 0; +- int addrlen; ++ socklen_t addrlen; + + assert(ps->iface_type == IFACE_ULOG); + assert(ps->bufsize); +@@ -102,6 +102,17 @@ + + upkt = NLMSG_DATA(nlh); + ++ /* If interface name is not given, ++ * fake it using ULOG group id */ ++ if(upkt->indev_name[0] == 0) { ++ char *p = upkt->indev_name; ++ int nlgroup = upkt->hook + 1; ++ memcpy(p, "ulog", 4); p += 4; ++ if(nlgroup >= 10) /* Max is 32 anyway */ ++ *p++ = '0' + (nlgroup / 10); ++ *p++ = '0' + (nlgroup % 10); ++ *p = '\0'; ++ } + process_packet_data(ps, upkt->payload, upkt->data_len, + upkt->indev_name, upkt->outdev_name); + +diff -Naur ipcad-3.7/Makefile ipcad/Makefile +--- ipcad-3.7/Makefile 2005-11-21 07:41:07.000000000 +0300 ++++ ipcad/Makefile 1970-01-01 03:00:00.000000000 +0300 +@@ -1,4 +0,0 @@ +-all: bootstrap +- +-bootstrap: +- ./configure && make +diff -Naur ipcad-3.7/Makefile.in ipcad/Makefile.in +--- ipcad-3.7/Makefile.in 2005-11-21 07:41:07.000000000 +0300 ++++ ipcad/Makefile.in 2006-02-11 20:21:11.000000000 +0300 +@@ -72,10 +72,10 @@ + @mv y.tab.h cshelly.h + + cslex.c: cslex.l +- ${LEX} -sp -Cem -ocslex.c -PCS cslex.l ++ ${LEX} -s -p -Cem -ocslex.c -PCS cslex.l + + cfglex.c: cfglex.l +- ${LEX} -sp -Cem -ocfglex.c -Pipcacfg cfglex.l ++ ${LEX} -s -p -Cem -ocfglex.c -Pipcacfg cfglex.l + + + man: ipcad.8 ipcad.conf.5 +diff -Naur ipcad-3.7/psrc-bpf.c ipcad/psrc-bpf.c +--- ipcad-3.7/psrc-bpf.c 2005-11-21 07:41:06.000000000 +0300 ++++ ipcad/psrc-bpf.c 2006-04-07 22:58:36.000000000 +0400 +@@ -23,7 +23,7 @@ + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * +- * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ ++ * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ + */ + + #include "ipcad.h" +@@ -123,6 +123,7 @@ + * Attach an interface to the BPF. + */ + ++ memset(&ifr, 0, sizeof(ifr)); + strncpy( ifr.ifr_name, IFNameBySource(ps), sizeof(ifr.ifr_name) ); + + /* Bind to a specified interface */ +diff -Naur ipcad-3.7/psrc-file.c ipcad/psrc-file.c +--- ipcad-3.7/psrc-file.c 2005-11-21 07:41:06.000000000 +0300 ++++ ipcad/psrc-file.c 2006-04-07 22:58:02.000000000 +0400 +@@ -23,7 +23,7 @@ + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * +- * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ ++ * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ + */ + + #include "ipcad.h" +@@ -46,6 +46,8 @@ + dev = pcap_open_offline(IFNameBySource(ps), errbuf); + if(dev == NULL) { + fprintf(stderr, "[%s] ", errbuf); ++ ps->state = PST_FINISHED; ++ errno = EINVAL; + return -1; + } + +@@ -102,7 +104,8 @@ + fprintf(stderr, "[Unknown interface type] "); + pcap_close(ps->iface.file.dev); + ps->iface.file.dev = NULL; +- errno = ENODEV; ++ ps->state = PST_FINISHED; ++ errno = EINVAL; + return -1; + }; + +diff -Naur ipcad-3.7/servers.c ipcad/servers.c +--- ipcad-3.7/servers.c 2005-11-21 07:41:06.000000000 +0300 ++++ ipcad/servers.c 2006-04-07 22:58:02.000000000 +0400 +@@ -23,7 +23,7 @@ + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * +- * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ ++ * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ + */ + + #include "ipcad.h" +@@ -69,6 +69,7 @@ + int rc; + + if(!servers_head) { ++ if(daemon_mode) + printf("No servers defined. How will you gather data? ;)\n"); + return 0; + } +diff -Naur ipcad-3.7/storage.c ipcad/storage.c +--- ipcad-3.7/storage.c 2005-11-21 07:41:06.000000000 +0300 ++++ ipcad/storage.c 2006-04-07 23:24:58.000000000 +0400 +@@ -23,7 +23,7 @@ + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * +- * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ ++ * $Id: ipcad-3.7-20060614-cvs.patch,v 1.1 2006/06/14 13:33:31 pva Exp $ + */ + + #include "ipcad.h" +@@ -358,7 +358,7 @@ + int h; + + h = +- flow->src.s_addr ++ (flow->src.s_addr >> 1) + ^ flow->dst.s_addr + ^ (int)flow->ifSource + ^ flow->ifInIndex diff --git a/net-analyzer/ipcad/files/ipcad.conf.d b/net-analyzer/ipcad/files/ipcad.conf.d index b8e5169b98b7..e56d7b2cdfe8 100644 --- a/net-analyzer/ipcad/files/ipcad.conf.d +++ b/net-analyzer/ipcad/files/ipcad.conf.d @@ -1,9 +1,10 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/ipcad/files/ipcad.conf.d,v 1.3 2006/06/01 21:13:58 jokey Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/ipcad/files/ipcad.conf.d,v 1.4 2006/06/14 13:33:31 pva Exp $ # Config file for /etc/init.d/ipcad # Any extra options you want to pass to ipcad # on start-up should be put here. -IPCAD_OPTS="-drs" +# Read tables on startup (-r), daemonize (-d), and save tables on exit (-s). +IPCAD_OPTS="-rds" diff --git a/net-analyzer/ipcad/files/ipcad.init b/net-analyzer/ipcad/files/ipcad.init index 5e0a68413667..5c36865f62a5 100644 --- a/net-analyzer/ipcad/files/ipcad.init +++ b/net-analyzer/ipcad/files/ipcad.init @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/ipcad/files/ipcad.init,v 1.2 2006/01/15 18:28:57 vanquirius Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/ipcad/files/ipcad.init,v 1.3 2006/06/14 13:33:31 pva Exp $ depend() { need net @@ -12,6 +12,11 @@ checkconfig() { eerror "No /etc/ipcad.conf file exists!" return 1 fi + + `egrep -v "(^#|^$)" /etc/ipcad.conf | grep interface > /dev/null 2>&1` || { + eerror "Please, configure at least one interface in /etc/ipcad.conf." ; + return 1 ; + } return 0 } @@ -21,13 +26,12 @@ start() { checkconfig || return 1 ebegin "Starting ipcad" - start-stop-daemon --start --quiet --exec /usr/sbin/ipcad -- ${IPCAD_OPTS} >/dev/null + start-stop-daemon --start --pidfile=/var/ipcad/run/ipcad.pid --exec /usr/sbin/ipcad -- ${IPCAD_OPTS} eend $? } stop () { ebegin "Stopping ipcad" - start-stop-daemon --stop --quiet \ - --pidfile=/var/ipcad/run/ipcad.pid --retry 20 + start-stop-daemon --stop --pidfile=/var/ipcad/run/ipcad.pid --exec /usr/sbin/ipcad --retry 20 eend $? } diff --git a/net-analyzer/ipcad/ipcad-3.7.ebuild b/net-analyzer/ipcad/ipcad-3.7.ebuild index 544e1de1e54f..417ed46e0f94 100644 --- a/net-analyzer/ipcad/ipcad-3.7.ebuild +++ b/net-analyzer/ipcad/ipcad-3.7.ebuild @@ -1,6 +1,8 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/ipcad/ipcad-3.7.ebuild,v 1.2 2006/02/15 23:06:54 jokey Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/ipcad/ipcad-3.7.ebuild,v 1.3 2006/06/14 13:33:31 pva Exp $ + +inherit eutils DESCRIPTION="IP Cisco Accounting Daemon" HOMEPAGE="http://ipcad.sourceforge.net/" @@ -10,11 +12,16 @@ SLOT="0" KEYWORDS="~ppc ~x86" IUSE="" -DEPEND=">=sys-apps/sed-4" - -RDEPEND="net-libs/libpcap +DEPEND="net-libs/libpcap net-firewall/iptables" +src_unpack() { + unpack ${A} + cd ${S} + + epatch ${FILESDIR}/${P}-20060614-cvs.patch +} + src_install() { sed -i -e "s/^chroot = \/adm\/tmp;/chroot = \/var\/ipcad;/" ipcad.conf.default sed -i -e "s/^interface/#interface/" ipcad.conf.default |