aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaas Freitag <freitag@suse.de>1998-04-15 15:29:22 +0000
committerKlaas Freitag <freitag@suse.de>1998-04-15 15:29:22 +0000
commit0456b54a8c00963d4c9e83ac40c45d3aabebb2ee (patch)
treea25810bc08849b6e7db9f8cd14be6cdd69753d75 /statistics.c
parentMake it compile without econet. (diff)
downloadnet-tools-0456b54a8c00963d4c9e83ac40c45d3aabebb2ee.tar.gz
net-tools-0456b54a8c00963d4c9e83ac40c45d3aabebb2ee.tar.bz2
net-tools-0456b54a8c00963d4c9e83ac40c45d3aabebb2ee.zip
Add OutRsts and InErrs fields for TCP.
Diffstat (limited to 'statistics.c')
-rw-r--r--statistics.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/statistics.c b/statistics.c
index dcd9d9a..a6e4d19 100644
--- a/statistics.c
+++ b/statistics.c
@@ -5,6 +5,14 @@
#include <stdlib.h>
#include <string.h>
+/* #define WARN 1 */
+
+#ifdef WARN
+#define UFWARN(x) x
+#else
+#define UFWARN(x)
+#endif
+
int print_static;
enum State { number = 0, i_forward, i_inp_icmp, i_outp_icmp, i_rto_alg };
@@ -95,6 +103,8 @@ struct entry Tcptab[] = {
{ "InSegs", "%d segments received", number },
{ "OutSegs", "%d segments send out", number },
{ "RetransSegs", "%d segments retransmited", number },
+ { "InErrs", "%d bad segments received.", number },
+ { "OutRsts", "%d resets sent", number },
};
struct entry Udptab[] = {
@@ -142,8 +152,10 @@ void printval(struct tabtab *tab, char *title, int val)
key.title = title;
ent = bsearch(&key, tab->tab, tab->size/sizeof(struct entry),
sizeof(struct entry), cmpentries);
- if (!ent) /* XXX warning */
+ if (!ent) {
+ UFWARN((printf("unknown field %s\n", title)));
return;
+ }
type = ent->type;
if (type & I_STATIC) {
type &= ~I_STATIC;
@@ -220,8 +232,10 @@ void parsesnmp()
goto formaterr;
*sp = '\0';
tab = newtable(snmptabs, buf1);
- if (tab == NULL) /* XXX print warning */
+ if (tab == NULL) {
+ UFWARN((printf("unknown title %s\n", buf1)));
continue;
+ }
np++; sp++;
endflag = 0;
@@ -233,7 +247,9 @@ void parsesnmp()
p = skiptok(sp);
if (*p == '\0') endflag=1;
*p = '\0';
- printval(tab, sp, strtoul(np,&np,10));
+
+ if (*sp != '\0') /* XXX */
+ printval(tab, sp, strtoul(np,&np,10));
sp = p+1;
}
}