|
|
90b4e5c |
diff -up net-tools-1.60/netstat.c.sctp net-tools-1.60/netstat.c
|
|
|
90b4e5c |
--- net-tools-1.60/netstat.c.sctp 2011-12-06 16:28:09.726243816 +0100
|
|
|
90b4e5c |
+++ net-tools-1.60/netstat.c 2011-12-06 16:28:09.769243277 +0100
|
|
|
90b4e5c |
@@ -112,7 +112,7 @@
|
|
|
90b4e5c |
#endif
|
|
|
90b4e5c |
|
|
|
90b4e5c |
/* prototypes for statistics.c */
|
|
|
90b4e5c |
-int parsesnmp(int, int, int);
|
|
|
90b4e5c |
+int parsesnmp(int, int, int, int);
|
|
|
90b4e5c |
void inittab(void);
|
|
|
90b4e5c |
int parsesnmp6(int, int, int);
|
|
|
90b4e5c |
void inittab6(void);
|
|
|
90b4e5c |
@@ -2093,7 +2093,7 @@ int main
|
|
|
90b4e5c |
if (!strcmp(afname, "inet")) {
|
|
|
90b4e5c |
#if HAVE_AFINET
|
|
|
90b4e5c |
inittab();
|
|
|
90b4e5c |
- i = parsesnmp(flag_raw, flag_tcp, flag_udp);
|
|
|
90b4e5c |
+ i = parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp);
|
|
|
90b4e5c |
#else
|
|
|
90b4e5c |
ENOSUPP("netstat", "AF INET");
|
|
|
90b4e5c |
#endif
|
|
|
90b4e5c |
diff -up net-tools-1.60/statistics.c.sctp net-tools-1.60/statistics.c
|
|
|
90b4e5c |
--- net-tools-1.60/statistics.c.sctp 2011-12-06 16:28:09.705244079 +0100
|
|
|
90b4e5c |
+++ net-tools-1.60/statistics.c 2011-12-06 16:28:49.128751215 +0100
|
|
|
90b4e5c |
@@ -21,7 +21,7 @@
|
|
|
90b4e5c |
#define UFWARN(x)
|
|
|
90b4e5c |
#endif
|
|
|
90b4e5c |
|
|
|
90b4e5c |
-int print_static,f_raw,f_tcp,f_udp,f_unknown = 1;
|
|
|
90b4e5c |
+int print_static,f_raw,f_tcp,f_udp,f_sctp,f_unknown = 1;
|
|
|
90b4e5c |
|
|
|
90b4e5c |
enum State {
|
|
|
90b4e5c |
number = 0, opt_number, i_forward, i_inp_icmp, i_outp_icmp, i_rto_alg,
|
|
|
90b4e5c |
@@ -299,6 +299,27 @@ struct entry Tcpexttab[] =
|
|
|
90b4e5c |
{ "TCPRenoRecoveryFail", N_("%llu classic Reno fast retransmits failed"), opt_number },
|
|
|
90b4e5c |
};
|
|
|
90b4e5c |
|
|
|
90b4e5c |
+struct entry Sctptab[] =
|
|
|
90b4e5c |
+{
|
|
|
90b4e5c |
+ {"SctpCurrEstab", N_("%llu Current Associations"), number},
|
|
|
90b4e5c |
+ {"SctpActiveEstabs", N_("%llu Active Associations"), number},
|
|
|
90b4e5c |
+ {"SctpPassiveEstabs", N_("%llu Passive Associations"), number},
|
|
|
90b4e5c |
+ {"SctpAborteds", N_("%llu Number of Aborteds "), number},
|
|
|
90b4e5c |
+ {"SctpShutdowns", N_("%llu Number of Graceful Terminations"), number},
|
|
|
90b4e5c |
+ {"SctpOutOfBlues", N_("%llu Number of Out of Blue packets"), number},
|
|
|
90b4e5c |
+ {"SctpChecksumErrors", N_("%llu Number of Packets with invalid Checksum"), number},
|
|
|
90b4e5c |
+ {"SctpOutCtrlChunks", N_("%llu Number of control chunks sent"), number},
|
|
|
90b4e5c |
+ {"SctpOutOrderChunks", N_("%llu Number of ordered chunks sent"), number},
|
|
|
90b4e5c |
+ {"SctpOutUnorderChunks", N_("%llu Number of Unordered chunks sent"), number},
|
|
|
90b4e5c |
+ {"SctpInCtrlChunks", N_("%llu Number of control chunks received"), number},
|
|
|
90b4e5c |
+ {"SctpInOrderChunks", N_("%llu Number of ordered chunks received"), number},
|
|
|
90b4e5c |
+ {"SctpInUnorderChunks", N_("%llu Number of Unordered chunks received"), number},
|
|
|
90b4e5c |
+ {"SctpFragUsrMsgs", N_("%llu Number of messages fragmented"), number},
|
|
|
90b4e5c |
+ {"SctpReasmUsrMsgs", N_("%llu Number of messages reassembled "), number},
|
|
|
90b4e5c |
+ {"SctpOutSCTPPacks", N_("%llu Number of SCTP packets sent"), number},
|
|
|
90b4e5c |
+ {"SctpInSCTPPacks", N_("%llu Number of SCTP packets received"), number},
|
|
|
90b4e5c |
+};
|
|
|
90b4e5c |
+
|
|
|
90b4e5c |
struct tabtab {
|
|
|
90b4e5c |
char *title;
|
|
|
90b4e5c |
struct entry *tab;
|
|
|
90b4e5c |
@@ -312,6 +333,7 @@ struct tabtab snmptabs[] =
|
|
|
90b4e5c |
{"Icmp", Icmptab, sizeof(Icmptab), &f_raw},
|
|
|
90b4e5c |
{"Tcp", Tcptab, sizeof(Tcptab), &f_tcp},
|
|
|
90b4e5c |
{"Udp", Udptab, sizeof(Udptab), &f_udp},
|
|
|
90b4e5c |
+ {"Sctp", Sctptab, sizeof(Sctptab), &f_sctp},
|
|
|
90b4e5c |
{"TcpExt", Tcpexttab, sizeof(Tcpexttab), &f_tcp},
|
|
|
90b4e5c |
{NULL}
|
|
|
90b4e5c |
};
|
|
|
90b4e5c |
@@ -502,11 +524,37 @@ void process6_fd(FILE *f)
|
|
|
90b4e5c |
|
|
|
90b4e5c |
}
|
|
|
90b4e5c |
|
|
|
90b4e5c |
-int parsesnmp(int flag_raw, int flag_tcp, int flag_udp)
|
|
|
90b4e5c |
+/* Process a file with name-value lines (like /proc/net/sctp/snmp) */
|
|
|
90b4e5c |
+void process_fd2(FILE *f, const char *filename)
|
|
|
90b4e5c |
+{
|
|
|
90b4e5c |
+ char buf1[1024];
|
|
|
90b4e5c |
+ char *sp;
|
|
|
90b4e5c |
+ struct tabtab *tab;
|
|
|
90b4e5c |
+
|
|
|
90b4e5c |
+ tab = newtable(snmptabs, "Sctp");
|
|
|
90b4e5c |
+
|
|
|
90b4e5c |
+ while (fgets(buf1, sizeof buf1, f)) {
|
|
|
90b4e5c |
+ sp = buf1 + strcspn(buf1, " \t\n");
|
|
|
90b4e5c |
+ if (!sp) {
|
|
|
90b4e5c |
+ fprintf(stderr,_("error parsing %s\n"), filename);
|
|
|
90b4e5c |
+ return;
|
|
|
90b4e5c |
+ }
|
|
|
90b4e5c |
+ *sp = '\0';
|
|
|
90b4e5c |
+ sp++;
|
|
|
90b4e5c |
+
|
|
|
90b4e5c |
+ sp += strspn(sp, " \t\n");
|
|
|
90b4e5c |
+
|
|
|
90b4e5c |
+ if (*sp != '\0' && *(tab->flag))
|
|
|
90b4e5c |
+ printval(tab, buf1, strtoul(sp, 0, 10));
|
|
|
90b4e5c |
+ }
|
|
|
90b4e5c |
+ return;
|
|
|
90b4e5c |
+}
|
|
|
90b4e5c |
+
|
|
|
90b4e5c |
+int parsesnmp(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp)
|
|
|
90b4e5c |
{
|
|
|
90b4e5c |
FILE *f;
|
|
|
90b4e5c |
|
|
|
90b4e5c |
- f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp;
|
|
|
90b4e5c |
+ f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp; f_sctp = flag_sctp;
|
|
|
90b4e5c |
|
|
|
90b4e5c |
f = proc_fopen("/proc/net/snmp");
|
|
|
90b4e5c |
if (!f) {
|
|
|
90b4e5c |
@@ -539,6 +587,17 @@ int parsesnmp(int flag_raw, int flag_tcp
|
|
|
90b4e5c |
|
|
|
90b4e5c |
fclose(f);
|
|
|
90b4e5c |
}
|
|
|
90b4e5c |
+
|
|
|
90b4e5c |
+ f = proc_fopen("/proc/net/sctp/snmp");
|
|
|
90b4e5c |
+ if (f) {
|
|
|
90b4e5c |
+ process_fd2(f,"/proc/net/sctp/snmp");
|
|
|
90b4e5c |
+ if (ferror(f)) {
|
|
|
90b4e5c |
+ perror("/proc/net/sctp/snmp");
|
|
|
90b4e5c |
+ fclose(f);
|
|
|
90b4e5c |
+ return(1);
|
|
|
90b4e5c |
+ }
|
|
|
90b4e5c |
+ }
|
|
|
90b4e5c |
+
|
|
|
90b4e5c |
return(0);
|
|
|
90b4e5c |
}
|
|
|
90b4e5c |
|