mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
Complete r326363 by including more complete set of headers.
Fix one incorrecr usage of perror(3). No functional changes. Notified by: pkg-fallout
This commit is contained in:
parent
644b855b6e
commit
0379fcaf6f
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=327054
3 changed files with 49 additions and 26 deletions
|
@ -1,9 +1,17 @@
|
|||
|
||||
$FreeBSD$
|
||||
|
||||
--- ehnt.h.orig Thu Oct 4 22:18:29 2001
|
||||
+++ ehnt.h Wed Jun 23 14:35:08 2004
|
||||
@@ -59,6 +59,7 @@
|
||||
--- ehnt.h.orig
|
||||
+++ ehnt.h
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
@@ -59,6 +60,7 @@
|
||||
|
||||
struct ehnt_stats {
|
||||
double InBoundTotal, OutBoundTotal;
|
||||
|
@ -11,7 +19,7 @@ $FreeBSD$
|
|||
double *InBoundSrcAS, *InBoundDstAS, *OutBoundSrcAS, *OutBoundDstAS;
|
||||
double *InBoundProto, *OutBoundProto;
|
||||
double *InBoundSrcTcpPort, *InBoundDstTcpPort,
|
||||
@@ -93,7 +94,7 @@
|
||||
@@ -93,7 +95,7 @@
|
||||
int ProcessFlow(struct flow_ver5_rec *, struct in_addr *, struct ehnt_struct *);
|
||||
int Init_ASN_Lookups(void);
|
||||
char * ASN_Lookup(int);
|
||||
|
|
|
@ -3,17 +3,19 @@ $FreeBSD$
|
|||
|
||||
--- ehnt_client.c.orig
|
||||
+++ ehnt_client.c
|
||||
@@ -27,6 +27,9 @@
|
||||
@@ -27,6 +27,11 @@
|
||||
static void sig_int (int);
|
||||
char getkey();
|
||||
|
||||
+
|
||||
+ssize_t read_n(int fd, void *vptr, size_t n);
|
||||
+
|
||||
+void ehnt_client_processmessage(int sockfd,struct in_addr routeraddr, struct ehnt_struct *my_ehnt_struct);
|
||||
+
|
||||
int ehnt_client(char * servername, int serverport, struct ehnt_struct *my_ehnt_struct ) {
|
||||
char ips[100];
|
||||
int c;
|
||||
@@ -69,7 +72,8 @@
|
||||
@@ -69,7 +74,8 @@
|
||||
printf("Warning: can't catch interrupt signal\n");
|
||||
}
|
||||
fflush(stdout);
|
||||
|
@ -23,7 +25,7 @@ $FreeBSD$
|
|||
setbuf(stdout,NULL);
|
||||
|
||||
for ( ; ; ) {
|
||||
@@ -78,7 +82,8 @@
|
||||
@@ -78,7 +84,8 @@
|
||||
int maxfd=sockfd;
|
||||
|
||||
FD_ZERO(&read_fds);
|
||||
|
@ -33,7 +35,7 @@ $FreeBSD$
|
|||
FD_SET(sockfd,&read_fds);
|
||||
|
||||
fflush(stdout);
|
||||
@@ -89,7 +94,7 @@
|
||||
@@ -89,7 +96,7 @@
|
||||
if (FD_ISSET(sockfd,&read_fds)) {
|
||||
ehnt_client_processmessage(sockfd,routeraddr,my_ehnt_struct);
|
||||
}
|
||||
|
@ -42,7 +44,7 @@ $FreeBSD$
|
|||
char key;
|
||||
key=getkey();
|
||||
switch (key) {
|
||||
@@ -125,7 +130,7 @@
|
||||
@@ -125,7 +132,7 @@
|
||||
} /* for ( ; ; ) */
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,23 @@
|
|||
|
||||
$FreeBSD$
|
||||
|
||||
--- ehntserv.c.orig Thu Oct 4 22:18:29 2001
|
||||
+++ ehntserv.c Fri May 30 14:16:22 2003
|
||||
@@ -33,8 +33,8 @@
|
||||
--- ehntserv.c.orig
|
||||
+++ ehntserv.c
|
||||
@@ -23,9 +23,13 @@
|
||||
#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
+#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
#include <signal.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <syslog.h>
|
||||
#include "config.h"
|
||||
@@ -33,8 +37,8 @@
|
||||
#define MAXCLIENTS 256
|
||||
#define MAXPACKET 8192
|
||||
|
||||
|
@ -14,7 +28,7 @@ $FreeBSD$
|
|||
|
||||
int debug;
|
||||
int use_syslog;
|
||||
@@ -54,6 +54,8 @@
|
||||
@@ -54,6 +58,8 @@
|
||||
int packetcounter=0;
|
||||
extern char *optarg;
|
||||
int c_udpport, c_tcpport;
|
||||
|
@ -23,7 +37,7 @@ $FreeBSD$
|
|||
|
||||
debug=0;
|
||||
use_syslog=0;
|
||||
@@ -61,7 +63,7 @@
|
||||
@@ -61,7 +67,7 @@
|
||||
c_udpport=DEFAULT_UDP_PORT;
|
||||
c_tcpport=DEFAULT_TCP_PORT;
|
||||
|
||||
|
@ -32,21 +46,20 @@ $FreeBSD$
|
|||
|
||||
switch(c) {
|
||||
case 'u':
|
||||
@@ -70,6 +72,13 @@
|
||||
@@ -70,6 +76,12 @@
|
||||
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);
|
||||
+ err(1, "too low buffer size or bad format: %s", optarg);
|
||||
+ }
|
||||
+ break;
|
||||
case 'd':
|
||||
debug=1;
|
||||
break;
|
||||
@@ -77,6 +86,7 @@
|
||||
@@ -77,6 +89,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);
|
||||
|
@ -54,7 +67,7 @@ $FreeBSD$
|
|||
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 @@
|
||||
@@ -87,22 +100,22 @@
|
||||
|
||||
/* set up the netflow udp socket */
|
||||
if ( (nf_fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
|
||||
|
@ -81,7 +94,7 @@ $FreeBSD$
|
|||
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 @@
|
||||
@@ -112,9 +125,9 @@
|
||||
setsockopt(l_fd, SOL_SOCKET, SO_REUSEADDR, (void*)&one, sizeof(one));
|
||||
}
|
||||
if ( bind(l_fd,(struct sockaddr *) &l_servaddr, sizeof(l_servaddr)) < 0)
|
||||
|
@ -93,7 +106,7 @@ $FreeBSD$
|
|||
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 @@
|
||||
@@ -157,7 +170,7 @@
|
||||
}
|
||||
|
||||
if ( (c=select(maxfd+1,&read_fds,NULL,NULL,NULL)) < 0)
|
||||
|
@ -102,7 +115,7 @@ $FreeBSD$
|
|||
|
||||
if (FD_ISSET(nf_fd,&read_fds)) { /*a netflow message is waiting*/
|
||||
|
||||
@@ -168,7 +178,7 @@
|
||||
@@ -168,7 +181,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)
|
||||
|
@ -111,7 +124,7 @@ $FreeBSD$
|
|||
|
||||
/* 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 @@
|
||||
@@ -189,7 +202,7 @@
|
||||
timeout.tv_sec=0;
|
||||
timeout.tv_usec=0;
|
||||
if ( (c=select(maxfd+1,NULL,&write_fds,NULL,&timeout)) < 0)
|
||||
|
@ -120,7 +133,7 @@ $FreeBSD$
|
|||
for (i=0; i<MAXCLIENTS; i++) {
|
||||
if (l_clients[i] > 0) {
|
||||
if (FD_ISSET(l_clients[i],&write_fds)) {
|
||||
@@ -215,14 +225,14 @@
|
||||
@@ -215,14 +228,14 @@
|
||||
if (FD_ISSET(l_fd,&read_fds)) { /*we have a new TCP client*/
|
||||
int l_connfd,new_index=-1;
|
||||
socklen_t l_addrlen;
|
||||
|
@ -139,7 +152,7 @@ $FreeBSD$
|
|||
|
||||
for (i=0; i<MAXCLIENTS; i++) {
|
||||
if (l_clients[i]==0) {
|
||||
@@ -268,25 +278,26 @@
|
||||
@@ -268,25 +281,26 @@
|
||||
}
|
||||
|
||||
/* Increase our receive buffer for nf_fd: */
|
||||
|
@ -171,7 +184,7 @@ $FreeBSD$
|
|||
int r,p,n;
|
||||
socklen_t optlen;
|
||||
|
||||
@@ -296,8 +307,7 @@
|
||||
@@ -296,8 +310,7 @@
|
||||
r=getsockopt(fd,SOL_SOCKET,SO_SNDBUF,&p,&optlen);
|
||||
printf("Before setsockopt, SO_SNDBUF is %d\n",p);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue