1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
Description: Make program compile and work on Linux.
Author: Michael Meskes <meskes@debian.org>
--- netdiag-1.0.orig/statnet-3.8/statnet.c
+++ netdiag-1.0/statnet-3.8/statnet.c
@@ -12,6 +12,8 @@
#include "curs.h"
#include <signal.h>
#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#ifdef IPC_DIPC
@@ -187,7 +189,7 @@ main (int argc, char *argv[])
if( errno == ENOENT ) fprintf( stderr, "Was \"statnetd -d\" run by root?\n" );
exit (6);
} /* error, could not find shared memory segment */
- if(( (char *)StatMem = (struct StatMemStruct *)shmat(shmid, 0, SHM_RDONLY) ) == (char *)-1)
+ if(( (char *)(StatMem = (struct StatMemStruct *)shmat(shmid, 0, SHM_RDONLY)) ) == (char *)-1)
{ /* if error in attaching with read permission */
perror ("Can't attach shared memory");
exit (7);
@@ -360,7 +362,7 @@ main (int argc, char *argv[])
Prev.sap_types.c_labels = (char *)sap_port_types[0];
timeout( SN_UPDATE_SECS * 1000 );
} /* do while no keystroke */
- while ( ( in_char=getch() ) == ERR );
+ while ( ( in_char=getch() ) == ERR && !shutdown_flag);
if( ( in_char ) != ERR )
{ /* if keystroke given */
--- netdiag-1.0.orig/statnet-3.8/statnetd.c
+++ netdiag-1.0/statnet-3.8/statnetd.c
@@ -14,6 +14,9 @@
#include <signal.h>
#include <stdio.h>
#include <sys/utsname.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <sys/ipc.h>
#ifdef IPC_DIPC
@@ -261,7 +264,7 @@ main (int argc, char *argv[])
} /* error, could not find shared memory segment */
} /* if it might already exist, use it */
- if(( (char *)StatMem = (struct StatMemStruct *)shmat(shmid, 0, 0) ) == (char *)-1)
+ if(((char *)(StatMem = (struct StatMemStruct *)shmat(shmid, 0, 0)) ) == (char *)-1)
{ /* if error in attaching with write permission */
perror ("Can't attach shared memory");
exit (7);
@@ -512,10 +515,12 @@ handle_other (unsigned char *buf, int le
}
void
-handle_ip (struct ip *buf, int length)
+handle_ip (struct ip *argbuf, int length)
{
static int src_port, dest_port;
+ struct ip bufstruct, *buf = &bufstruct;
+ memcpy(buf, argbuf, sizeof(struct ip)); /* to fix unaligned accesses */
if (buf->ip_p < StatMem->ip_types.c_max)
{ /* if IP protocol type is to be tallied */
tally( buf->ip_p, &StatMem->ip_types ); /* count IP protocol */
--- netdiag-1.0.orig/statnet-3.8/set_null.c
+++ netdiag-1.0/statnet-3.8/set_null.c
@@ -2,8 +2,8 @@
/* Statnet is protected under the GNU Public License (GPL2). */
/* Author: Jeroen Baekelandt (jeroenb@igwe.vub.ac.be) */
-
#include "stat.h"
+#include <string.h>
void
set_null ( struct StatMemStruct *StatMem )
--- netdiag-1.0.orig/statnet-3.8/tally_init.c
+++ netdiag-1.0/statnet-3.8/tally_init.c
@@ -6,6 +6,7 @@
/* This initializes a struct Tally item. */
#include <values.h>
+#include <string.h>
#include "stat.h"
void tally_init ( struct Tally *ts,
--- netdiag-1.0.orig/statnet-3.8/statnet.1.proto
+++ netdiag-1.0/statnet-3.8/statnet.1.proto
@@ -1,5 +1,5 @@
.\" "%W% %G%"
-.TH STATNET\ __SNVERSION__ 1
+.TH STATNET 1
.SH NAME
statnet,statnetd \- views the statistics of Ethernet and PLIP/PPP/SLIP for TCP, IP,
IPX, Appletalk, etc
--- netdiag-1.1/statnet-3.8/Makefile 2002-12-21 21:26:37.000000000 +0100
+++ netdiag-1.1/statnet-3.8/Makefile 2014-11-08 06:57:15.317297260 +0100
@@ -2,7 +2,7 @@
UPDATED= 21DEC2002
# You might need to say where the ncurses or curses include files are.
-CFLAGS=-I/usr/include/ncurses -g
+CFLAGS+=-I/usr/include/ncurses -g
# CFLAGS=
CC=gcc
EXEC= statnet
|