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
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
Responsible Changed From-To: freebsd-ports-bugs->billf Over to maintainer.
State Changed From-To: open->closed I committed the mysql/pgsql part; I'm unsure fixing compiler warnings is needed.