diff options
author | Edwin Groothuis <edwin@FreeBSD.org> | 2002-11-16 14:36:35 +0000 |
---|---|---|
committer | Edwin Groothuis <edwin@FreeBSD.org> | 2002-11-16 14:36:35 +0000 |
commit | 7288714b1cabf5304ebf87e878c44a514d991d0d (patch) | |
tree | 004adeb65054e6df994971bd3f9e8caa47e83d46 /net-mgmt/ehnt | |
parent | d3674bb370dcfce2f4723e92fac4f958df0e5a48 (diff) | |
download | ports-7288714b1cabf5304ebf87e878c44a514d991d0d.tar.gz ports-7288714b1cabf5304ebf87e878c44a514d991d0d.zip |
Maintainer update to version 0.3_2
PR: ports/45296
Submitted by: Dmitry Morozovsky <marck@rinet.ru>
Notes
Notes:
svn path=/head/; revision=70249
Diffstat (limited to 'net-mgmt/ehnt')
-rw-r--r-- | net-mgmt/ehnt/Makefile | 2 | ||||
-rw-r--r-- | net-mgmt/ehnt/files/patch-config-h | 21 | ||||
-rw-r--r-- | net-mgmt/ehnt/files/patch-ehnt__client.c | 14 | ||||
-rw-r--r-- | net-mgmt/ehnt/files/patch-ehnt__processflow.c | 14 | ||||
-rw-r--r-- | net-mgmt/ehnt/files/patch-ehntserv.c | 176 |
5 files changed, 219 insertions, 8 deletions
diff --git a/net-mgmt/ehnt/Makefile b/net-mgmt/ehnt/Makefile index e02f1594367e..e05bc812b5a4 100644 --- a/net-mgmt/ehnt/Makefile +++ b/net-mgmt/ehnt/Makefile @@ -7,7 +7,7 @@ PORTNAME= ehnt PORTVERSION= 0.3 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME} diff --git a/net-mgmt/ehnt/files/patch-config-h b/net-mgmt/ehnt/files/patch-config-h index 28d975604eb3..0c7607a95b4f 100644 --- a/net-mgmt/ehnt/files/patch-config-h +++ b/net-mgmt/ehnt/files/patch-config-h @@ -1,11 +1,18 @@ ---- config.h.orig Wed Jul 18 00:47:37 2001 -+++ config.h Fri Aug 3 19:57:51 2001 -@@ -27,3 +27,8 @@ - #define DEFAULT_UDP_PORT 4444 + +$FreeBSD$ + +--- config.h.orig Thu Oct 4 22:18:29 2001 ++++ config.h Thu Nov 14 22:20:47 2002 +@@ -32,4 +32,12 @@ /* The default mode of the client. Can be either EM_REPORT or EM_DUMP.*/ - #define EM_DEFAULT EM_REPORT -+ + #define EM_DEFAULT EM_TOP + +#ifndef ASNCDIR +#define ASNCDIR "." +#endif -+ + ++/* Default size of socket buffer. FreeBSD default is Limited to 256k, ++ + * but misteriously enough maximum space available for buf is 233016 */ ++#define DEFAULT_SOCKBUF (192*1024) ++/* Reasonable minimum socket buffer size. I assume it's about 16k */ ++#define MIN_SOCKBUF (16*1024) diff --git a/net-mgmt/ehnt/files/patch-ehnt__client.c b/net-mgmt/ehnt/files/patch-ehnt__client.c new file mode 100644 index 000000000000..a518e52f5eca --- /dev/null +++ b/net-mgmt/ehnt/files/patch-ehnt__client.c @@ -0,0 +1,14 @@ + +$FreeBSD$ + +--- ehnt_client.c.orig Thu Oct 4 22:18:29 2001 ++++ ehnt_client.c Thu Nov 14 22:12:07 2002 +@@ -89,7 +89,7 @@ + if (FD_ISSET(sockfd,&read_fds)) { + ehnt_client_processmessage(sockfd,routeraddr,my_ehnt_struct); + } +- if (FD_ISSET(STDIN_FILENO,&read_fds)) { ++ if (e_cfg->mode != EM_COLONDUMP && FD_ISSET(STDIN_FILENO,&read_fds)) { + char key; + key=getkey(); + switch (key) { diff --git a/net-mgmt/ehnt/files/patch-ehnt__processflow.c b/net-mgmt/ehnt/files/patch-ehnt__processflow.c new file mode 100644 index 000000000000..7441034b9ceb --- /dev/null +++ b/net-mgmt/ehnt/files/patch-ehnt__processflow.c @@ -0,0 +1,14 @@ + +$FreeBSD$ + +--- ehnt_processflow.c.orig Thu Oct 4 22:18:29 2001 ++++ ehnt_processflow.c Thu Nov 14 22:17:18 2002 +@@ -218,7 +218,7 @@ + dstip.s_addr=rec->dstaddr; + nexthop.s_addr=rec->nexthop; + +- printf("%.0f:%s",local_flowcount,routeraddr_string); ++ printf("%.0f:%s:",local_flowcount,routeraddr_string); + printf("%d:%s:%d:", + rec->input_index, + inet_ntoa(srcip), diff --git a/net-mgmt/ehnt/files/patch-ehntserv.c b/net-mgmt/ehnt/files/patch-ehntserv.c new file mode 100644 index 000000000000..71703c65150b --- /dev/null +++ b/net-mgmt/ehnt/files/patch-ehntserv.c @@ -0,0 +1,176 @@ + +$FreeBSD$ + +--- ehntserv.c.orig Thu Oct 4 22:18:29 2001 ++++ ehntserv.c Thu Nov 14 22:18:40 2002 +@@ -33,8 +33,8 @@ + #define MAXCLIENTS 256 + #define MAXPACKET 8192 + +-int SetUDPOpts(int); +-int SetTCPOpts(int); ++int SetUDPOpts(int, int); ++int SetTCPOpts(int, int); + + int debug; + int use_syslog; +@@ -54,6 +54,8 @@ + int packetcounter=0; + extern char *optarg; + int c_udpport, c_tcpport; ++ int one = -1; ++ int bufsize = DEFAULT_SOCKBUF; + + debug=0; + use_syslog=0; +@@ -61,7 +63,7 @@ + c_udpport=DEFAULT_UDP_PORT; + c_tcpport=DEFAULT_TCP_PORT; + +- while( (c=getopt(argc,argv,"u:t:d")) != -1) { ++ while( (c=getopt(argc,argv,"u:t:s:d")) != -1) { + + switch(c) { + case 'u': +@@ -70,6 +72,13 @@ + case 't': + sscanf(optarg,"%d",&c_tcpport); + break; ++ case 's': ++ sscanf(optarg,"%d",&bufsize); ++ if (bufsize < MIN_SOCKBUF) { ++ perror("too low buffer size or bad format: %s", optarg); ++ exit(1); ++ } ++ break; + case 'd': + debug=1; + break; +@@ -77,6 +86,7 @@ + printf("Usage: %s [ -u <udpport> ] [ -t <tcpport> ]\n",argv[0]); + printf(" -u <udpport> Listen on UDP port <udpport> for netflow packets. Default %d\n",DEFAULT_UDP_PORT); + printf(" -t <tcpport> Listen on TCP port <tcpport> for client connections. Default %d\n",DEFAULT_TCP_PORT); ++ printf(" -s <bufsize> Set tcp/udp buffer size. Default %d\n",DEFAULT_SOCKBUF); + printf(" -d Debug. Don't become a daemon, displays all messages on stdout,"); + printf(" displays lots of extra information\n"); + exit(0); +@@ -87,22 +97,22 @@ + + /* set up the netflow udp socket */ + if ( (nf_fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) +- { log_error("socket (udp) error"); exit(0); } ++ { log_error("socket (udp) error"); exit(1); } + memset(&nf_servaddr,0,sizeof(nf_servaddr)); + nf_servaddr.sin_family = AF_INET; + nf_servaddr.sin_addr.s_addr = htonl(INADDR_ANY); + nf_servaddr.sin_port = htons(c_udpport); + if ( bind(nf_fd, (struct sockaddr *) &nf_servaddr, sizeof(nf_servaddr)) < 0) +- { log_error("bind UDP error"); exit(0); } ++ { log_error("bind UDP error"); exit(1); } + +- SetUDPOpts(nf_fd); ++ SetUDPOpts(nf_fd, bufsize); + + nf_clilen = (socklen_t) sizeof(nf_cliaddr); + l_clilen = (socklen_t) sizeof(l_cliaddr); + + /* set up the listening tcp socket*/ + if ( (l_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) +- { log_error("socket (tcp) error"); exit(0); } ++ { log_error("socket (tcp) error"); exit(1); } + memset(&l_servaddr,0,sizeof(l_servaddr)); + l_servaddr.sin_family = AF_INET; + l_servaddr.sin_addr.s_addr = htonl(INADDR_ANY); +@@ -112,9 +122,9 @@ + setsockopt(l_fd, SOL_SOCKET, SO_REUSEADDR, (void*)&one, sizeof(one)); + } + if ( bind(l_fd,(struct sockaddr *) &l_servaddr, sizeof(l_servaddr)) < 0) +- { log_error ("bind TCP error"); exit(0); } ++ { log_error ("bind TCP error"); exit(1); } + if ( listen(l_fd, 32) < 0) +- { log_error("listen error"); exit(0); } ++ { log_error("listen error"); exit(1); } + printf("Listening on UDP port %d and TCP port %d (with a backlog of 32)\n",c_udpport,c_tcpport); + memset(l_clients,0,sizeof(l_clients)); + +@@ -157,7 +167,7 @@ + } + + if ( (c=select(maxfd+1,&read_fds,NULL,NULL,NULL)) < 0) +- { log_error("select (read) error"); exit(0); } ++ { log_error("select (read) error"); exit(1); } + + if (FD_ISSET(nf_fd,&read_fds)) { /*a netflow message is waiting*/ + +@@ -168,7 +178,7 @@ + /* new packet */ + if ( (nf_rcount=recvfrom(nf_fd,(char *)(nf_packet + sizeof(nf_cliaddr.sin_addr.s_addr)), + MAXPACKET,0,(struct sockaddr *)&nf_cliaddr,&nf_clilen)) < 0) +- { log_error("recvfrom error"); exit(0); } ++ { log_error("recvfrom error"); exit(1); } + + /* Here we use a non-blocking select to find out which tcp clients we + can write to. This ensures the write won't block, which would of course +@@ -189,7 +199,7 @@ + timeout.tv_sec=0; + timeout.tv_usec=0; + if ( (c=select(maxfd+1,NULL,&write_fds,NULL,&timeout)) < 0) +- { log_error("select (write) error"); exit(0); } ++ { log_error("select (write) error"); exit(1); } + for (i=0; i<MAXCLIENTS; i++) { + if (l_clients[i] > 0) { + if (FD_ISSET(l_clients[i],&write_fds)) { +@@ -220,9 +230,9 @@ + /* printf("incoming connection on tcp 4444\n");*/ + l_addrlen=sizeof(l_cliaddr); + if ( (l_connfd = accept(l_fd,(struct sockaddr *) l_cliaddr, &l_addrlen)) < 0) +- { log_error("accept error"); exit(0); } ++ { log_error("accept error"); exit(1); } + +- SetTCPOpts(l_connfd); ++ SetTCPOpts(l_connfd, bufsize); + + for (i=0; i<MAXCLIENTS; i++) { + if (l_clients[i]==0) { +@@ -268,25 +278,26 @@ + } + + /* Increase our receive buffer for nf_fd: */ +-int SetUDPOpts(int fd){ +- int r,p,n; ++int SetUDPOpts(int fd, int rcvsize){ ++ int r,p; + socklen_t optlen; + +- n=512*1024; + optlen = sizeof(p); + + if (debug) { + r=getsockopt(fd,SOL_SOCKET,SO_RCVBUF,&p,&optlen); + printf("Before setsockopt, SO_RCVBUF is %d\n",p); + } +- r=setsockopt(fd,SOL_SOCKET,SO_RCVBUF,&n,sizeof(n)); ++ if (setsockopt(fd,SOL_SOCKET,SO_RCVBUF,&rcvsize,sizeof(rcvsize)) < 0) { ++ perror("setsockopt SO_RCVBUF:"); ++ } + if (debug) { + r=getsockopt(fd,SOL_SOCKET,SO_RCVBUF,&p,&optlen); + printf("After setsockopt, SO_RCVBUF is %d\n",p); + } + } + +-int SetTCPOpts(int fd) { ++int SetTCPOpts(int fd, int bufsize) { + int r,p,n; + socklen_t optlen; + +@@ -296,8 +307,7 @@ + r=getsockopt(fd,SOL_SOCKET,SO_SNDBUF,&p,&optlen); + printf("Before setsockopt, SO_SNDBUF is %d\n",p); + } +- n=512*1024; +- r=setsockopt(fd,SOL_SOCKET,SO_SNDBUF,&n,sizeof(n)); ++ r=setsockopt(fd,SOL_SOCKET,SO_SNDBUF,&bufsize,sizeof(bufsize)); + if (r<0) { log_error("setsockopt SO_SNDBUF"); } + if (debug) { + r=getsockopt(fd,SOL_SOCKET,SO_SNDBUF,&p,&optlen); |