Bug 73285 - net-mgmt/flow-tools port improvements
Summary: net-mgmt/flow-tools port improvements
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: bill fumerola
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-29 14:10 UTC by Yuri Bushmelev
Modified: 2005-12-09 14:35 UTC (History)
0 users

See Also:


Attachments
file.diff (443 bytes, patch)
2004-10-29 14:10 UTC, Yuri Bushmelev
no flags Details | Diff
file.diff (755 bytes, patch)
2004-10-29 14:10 UTC, Yuri Bushmelev
no flags Details | Diff
file.diff (478 bytes, patch)
2004-10-29 14:10 UTC, Yuri Bushmelev
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Bushmelev 2004-10-29 14:10:26 UTC
	1. Flow-tools can export flows data to postgresql and mysql databases. But port has no this functionality. I fix it with following patches.
	NOTE: mysql functionality has not been tested - I have no mysql right now. Sorry.
	2. Also fixed small bug in flow-tools, when making flow-export shows error about variable 'debug'. See following patches for details.

Fix: Patches start here:

====== /usr/ports/net-mgmt/flow-tools/Makefile patch ======
====== /usr/ports/net-mgmt/flow-tools/files/patch-configure-pgsql patch ======
====== /usr/ports/net-mgmt/flow-tools/files/patch-flow-export.c patch ======
How-To-Repeat: 	cd /usr/ports/net-mgmt/flow-tools && make
Comment 1 Yuri Bushmelev 2004-10-29 17:02:27 UTC
Hmm... flow-tools postgresql support seems more buggy..

I rewrite first and last patches:

====== /usr/ports/net-mgmt/flow-tools/Makefile patch ======
--- Makefile.orig       Fri Oct 29 16:08:11 2004
+++ Makefile    Fri Oct 29 19:55:35 2004
@@ -25,6 +25,18 @@
        flow-tag.1 flow-tools.1 flow-tools-examples.1           \
        flow-xlate.1

+.if defined(WITH_PGSQL)
+CONFIGURE_ARGS+=       --with-pgsql=${PREFIX}
+POSTGRESQL_PORT?=      databases/postgresql7
+LIB_DEPENDS=           pq.3:${PORTSDIR}/${POSTGRESQL_PORT}
+.endif
+
+.if defined(WITH_MYSQL)
+CONFIGURE_ARGS+=       --with-mysql=${PREFIX}
+USE_MYSQL=             yes
+DEFAULT_MYSQL_VER=     323
+.endif
+
 post-patch:
        ${TOUCH} -r ${WRKSRC}/configure.in.orig ${WRKSRC}/configure.in
        ${REINPLACE_CMD}\
====== end of patch ======


====== /usr/ports/net-mgmt/flow-tools/files/patch-flow-export.c patch ======
--- flow-export.c.orig	Fri Oct 29 19:27:49 2004
+++ flow-export.c	Fri Oct 29 19:31:02 2004
@@ -115,13 +115,14 @@
 struct jump format[] = {{format0}, {format1}, {format2}, {format3},
                         {format4}, {format5}};
 
+int debug=0;
+
 int main(int argc, char **argv)
 {
   int i, format_index, ret, ascii_mask;
   struct ftio ftio;
   struct ftprof ftp;
   struct options opt;
-  int debug;
 
   /* init fterr */
   fterr_setid(argv[0]);
@@ -864,8 +865,7 @@
   struct ftver ftv;
   char fields[1024], values[1024], query[3*1024];
   char *rec;
-  char *db_host, *db_name, *db_table, *db_user, *db_pwd, *db_tmp, *tmp;
-  char *db_port;
+  char *db_host, *db_name, *db_table, *db_user, *db_pwd, *db_port, *tmp;
   int len;
 
   PGconn     *conn;
@@ -891,7 +891,7 @@
     db_name = strsep(&tmp, ":");
     db_table = strsep(&tmp, ":");
 
-    if (!db_user || !db_pwd || !db_host || !db_tmp || !db_name || !db_table) {
+    if (!db_user || !db_pwd || !db_host || !db_port || !db_name || !db_table) {
       fterr_warnx("Missing field in dbaseURI, expecting user:pwd:host:port:name:table.");
       return -1;
     }
@@ -1199,10 +1199,10 @@
 
   if (xfields & FT_XFIELD_EXADDR) {
     if (comma) fmt_buf[len++] = ',';
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->exaddr)),
       FMT_JUST_LEFT);
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     comma = 1;
   }
 
@@ -1257,28 +1257,28 @@
 
   if (xfields & FT_XFIELD_SRCADDR) {
     if (comma) fmt_buf[len++] = ',';
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->srcaddr)),
       FMT_JUST_LEFT);
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     comma = 1;
   }
 
   if (xfields & FT_XFIELD_DSTADDR) {
     if (comma) fmt_buf[len++] = ',';
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->dstaddr)),
       FMT_JUST_LEFT);
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     comma = 1;
   }
 
   if (xfields & FT_XFIELD_NEXTHOP) {
     if (comma) fmt_buf[len++] = ',';
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->nexthop)),
       FMT_JUST_LEFT);
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     comma = 1;
   }
 
@@ -1375,19 +1375,19 @@
 
   if (xfields & FT_XFIELD_PEER_NEXTHOP) {
     if (comma) fmt_buf[len++] = ',';
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->peer_nexthop)),
       FMT_JUST_LEFT);
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     comma = 1;
   }
 
   if (xfields & FT_XFIELD_ROUTER_SC) {
     if (comma) fmt_buf[len++] = ',';
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     len += fmt_ipv4(fmt_buf+len, *((u_int32*)(rec+fo->router_sc)),
       FMT_JUST_LEFT);
-    if (quote) fmt_buf[len++] = '"';
+    if (quote) fmt_buf[len++] = '\'';
     comma = 1;
   }
====== end of patch ======

-- 
WBR, Jay
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2004-10-30 18:47:14 UTC
Responsible Changed
From-To: freebsd-ports-bugs->billf

Over to maintainer.
Comment 3 Pav Lucistnik freebsd_committer freebsd_triage 2005-12-09 14:34:50 UTC
State Changed
From-To: open->closed

I committed the mysql/pgsql part; I'm unsure fixing compiler warnings 
is needed.