ether-wake: add interface into message (#1149502)
This commit is contained in:
parent
9877bf51d6
commit
906023f3cc
@ -1,6 +1,6 @@
|
|||||||
diff -up net-tools-2.0/ether-wake.c.interfaces net-tools-2.0/ether-wake.c
|
diff -up net-tools-2.0/ether-wake.c.interfaces net-tools-2.0/ether-wake.c
|
||||||
--- net-tools-2.0/ether-wake.c.interfaces 2014-11-20 11:06:36.945067589 +0100
|
--- net-tools-2.0/ether-wake.c.interfaces 2015-09-15 18:02:18.595968129 +0200
|
||||||
+++ net-tools-2.0/ether-wake.c 2014-11-20 11:07:22.984416283 +0100
|
+++ net-tools-2.0/ether-wake.c 2015-09-15 18:02:18.607968095 +0200
|
||||||
@@ -22,7 +22,7 @@ static char usage_msg[] =
|
@@ -22,7 +22,7 @@ static char usage_msg[] =
|
||||||
" Options:\n"
|
" Options:\n"
|
||||||
" -b Send wake-up packet to the broadcast address.\n"
|
" -b Send wake-up packet to the broadcast address.\n"
|
||||||
@ -134,21 +134,39 @@ diff -up net-tools-2.0/ether-wake.c.interfaces net-tools-2.0/ether-wake.c
|
|||||||
if (ioctl(s, SIOCGIFINDEX, &ifr) == -1) {
|
if (ioctl(s, SIOCGIFINDEX, &ifr) == -1) {
|
||||||
fprintf(stderr, "SIOCGIFINDEX on %s failed: %s\n", ifname,
|
fprintf(stderr, "SIOCGIFINDEX on %s failed: %s\n", ifname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
@@ -240,11 +285,14 @@ int main(int argc, char *argv[])
|
||||||
|
strcpy(whereto.sa_data, ifname);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+ char senderrmsg[IFNAMSIZ+16] = "'";
|
||||||
|
+ strcat(senderrmsg, ifname);
|
||||||
|
+ strcat(senderrmsg, "', sendto");
|
||||||
|
if ((i = sendto(s, outpack, pktsize, 0, (struct sockaddr *)&whereto,
|
||||||
|
sizeof(whereto))) < 0)
|
||||||
|
- perror("sendto");
|
||||||
|
+ perror(senderrmsg);
|
||||||
|
else if (debug)
|
||||||
|
- printf("Sendto worked ! %d.\n", i);
|
||||||
|
+ printf("'%s', Sendto worked ! %d.\n", ifname, i);
|
||||||
|
|
||||||
|
#ifdef USE_SEND
|
||||||
|
if (bind(s, (struct sockaddr *)&whereto, sizeof(whereto)) < 0)
|
||||||
diff -up net-tools-2.0/Makefile.interfaces net-tools-2.0/Makefile
|
diff -up net-tools-2.0/Makefile.interfaces net-tools-2.0/Makefile
|
||||||
--- net-tools-2.0/Makefile.interfaces 2014-10-07 03:26:10.000000000 +0200
|
--- net-tools-2.0/Makefile.interfaces 2015-09-15 18:02:18.608968093 +0200
|
||||||
+++ net-tools-2.0/Makefile 2014-11-20 11:06:36.955067448 +0100
|
+++ net-tools-2.0/Makefile 2015-09-15 18:04:06.273668275 +0200
|
||||||
@@ -193,6 +193,8 @@ ipmaddr: $(NET_LIB) ipmaddr.o
|
@@ -193,6 +193,9 @@ ipmaddr: $(NET_LIB) ipmaddr.o
|
||||||
mii-tool: $(NET_LIB) mii-tool.o
|
mii-tool: $(NET_LIB) mii-tool.o
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mii-tool.o $(NLIB) $(RESLIB)
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mii-tool.o $(NLIB)
|
||||||
|
|
||||||
+ether-wake: $(NET_LIB) ether-wake.o
|
+ether-wake: $(NET_LIB) ether-wake.o
|
||||||
+ $(CC) $(LDFLAGS) -o ether-wake ether-wake.o $(NLIB)
|
+ $(CC) $(CFLAGS) $(LDFLAGS) -o ether-wake ether-wake.o $(NLIB)
|
||||||
|
+
|
||||||
installbin:
|
installbin:
|
||||||
@echo
|
@echo
|
||||||
@echo "######################################################"
|
@echo "######################################################"
|
||||||
diff -up net-tools-2.0/man/en_US/ether-wake.8.interfaces net-tools-2.0/man/en_US/ether-wake.8
|
diff -up net-tools-2.0/man/en_US/ether-wake.8.interfaces net-tools-2.0/man/en_US/ether-wake.8
|
||||||
--- net-tools-2.0/man/en_US/ether-wake.8.interfaces 2014-11-20 11:06:36.947067561 +0100
|
--- net-tools-2.0/man/en_US/ether-wake.8.interfaces 2015-09-15 18:02:18.597968123 +0200
|
||||||
+++ net-tools-2.0/man/en_US/ether-wake.8 2014-11-20 11:06:36.955067448 +0100
|
+++ net-tools-2.0/man/en_US/ether-wake.8 2015-09-15 18:02:18.608968093 +0200
|
||||||
@@ -49,7 +49,7 @@ Send the wake-up packet to the broadcast
|
@@ -49,7 +49,7 @@ Send the wake-up packet to the broadcast
|
||||||
Increase the Debug Level.
|
Increase the Debug Level.
|
||||||
.TP
|
.TP
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
diff -up net-tools-2.0/lib/interface.c.cycle net-tools-2.0/lib/interface.c
|
diff -up net-tools-2.0/lib/interface.c.cycle net-tools-2.0/lib/interface.c
|
||||||
--- net-tools-2.0/lib/interface.c.cycle 2014-11-11 14:38:03.000000000 +0100
|
--- net-tools-2.0/lib/interface.c.cycle 2015-08-29 08:59:31.000000000 +0200
|
||||||
+++ net-tools-2.0/lib/interface.c 2014-11-24 14:45:46.128480980 +0100
|
+++ net-tools-2.0/lib/interface.c 2015-09-15 18:09:54.089697132 +0200
|
||||||
@@ -93,6 +93,7 @@ int if_list_all = 0; /* do we have reque
|
@@ -93,6 +93,7 @@ int if_list_all = 0; /* do we have reque
|
||||||
static struct interface *int_list, *int_last;
|
static struct interface *int_list, *int_last;
|
||||||
|
|
||||||
@ -68,8 +68,8 @@ diff -up net-tools-2.0/lib/interface.c.cycle net-tools-2.0/lib/interface.c
|
|||||||
int if_readlist(void)
|
int if_readlist(void)
|
||||||
{
|
{
|
||||||
diff -up net-tools-2.0/man/en_US/netstat.8.cycle net-tools-2.0/man/en_US/netstat.8
|
diff -up net-tools-2.0/man/en_US/netstat.8.cycle net-tools-2.0/man/en_US/netstat.8
|
||||||
--- net-tools-2.0/man/en_US/netstat.8.cycle 2014-11-11 14:38:03.000000000 +0100
|
--- net-tools-2.0/man/en_US/netstat.8.cycle 2015-08-29 08:59:31.000000000 +0200
|
||||||
+++ net-tools-2.0/man/en_US/netstat.8 2014-11-24 14:47:36.140944944 +0100
|
+++ net-tools-2.0/man/en_US/netstat.8 2015-09-15 18:09:54.090697129 +0200
|
||||||
@@ -36,6 +36,7 @@ netstat \- Print network connections, ro
|
@@ -36,6 +36,7 @@ netstat \- Print network connections, ro
|
||||||
.RB [ \-\-verbose | \-v ]
|
.RB [ \-\-verbose | \-v ]
|
||||||
.RB [ \-\-continuous | \-c]
|
.RB [ \-\-continuous | \-c]
|
||||||
@ -129,21 +129,20 @@ diff -up net-tools-2.0/man/en_US/netstat.8.cycle net-tools-2.0/man/en_US/netstat
|
|||||||
.SH OUTPUT
|
.SH OUTPUT
|
||||||
.P
|
.P
|
||||||
diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
||||||
--- net-tools-2.0/netstat.c.cycle 2014-11-11 14:38:03.000000000 +0100
|
--- net-tools-2.0/netstat.c.cycle 2015-08-29 08:59:31.000000000 +0200
|
||||||
+++ net-tools-2.0/netstat.c 2014-11-24 14:44:24.948614445 +0100
|
+++ net-tools-2.0/netstat.c 2015-09-15 18:09:54.090697129 +0200
|
||||||
@@ -115,9 +115,9 @@
|
@@ -115,8 +115,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* prototypes for statistics.c */
|
/* prototypes for statistics.c */
|
||||||
-void parsesnmp(int, int, int);
|
-void parsesnmp(int, int, int, int);
|
||||||
+int parsesnmp(int, int, int);
|
|
||||||
void inittab(void);
|
|
||||||
-void parsesnmp6(int, int, int);
|
-void parsesnmp6(int, int, int);
|
||||||
|
+int parsesnmp(int, int, int, int);
|
||||||
+int parsesnmp6(int, int, int);
|
+int parsesnmp6(int, int, int);
|
||||||
void inittab6(void);
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -342,10 +342,10 @@ static void prg_cache_clear(void)
|
SS_FREE = 0, /* not allocated */
|
||||||
|
@@ -340,10 +340,10 @@ static void prg_cache_clear(void)
|
||||||
prg_cache_loaded = 0;
|
prg_cache_loaded = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +155,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int extract_type_1_socket_inode(const char lname[], unsigned long * inode_p) {
|
static int extract_type_1_socket_inode(const char lname[], unsigned long * inode_p) {
|
||||||
@@ -1787,6 +1787,8 @@ static int rfcomm_info(void)
|
@@ -1892,6 +1892,8 @@ static int rfcomm_info(void)
|
||||||
|
|
||||||
static int iface_info(void)
|
static int iface_info(void)
|
||||||
{
|
{
|
||||||
@ -165,7 +164,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
|||||||
if (skfd < 0) {
|
if (skfd < 0) {
|
||||||
if ((skfd = sockets_open(0)) < 0) {
|
if ((skfd = sockets_open(0)) < 0) {
|
||||||
perror("socket");
|
perror("socket");
|
||||||
@@ -1796,20 +1798,21 @@ static int iface_info(void)
|
@@ -1901,20 +1903,21 @@ static int iface_info(void)
|
||||||
}
|
}
|
||||||
if (flag_exp < 2) {
|
if (flag_exp < 2) {
|
||||||
ife_short = 1;
|
ife_short = 1;
|
||||||
@ -190,7 +189,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1825,7 +1828,7 @@ static void usage(void)
|
@@ -1930,7 +1933,7 @@ static void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("usage: netstat [-vWeenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n"));
|
fprintf(stderr, _("usage: netstat [-vWeenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n"));
|
||||||
fprintf(stderr, _(" netstat [-vWnNcaeol] [<Socket> ...]\n"));
|
fprintf(stderr, _(" netstat [-vWnNcaeol] [<Socket> ...]\n"));
|
||||||
@ -199,7 +198,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
|||||||
|
|
||||||
fprintf(stderr, _(" -r, --route display routing table\n"));
|
fprintf(stderr, _(" -r, --route display routing table\n"));
|
||||||
fprintf(stderr, _(" -i, --interfaces display interface table\n"));
|
fprintf(stderr, _(" -i, --interfaces display interface table\n"));
|
||||||
@@ -1867,6 +1870,7 @@ int main
|
@@ -1972,6 +1975,7 @@ int main
|
||||||
(int argc, char *argv[]) {
|
(int argc, char *argv[]) {
|
||||||
int i;
|
int i;
|
||||||
int lop;
|
int lop;
|
||||||
@ -207,7 +206,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
|||||||
static struct option longopts[] =
|
static struct option longopts[] =
|
||||||
{
|
{
|
||||||
AFTRANS_OPTS,
|
AFTRANS_OPTS,
|
||||||
@@ -2049,6 +2053,12 @@ int main
|
@@ -2154,6 +2158,12 @@ int main
|
||||||
flag_sta++;
|
flag_sta++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +219,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
|||||||
if (flag_int + flag_rou + flag_mas + flag_sta > 1)
|
if (flag_int + flag_rou + flag_mas + flag_sta > 1)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
@@ -2078,7 +2088,7 @@ int main
|
@@ -2183,7 +2193,7 @@ int main
|
||||||
flag_not & FLAG_NUM_PORT, flag_exp);
|
flag_not & FLAG_NUM_PORT, flag_exp);
|
||||||
if (i || !flag_cnt)
|
if (i || !flag_cnt)
|
||||||
break;
|
break;
|
||||||
@ -229,28 +228,26 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ENOSUPP("netstat", "FW_MASQUERADE");
|
ENOSUPP("netstat", "FW_MASQUERADE");
|
||||||
@@ -2091,17 +2101,18 @@ int main
|
@@ -2196,15 +2206,16 @@ int main
|
||||||
if (!afname[0])
|
if (!afname[0])
|
||||||
safe_strncpy(afname, DFLT_AF, sizeof(afname));
|
safe_strncpy(afname, DFLT_AF, sizeof(afname));
|
||||||
|
|
||||||
+ for (;;) {
|
+ for (;;) {
|
||||||
if (!strcmp(afname, "inet")) {
|
if (!strcmp(afname, "inet")) {
|
||||||
#if HAVE_AFINET
|
#if HAVE_AFINET
|
||||||
inittab();
|
- parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp);
|
||||||
- parsesnmp(flag_raw, flag_tcp, flag_udp);
|
+ i = parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp);
|
||||||
+ i = parsesnmp(flag_raw, flag_tcp, flag_udp);
|
|
||||||
#else
|
#else
|
||||||
ENOSUPP("netstat", "AF INET");
|
ENOSUPP("netstat", "AF INET");
|
||||||
#endif
|
#endif
|
||||||
} else if(!strcmp(afname, "inet6")) {
|
} else if(!strcmp(afname, "inet6")) {
|
||||||
#if HAVE_AFINET6
|
#if HAVE_AFINET6
|
||||||
inittab6();
|
|
||||||
- parsesnmp6(flag_raw, flag_tcp, flag_udp);
|
- parsesnmp6(flag_raw, flag_tcp, flag_udp);
|
||||||
+ i = parsesnmp6(flag_raw, flag_tcp, flag_udp);
|
+ i = parsesnmp6(flag_raw, flag_tcp, flag_udp);
|
||||||
#else
|
#else
|
||||||
ENOSUPP("netstat", "AF INET6");
|
ENOSUPP("netstat", "AF INET6");
|
||||||
#endif
|
#endif
|
||||||
@@ -2109,7 +2120,11 @@ int main
|
@@ -2212,7 +2223,11 @@ int main
|
||||||
printf(_("netstat: No statistics support for specified address family: %s\n"), afname);
|
printf(_("netstat: No statistics support for specified address family: %s\n"), afname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -263,7 +260,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flag_rou) {
|
if (flag_rou) {
|
||||||
@@ -2131,7 +2146,7 @@ int main
|
@@ -2234,7 +2249,7 @@ int main
|
||||||
i = route_info(afname, options);
|
i = route_info(afname, options);
|
||||||
if (i || !flag_cnt)
|
if (i || !flag_cnt)
|
||||||
break;
|
break;
|
||||||
@ -272,7 +269,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
|||||||
}
|
}
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
@@ -2140,7 +2155,7 @@ int main
|
@@ -2243,7 +2258,7 @@ int main
|
||||||
i = iface_info();
|
i = iface_info();
|
||||||
if (!flag_cnt || i)
|
if (!flag_cnt || i)
|
||||||
break;
|
break;
|
||||||
@ -281,7 +278,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
|||||||
}
|
}
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
@@ -2327,7 +2342,7 @@ int main
|
@@ -2430,7 +2445,7 @@ int main
|
||||||
|
|
||||||
if (!flag_cnt || i)
|
if (!flag_cnt || i)
|
||||||
break;
|
break;
|
||||||
@ -291,18 +288,18 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
|
|||||||
}
|
}
|
||||||
return (i);
|
return (i);
|
||||||
diff -up net-tools-2.0/statistics.c.cycle net-tools-2.0/statistics.c
|
diff -up net-tools-2.0/statistics.c.cycle net-tools-2.0/statistics.c
|
||||||
--- net-tools-2.0/statistics.c.cycle 2014-11-11 14:38:03.000000000 +0100
|
--- net-tools-2.0/statistics.c.cycle 2015-08-29 08:59:31.000000000 +0200
|
||||||
+++ net-tools-2.0/statistics.c 2014-11-24 14:44:24.949614431 +0100
|
+++ net-tools-2.0/statistics.c 2015-09-15 18:10:34.608582779 +0200
|
||||||
@@ -502,7 +502,7 @@ void process6_fd(FILE *f)
|
@@ -527,7 +527,7 @@ static void process_fd2(FILE *f, const c
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-void parsesnmp(int flag_raw, int flag_tcp, int flag_udp)
|
-void parsesnmp(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp)
|
||||||
+int parsesnmp(int flag_raw, int flag_tcp, int flag_udp)
|
+int parsesnmp(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
@@ -511,14 +511,17 @@ void parsesnmp(int flag_raw, int flag_tc
|
@@ -536,14 +536,17 @@ void parsesnmp(int flag_raw, int flag_tc
|
||||||
f = proc_fopen("/proc/net/snmp");
|
f = proc_fopen("/proc/net/snmp");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
perror(_("cannot open /proc/net/snmp"));
|
perror(_("cannot open /proc/net/snmp"));
|
||||||
@ -322,7 +319,7 @@ diff -up net-tools-2.0/statistics.c.cycle net-tools-2.0/statistics.c
|
|||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
@@ -528,15 +531,18 @@ void parsesnmp(int flag_raw, int flag_tc
|
@@ -553,8 +556,11 @@ void parsesnmp(int flag_raw, int flag_tc
|
||||||
if (process_fd(f, 1, NULL) <0)
|
if (process_fd(f, 1, NULL) <0)
|
||||||
fprintf(stderr, _("Problem while parsing /proc/net/netstat\n"));
|
fprintf(stderr, _("Problem while parsing /proc/net/netstat\n"));
|
||||||
|
|
||||||
@ -336,7 +333,10 @@ diff -up net-tools-2.0/statistics.c.cycle net-tools-2.0/statistics.c
|
|||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
- return;
|
@@ -567,9 +573,10 @@ void parsesnmp(int flag_raw, int flag_tc
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
+ return(0);
|
+ return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ diff -up net-tools-2.0/statistics.c.cycle net-tools-2.0/statistics.c
|
|||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
@@ -545,7 +551,7 @@ void parsesnmp6(int flag_raw, int flag_t
|
@@ -578,7 +585,7 @@ void parsesnmp6(int flag_raw, int flag_t
|
||||||
f = fopen("/proc/net/snmp6", "r");
|
f = fopen("/proc/net/snmp6", "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
perror(_("cannot open /proc/net/snmp6"));
|
perror(_("cannot open /proc/net/snmp6"));
|
||||||
@ -354,7 +354,7 @@ diff -up net-tools-2.0/statistics.c.cycle net-tools-2.0/statistics.c
|
|||||||
}
|
}
|
||||||
process6_fd(f);
|
process6_fd(f);
|
||||||
if (ferror(f))
|
if (ferror(f))
|
||||||
@@ -555,13 +561,16 @@ void parsesnmp6(int flag_raw, int flag_t
|
@@ -588,11 +595,14 @@ void parsesnmp6(int flag_raw, int flag_t
|
||||||
f = fopen("/proc/net/snmp", "r");
|
f = fopen("/proc/net/snmp", "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
perror(_("cannot open /proc/net/snmp"));
|
perror(_("cannot open /proc/net/snmp"));
|
||||||
@ -371,5 +371,3 @@ diff -up net-tools-2.0/statistics.c.cycle net-tools-2.0/statistics.c
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
+ return(0);
|
+ return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void inittab(void)
|
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
diff -up net-tools-2.0/lib/ipx_gr.c.ipx net-tools-2.0/lib/ipx_gr.c
|
|
||||||
--- net-tools-2.0/lib/ipx_gr.c.ipx 2013-09-10 12:33:52.494047907 +0200
|
|
||||||
+++ net-tools-2.0/lib/ipx_gr.c 2013-09-10 12:34:28.531561603 +0200
|
|
||||||
@@ -72,7 +72,7 @@ int IPX_rprint(int options)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Fetch and resolve the Destination */
|
|
||||||
- (void) ap->input(5, net, &sa);
|
|
||||||
+ (void) ap->input(1, net, &sa);
|
|
||||||
safe_strncpy(net, ap->sprint(&sa, numeric), sizeof(net));
|
|
||||||
|
|
||||||
/* Fetch and resolve the Router Net */
|
|
||||||
diff -up net-tools-2.0/netstat.c.ipx net-tools-2.0/netstat.c
|
|
||||||
--- net-tools-2.0/netstat.c.ipx 2013-09-10 12:33:52.491047948 +0200
|
|
||||||
+++ net-tools-2.0/netstat.c 2013-09-10 12:33:52.495047894 +0200
|
|
||||||
@@ -1643,13 +1643,13 @@ static int ipx_info(void)
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fetch and resolve the Source */
|
|
||||||
- (void) ap->input(4, sad, &sa);
|
|
||||||
+ (void) ap->input(0, sad, &sa);
|
|
||||||
safe_strncpy(buf, ap->sprint(&sa, flag_not & FLAG_NUM_HOST), sizeof(buf));
|
|
||||||
snprintf(sad, sizeof(sad), "%s:%04X", buf, sport);
|
|
||||||
|
|
||||||
if (!nc) {
|
|
||||||
/* Fetch and resolve the Destination */
|
|
||||||
- (void) ap->input(4, dad, &sa);
|
|
||||||
+ (void) ap->input(0, dad, &sa);
|
|
||||||
safe_strncpy(buf, ap->sprint(&sa, flag_not & FLAG_NUM_HOST), sizeof(buf));
|
|
||||||
snprintf(dad, sizeof(dad), "%s:%04X", buf, dport);
|
|
||||||
} else
|
|
@ -1,534 +0,0 @@
|
|||||||
diff -up net-tools-2.0/netstat.c.sctp net-tools-2.0/netstat.c
|
|
||||||
--- net-tools-2.0/netstat.c.sctp 2013-09-23 15:14:59.524866201 +0200
|
|
||||||
+++ net-tools-2.0/netstat.c 2013-09-23 15:24:20.259143969 +0200
|
|
||||||
@@ -115,7 +115,7 @@
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* prototypes for statistics.c */
|
|
||||||
-int parsesnmp(int, int, int);
|
|
||||||
+int parsesnmp(int, int, int, int);
|
|
||||||
void inittab(void);
|
|
||||||
int parsesnmp6(int, int, int);
|
|
||||||
void inittab6(void);
|
|
||||||
@@ -888,159 +888,269 @@ static int igmp_info(void)
|
|
||||||
igmp_do_one, "igmp", "igmp6");
|
|
||||||
}
|
|
||||||
|
|
||||||
-static int ip_parse_dots(uint32_t *addr, char const *src) {
|
|
||||||
- unsigned a, b, c, d;
|
|
||||||
- unsigned ret = 4-sscanf(src, "%u.%u.%u.%u", &a, &b, &c, &d);
|
|
||||||
- *addr = htonl((a << 24)|(b << 16)|(c << 8)|d);
|
|
||||||
- return ret;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static void print_ip_service(struct sockaddr_in *addr, char const *protname,
|
|
||||||
- char *buf, unsigned size) {
|
|
||||||
- struct aftype *ap;
|
|
||||||
-
|
|
||||||
- if(size == 0) return;
|
|
||||||
-
|
|
||||||
- /* print host */
|
|
||||||
- if((ap = get_afntype(addr->sin_family)) == NULL) {
|
|
||||||
- fprintf(stderr, _("netstat: unsupported address family %d !\n"),
|
|
||||||
- addr->sin_family);
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
- safe_strncpy(buf, ap->sprint((struct sockaddr*)addr, flag_not), size);
|
|
||||||
-
|
|
||||||
- /* print service */
|
|
||||||
- if(flag_all || (flag_lst && !addr->sin_port) || (!flag_lst && addr->sin_port)) {
|
|
||||||
- char bfs[32];
|
|
||||||
-
|
|
||||||
- snprintf(bfs, sizeof(bfs), "%s",
|
|
||||||
- get_sname(addr->sin_port, (char*)protname, flag_not & FLAG_NUM_PORT));
|
|
||||||
-
|
|
||||||
- /* check if we must cut on host and/or service name */
|
|
||||||
- {
|
|
||||||
- unsigned const bufl = strlen(buf);
|
|
||||||
- unsigned const bfsl = strlen(bfs);
|
|
||||||
-
|
|
||||||
- if(bufl+bfsl+2 > size) {
|
|
||||||
- unsigned const half = (size-2)>>1;
|
|
||||||
- if(bufl > half) {
|
|
||||||
- if(bfsl > half) {
|
|
||||||
- buf[size-2-half] = '\0';
|
|
||||||
- bfs[half+1] = '\0';
|
|
||||||
- }
|
|
||||||
- else buf[size-2-bfsl] = '\0';
|
|
||||||
- }
|
|
||||||
- else bfs[size-2-bufl] = '\0';
|
|
||||||
- }
|
|
||||||
+static const char *sctp_socket_state_str(int state)
|
|
||||||
+{
|
|
||||||
+ if(state>=0 && state<=10)
|
|
||||||
+ return tcp_state[state];
|
|
||||||
+ else {
|
|
||||||
+ static char state_str_buf[64];
|
|
||||||
+ sprintf(state_str_buf,"UNKNOWN(%d)",state);
|
|
||||||
+ return state_str_buf;
|
|
||||||
}
|
|
||||||
- strcat(buf, ":");
|
|
||||||
- strcat(buf, bfs);
|
|
||||||
- }
|
|
||||||
}
|
|
||||||
|
|
||||||
-/* process single SCTP endpoint */
|
|
||||||
-static void sctp_do_ept(int lnr, char const *line, const char *prot)
|
|
||||||
+static struct aftype *process_sctp_addr_str(const char *addr_str, struct sockaddr *sa)
|
|
||||||
{
|
|
||||||
- struct sockaddr_in laddr, raddr;
|
|
||||||
- unsigned uid, inode;
|
|
||||||
-
|
|
||||||
- char l_addr[23], r_addr[23];
|
|
||||||
-
|
|
||||||
- /* fill sockaddr_in structures */
|
|
||||||
- {
|
|
||||||
- unsigned lport;
|
|
||||||
- unsigned ate;
|
|
||||||
-
|
|
||||||
- if(lnr == 0) return;
|
|
||||||
- if(sscanf(line, "%*X %*X %*u %*u %*u %u %u %u %n",
|
|
||||||
- &lport, &uid, &inode, &ate) < 3) goto err;
|
|
||||||
-
|
|
||||||
- /* decode IP address */
|
|
||||||
- if(ip_parse_dots(&laddr.sin_addr.s_addr, line+ate)) goto err;
|
|
||||||
- raddr.sin_addr.s_addr = htonl(0);
|
|
||||||
- laddr.sin_family = raddr.sin_family = AF_INET;
|
|
||||||
- laddr.sin_port = htons(lport);
|
|
||||||
- raddr.sin_port = htons(0);
|
|
||||||
- }
|
|
||||||
+ if (strchr(addr_str,':')) {
|
|
||||||
+#if HAVE_AFINET6
|
|
||||||
+ extern struct aftype inet6_aftype;
|
|
||||||
+ /* Demangle what the kernel gives us */
|
|
||||||
+ struct in6_addr in6;
|
|
||||||
+ char addr6_str[INET6_ADDRSTRLEN];
|
|
||||||
+ unsigned u0,u1,u2,u3,u4,u5,u6,u7;
|
|
||||||
+ sscanf(addr_str, "%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X",
|
|
||||||
+ &u0, &u1, &u2, &u3, &u4, &u5, &u6, &u7);
|
|
||||||
+ in6.s6_addr16[0] = htons(u0);
|
|
||||||
+ in6.s6_addr16[1] = htons(u1);
|
|
||||||
+ in6.s6_addr16[2] = htons(u2);
|
|
||||||
+ in6.s6_addr16[3] = htons(u3);
|
|
||||||
+ in6.s6_addr16[4] = htons(u4);
|
|
||||||
+ in6.s6_addr16[5] = htons(u5);
|
|
||||||
+ in6.s6_addr16[6] = htons(u6);
|
|
||||||
+ in6.s6_addr16[7] = htons(u7);
|
|
||||||
+
|
|
||||||
+ inet_ntop(AF_INET6, &in6, addr6_str, sizeof(addr6_str));
|
|
||||||
+ inet6_aftype.input(1, addr6_str, sa);
|
|
||||||
+ sa->sa_family = AF_INET6;
|
|
||||||
+#endif
|
|
||||||
+ } else {
|
|
||||||
+ ((struct sockaddr_in*)sa)->sin_addr.s_addr = inet_addr(addr_str);
|
|
||||||
+ sa->sa_family = AF_INET;
|
|
||||||
+ }
|
|
||||||
+ return get_afntype(sa->sa_family);
|
|
||||||
+}
|
|
||||||
|
|
||||||
- /* print IP:service to l_addr and r_addr */
|
|
||||||
- print_ip_service(&laddr, prot, l_addr, sizeof(l_addr));
|
|
||||||
- print_ip_service(&raddr, prot, r_addr, sizeof(r_addr));
|
|
||||||
-
|
|
||||||
- /* Print line */
|
|
||||||
- printf("%-4s %6d %6d %-*s %-*s %-11s",
|
|
||||||
- prot, 0, 0,
|
|
||||||
- (int)netmax(23,strlen(l_addr)), l_addr,
|
|
||||||
- (int)netmax(23,strlen(r_addr)), r_addr,
|
|
||||||
- _(tcp_state[TCP_LISTEN]));
|
|
||||||
- finish_this_one(uid, inode, "");
|
|
||||||
- return;
|
|
||||||
- err:
|
|
||||||
- fprintf(stderr, "SCTP error in line: %d\n", lnr);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-/* process single SCTP association */
|
|
||||||
-static void sctp_do_assoc(int lnr, char const *line, const char *prot)
|
|
||||||
-{
|
|
||||||
- struct sockaddr_in laddr, raddr;
|
|
||||||
- unsigned long rxq, txq;
|
|
||||||
- unsigned uid, inode;
|
|
||||||
-
|
|
||||||
- char l_addr[23], r_addr[23];
|
|
||||||
-
|
|
||||||
- /* fill sockaddr_in structures */
|
|
||||||
- {
|
|
||||||
- unsigned lport, rport;
|
|
||||||
- unsigned ate;
|
|
||||||
- char const *addr;
|
|
||||||
-
|
|
||||||
- if(lnr == 0) return;
|
|
||||||
- if(sscanf(line, "%*X %*X %*u %*u %*u %*u %*u %lu %lu %u %u %u %u %n",
|
|
||||||
- &txq, &rxq, &uid, &inode, &lport, &rport, &ate) < 6) goto err;
|
|
||||||
-
|
|
||||||
- /* decode IP addresses */
|
|
||||||
- addr = strchr(line+ate, '*');
|
|
||||||
- if(addr == 0) goto err;
|
|
||||||
- if(ip_parse_dots(&laddr.sin_addr.s_addr, ++addr)) goto err;
|
|
||||||
- addr = strchr(addr, '*');
|
|
||||||
- if(addr == 0) goto err;
|
|
||||||
- if(ip_parse_dots(&raddr.sin_addr.s_addr, ++addr)) goto err;
|
|
||||||
-
|
|
||||||
- /* complete sockaddr_in structures */
|
|
||||||
- laddr.sin_family = raddr.sin_family = AF_INET;
|
|
||||||
- laddr.sin_port = htons(lport);
|
|
||||||
- raddr.sin_port = htons(rport);
|
|
||||||
- }
|
|
||||||
+static void sctp_eps_do_one(int lnr, char *line, const char *proto)
|
|
||||||
+{
|
|
||||||
+ char buffer[1024];
|
|
||||||
+ int state, port;
|
|
||||||
+ int uid;
|
|
||||||
+ unsigned long inode;
|
|
||||||
+ struct aftype *ap;
|
|
||||||
+#if HAVE_AFINET6
|
|
||||||
+ struct sockaddr_in6 localaddr;
|
|
||||||
+#else
|
|
||||||
+ struct sockaddr_in localaddr;
|
|
||||||
+#endif
|
|
||||||
+ const char *sst_str;
|
|
||||||
+ const char *lport_str;
|
|
||||||
+ const char *uid_str;
|
|
||||||
+ const char *inode_str;
|
|
||||||
+ char *laddrs_str;
|
|
||||||
+
|
|
||||||
+ if(lnr == 0) {
|
|
||||||
+ /* ENDPT SOCK STY SST HBKT LPORT UID INODE LADDRS */
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ strtok(line," \t\n"); /*skip endpt*/
|
|
||||||
+ strtok(0," \t\n"); /*skip sock*/
|
|
||||||
+ strtok(0," \t\n"); /*skp sty*/
|
|
||||||
+ sst_str = strtok(0," \t\n");
|
|
||||||
+ strtok(0," \t\n"); /*skip hash bucket*/
|
|
||||||
+ lport_str=strtok(0," \t\n");
|
|
||||||
+ uid_str = strtok(0," \t\n");
|
|
||||||
+ inode_str = strtok(0," \t\n");
|
|
||||||
+ laddrs_str=strtok(0,"\t\n");
|
|
||||||
+
|
|
||||||
+ if (!sst_str || !lport_str || !uid_str || !inode_str) {
|
|
||||||
+ fprintf(stderr, _("warning, got bogus sctp eps line.\n"));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ state = atoi(sst_str);
|
|
||||||
+ port = atoi(lport_str);
|
|
||||||
+ uid = atoi(uid_str);
|
|
||||||
+ inode = strtoul(inode_str,0,0);
|
|
||||||
+
|
|
||||||
+ const char *this_local_addr;
|
|
||||||
+ int first=1;
|
|
||||||
+ char local_port[16];
|
|
||||||
+ snprintf(local_port, sizeof(local_port), "%s",
|
|
||||||
+ get_sname(htons(port), proto, flag_not & FLAG_NUM_PORT));
|
|
||||||
+ for(this_local_addr=strtok(laddrs_str," \t\n");
|
|
||||||
+ this_local_addr;
|
|
||||||
+ this_local_addr=strtok(0," \t\n"))
|
|
||||||
+ {
|
|
||||||
+ char local_addr[64];
|
|
||||||
+ ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr);
|
|
||||||
+ if(ap)
|
|
||||||
+ safe_strncpy(local_addr,
|
|
||||||
+ ap->sprint((struct sockaddr *) &localaddr, flag_not),
|
|
||||||
+ sizeof(local_addr));
|
|
||||||
+ else
|
|
||||||
+ sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family);
|
|
||||||
+
|
|
||||||
+ if(!first) printf("\n");
|
|
||||||
+ if(first)
|
|
||||||
+ printf("sctp ");
|
|
||||||
+ else
|
|
||||||
+ printf(" ");
|
|
||||||
+ sprintf(buffer,"%s:%s", local_addr, local_port);
|
|
||||||
+ printf("%-47s", buffer);
|
|
||||||
+ printf(" %-11s", first?sctp_socket_state_str(state):"");
|
|
||||||
+ first = 0;
|
|
||||||
+ }
|
|
||||||
+ finish_this_one(uid,inode,"");
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void sctp_assoc_do_one(int lnr, char *line, const char *proto)
|
|
||||||
+{
|
|
||||||
+ char buffer[1024];
|
|
||||||
+ int state, lport,rport;
|
|
||||||
+ int uid;
|
|
||||||
+ unsigned rxqueue,txqueue;
|
|
||||||
+ unsigned long inode;
|
|
||||||
+
|
|
||||||
+ struct aftype *ap;
|
|
||||||
+#if HAVE_AFINET6
|
|
||||||
+ struct sockaddr_in6 localaddr,remoteaddr;
|
|
||||||
+#else
|
|
||||||
+ struct sockaddr_in localaddr,remoteaddr;
|
|
||||||
+#endif
|
|
||||||
+ const char *sst_str;
|
|
||||||
+ const char *txqueue_str;
|
|
||||||
+ const char *rxqueue_str;
|
|
||||||
+ const char *lport_str,*rport_str;
|
|
||||||
+ const char *uid_str;
|
|
||||||
+ const char *inode_str;
|
|
||||||
+ char *laddrs_str;
|
|
||||||
+ char *raddrs_str;
|
|
||||||
+
|
|
||||||
+ if(lnr == 0) {
|
|
||||||
+ /* ASSOC SOCK STY SST ST HBKT ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT RPORT LADDRS <-> RADDRS */
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ strtok(line," \t\n"); /*skip assoc*/
|
|
||||||
+ strtok(0," \t\n"); /*skip sock*/
|
|
||||||
+ strtok(0," \t\n"); /*skp sty*/
|
|
||||||
+ sst_str = strtok(0," \t\n");
|
|
||||||
+ strtok(0," \t\n");
|
|
||||||
+ strtok(0," \t\n"); /*skip hash bucket*/
|
|
||||||
+ strtok(0," \t\n"); /*skip hash assoc-id*/
|
|
||||||
+ txqueue_str = strtok(0," \t\n");
|
|
||||||
+ rxqueue_str = strtok(0," \t\n");
|
|
||||||
+ uid_str = strtok(0," \t\n");
|
|
||||||
+ inode_str = strtok(0," \t\n");
|
|
||||||
+ lport_str=strtok(0," \t\n");
|
|
||||||
+ rport_str=strtok(0," \t\n");
|
|
||||||
+ laddrs_str = strtok(0,"<->\t\n");
|
|
||||||
+ raddrs_str = strtok(0,"<->\t\n");
|
|
||||||
+
|
|
||||||
+ if (!sst_str || !txqueue_str || !rxqueue_str || !uid_str ||
|
|
||||||
+ !inode_str || !lport_str || !rport_str) {
|
|
||||||
+ fprintf(stderr, _("warning, got bogus sctp assoc line.\n"));
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ state = atoi(sst_str);
|
|
||||||
+ txqueue = atoi(txqueue_str);
|
|
||||||
+ rxqueue = atoi(rxqueue_str);
|
|
||||||
+ uid = atoi(uid_str);
|
|
||||||
+ inode = strtoul(inode_str,0,0);
|
|
||||||
+ lport = atoi(lport_str);
|
|
||||||
+ rport = atoi(rport_str);
|
|
||||||
+
|
|
||||||
+ /*print all addresses*/
|
|
||||||
+ const char *this_local_addr;
|
|
||||||
+ const char *this_remote_addr;
|
|
||||||
+ char *ss1,*ss2;
|
|
||||||
+ int first=1;
|
|
||||||
+ char local_port[16];
|
|
||||||
+ char remote_port[16];
|
|
||||||
+ snprintf(local_port, sizeof(local_port), "%s",
|
|
||||||
+ get_sname(htons(lport), proto,
|
|
||||||
+ flag_not & FLAG_NUM_PORT));
|
|
||||||
+ snprintf(remote_port, sizeof(remote_port), "%s",
|
|
||||||
+ get_sname(htons(rport), proto,
|
|
||||||
+ flag_not & FLAG_NUM_PORT));
|
|
||||||
+
|
|
||||||
+ this_local_addr=strtok_r(laddrs_str," \t\n",&ss1);
|
|
||||||
+ this_remote_addr=strtok_r(raddrs_str," \t\n",&ss2);
|
|
||||||
+ while(this_local_addr || this_remote_addr) {
|
|
||||||
+ char local_addr[64];
|
|
||||||
+ char remote_addr[64];
|
|
||||||
+
|
|
||||||
+ if(this_local_addr) {
|
|
||||||
+ if (this_local_addr[0] == '*') {
|
|
||||||
+ /* skip * */
|
|
||||||
+ this_local_addr++;
|
|
||||||
+ }
|
|
||||||
+ ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr);
|
|
||||||
+ if(ap)
|
|
||||||
+ safe_strncpy(local_addr,
|
|
||||||
+ ap->sprint((struct sockaddr *) &localaddr, flag_not), sizeof(local_addr));
|
|
||||||
+ else
|
|
||||||
+ sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family);
|
|
||||||
+ }
|
|
||||||
+ if(this_remote_addr) {
|
|
||||||
+ if (this_remote_addr[0] == '*') {
|
|
||||||
+ /* skip * */
|
|
||||||
+ this_remote_addr++;
|
|
||||||
+ }
|
|
||||||
+ ap = process_sctp_addr_str(this_remote_addr, (struct sockaddr*)&remoteaddr);
|
|
||||||
+ if(ap)
|
|
||||||
+ safe_strncpy(remote_addr,
|
|
||||||
+ ap->sprint((struct sockaddr *) &remoteaddr, flag_not), sizeof(remote_addr));
|
|
||||||
+ else
|
|
||||||
+ sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- /* print IP:service to l_addr and r_addr */
|
|
||||||
- print_ip_service(&laddr, prot, l_addr, sizeof(l_addr));
|
|
||||||
- print_ip_service(&raddr, prot, r_addr, sizeof(r_addr));
|
|
||||||
-
|
|
||||||
- /* Print line */
|
|
||||||
- printf("%-4s %6ld %6ld %-*s %-*s %-11s",
|
|
||||||
- prot, rxq, txq,
|
|
||||||
- (int)netmax(23,strlen(l_addr)), l_addr,
|
|
||||||
- (int)netmax(23,strlen(r_addr)), r_addr,
|
|
||||||
- _(tcp_state[TCP_ESTABLISHED]));
|
|
||||||
- finish_this_one(uid, inode, "");
|
|
||||||
- return;
|
|
||||||
- err:
|
|
||||||
- fprintf(stderr, "SCTP error in line: %d\n", lnr);
|
|
||||||
+ if(!first) printf("\n");
|
|
||||||
+ if(first)
|
|
||||||
+ printf("sctp %6u %6u ", rxqueue, txqueue);
|
|
||||||
+ else
|
|
||||||
+ printf(" ");
|
|
||||||
+ if(this_local_addr) {
|
|
||||||
+ if(first)
|
|
||||||
+ sprintf(buffer,"%s:%s", local_addr, local_port);
|
|
||||||
+ else
|
|
||||||
+ sprintf(buffer,"%s", local_addr);
|
|
||||||
+ printf("%-23s", buffer);
|
|
||||||
+ } else
|
|
||||||
+ printf("%-23s", "");
|
|
||||||
+ printf(" ");
|
|
||||||
+ if(this_remote_addr) {
|
|
||||||
+ if(first)
|
|
||||||
+ sprintf(buffer,"%s:%s", remote_addr, remote_port);
|
|
||||||
+ else
|
|
||||||
+ sprintf(buffer,"%s", remote_addr);
|
|
||||||
+ printf("%-23s", buffer);
|
|
||||||
+ } else
|
|
||||||
+ printf("%-23s", "");
|
|
||||||
+
|
|
||||||
+ printf(" %-11s", first?sctp_socket_state_str(state):"");
|
|
||||||
+
|
|
||||||
+ first = 0;
|
|
||||||
+ this_local_addr=strtok_r(0," \t\n",&ss1);
|
|
||||||
+ this_remote_addr=strtok_r(0," \t\n",&ss2);
|
|
||||||
+ }
|
|
||||||
+ finish_this_one(uid,inode,"");
|
|
||||||
}
|
|
||||||
|
|
||||||
-static int sctp_info_epts(void) {
|
|
||||||
+static int sctp_info_eps(void)
|
|
||||||
+{
|
|
||||||
INFO_GUTS6(_PATH_PROCNET_SCTPEPTS, _PATH_PROCNET_SCTP6EPTS, "AF INET (sctp)",
|
|
||||||
- sctp_do_ept, "sctp", "sctp6");
|
|
||||||
+ sctp_eps_do_one, "sctp", "sctp6");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int sctp_info_assocs(void) {
|
|
||||||
INFO_GUTS6(_PATH_PROCNET_SCTPASSOCS, _PATH_PROCNET_SCTP6ASSOCS, "AF INET (sctp)",
|
|
||||||
- sctp_do_assoc, "sctp", "sctp6");
|
|
||||||
+ sctp_assoc_do_one, "sctp", "sctp6");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int sctp_info(void) {
|
|
||||||
int res;
|
|
||||||
- res = sctp_info_epts();
|
|
||||||
+ res = sctp_info_eps();
|
|
||||||
if(res) return res;
|
|
||||||
return sctp_info_assocs();
|
|
||||||
}
|
|
||||||
@@ -2234,7 +2344,7 @@ int main
|
|
||||||
if (!strcmp(afname, "inet")) {
|
|
||||||
#if HAVE_AFINET
|
|
||||||
inittab();
|
|
||||||
- i = parsesnmp(flag_raw, flag_tcp, flag_udp);
|
|
||||||
+ i = parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp);
|
|
||||||
#else
|
|
||||||
ENOSUPP("netstat", "AF INET");
|
|
||||||
#endif
|
|
||||||
diff -up net-tools-2.0/statistics.c.sctp net-tools-2.0/statistics.c
|
|
||||||
--- net-tools-2.0/statistics.c.sctp 2013-09-23 15:14:59.501866518 +0200
|
|
||||||
+++ net-tools-2.0/statistics.c 2013-09-23 15:14:59.534866063 +0200
|
|
||||||
@@ -21,7 +21,7 @@
|
|
||||||
#define UFWARN(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-int print_static,f_raw,f_tcp,f_udp,f_unknown = 1;
|
|
||||||
+int print_static,f_raw,f_tcp,f_udp,f_sctp,f_unknown = 1;
|
|
||||||
|
|
||||||
enum State {
|
|
||||||
number = 0, opt_number, i_forward, i_inp_icmp, i_outp_icmp, i_rto_alg,
|
|
||||||
@@ -299,6 +299,27 @@ struct entry Tcpexttab[] =
|
|
||||||
{ "TCPRenoRecoveryFail", N_("%llu classic Reno fast retransmits failed"), opt_number },
|
|
||||||
};
|
|
||||||
|
|
||||||
+struct entry Sctptab[] =
|
|
||||||
+{
|
|
||||||
+ {"SctpCurrEstab", N_("%llu Current Associations"), number},
|
|
||||||
+ {"SctpActiveEstabs", N_("%llu Active Associations"), number},
|
|
||||||
+ {"SctpPassiveEstabs", N_("%llu Passive Associations"), number},
|
|
||||||
+ {"SctpAborteds", N_("%llu Number of Aborteds "), number},
|
|
||||||
+ {"SctpShutdowns", N_("%llu Number of Graceful Terminations"), number},
|
|
||||||
+ {"SctpOutOfBlues", N_("%llu Number of Out of Blue packets"), number},
|
|
||||||
+ {"SctpChecksumErrors", N_("%llu Number of Packets with invalid Checksum"), number},
|
|
||||||
+ {"SctpOutCtrlChunks", N_("%llu Number of control chunks sent"), number},
|
|
||||||
+ {"SctpOutOrderChunks", N_("%llu Number of ordered chunks sent"), number},
|
|
||||||
+ {"SctpOutUnorderChunks", N_("%llu Number of Unordered chunks sent"), number},
|
|
||||||
+ {"SctpInCtrlChunks", N_("%llu Number of control chunks received"), number},
|
|
||||||
+ {"SctpInOrderChunks", N_("%llu Number of ordered chunks received"), number},
|
|
||||||
+ {"SctpInUnorderChunks", N_("%llu Number of Unordered chunks received"), number},
|
|
||||||
+ {"SctpFragUsrMsgs", N_("%llu Number of messages fragmented"), number},
|
|
||||||
+ {"SctpReasmUsrMsgs", N_("%llu Number of messages reassembled "), number},
|
|
||||||
+ {"SctpOutSCTPPacks", N_("%llu Number of SCTP packets sent"), number},
|
|
||||||
+ {"SctpInSCTPPacks", N_("%llu Number of SCTP packets received"), number},
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
struct tabtab {
|
|
||||||
char *title;
|
|
||||||
struct entry *tab;
|
|
||||||
@@ -312,6 +333,7 @@ struct tabtab snmptabs[] =
|
|
||||||
{"Icmp", Icmptab, sizeof(Icmptab), &f_raw},
|
|
||||||
{"Tcp", Tcptab, sizeof(Tcptab), &f_tcp},
|
|
||||||
{"Udp", Udptab, sizeof(Udptab), &f_udp},
|
|
||||||
+ {"Sctp", Sctptab, sizeof(Sctptab), &f_sctp},
|
|
||||||
{"TcpExt", Tcpexttab, sizeof(Tcpexttab), &f_tcp},
|
|
||||||
{NULL}
|
|
||||||
};
|
|
||||||
@@ -502,11 +524,38 @@ void process6_fd(FILE *f)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-int parsesnmp(int flag_raw, int flag_tcp, int flag_udp)
|
|
||||||
+/* Process a file with name-value lines (like /proc/net/sctp/snmp) */
|
|
||||||
+void process_fd2(FILE *f, const char *filename)
|
|
||||||
+{
|
|
||||||
+ char buf1[1024];
|
|
||||||
+ char *sp;
|
|
||||||
+ struct tabtab *tab;
|
|
||||||
+
|
|
||||||
+ tab = newtable(snmptabs, "Sctp");
|
|
||||||
+
|
|
||||||
+ while (fgets(buf1, sizeof buf1, f)) {
|
|
||||||
+ sp = buf1 + strcspn(buf1, " \t\n");
|
|
||||||
+ if (!sp) {
|
|
||||||
+ fprintf(stderr,_("error parsing %s\n"), filename);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ *sp = '\0';
|
|
||||||
+ sp++;
|
|
||||||
+
|
|
||||||
+ sp += strspn(sp, " \t\n");
|
|
||||||
+
|
|
||||||
+ if (*sp != '\0' && *(tab->flag))
|
|
||||||
+ printval(tab, buf1, strtoul(sp, 0, 10));
|
|
||||||
+ }
|
|
||||||
+ return;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int parsesnmp(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp)
|
|
||||||
+
|
|
||||||
{
|
|
||||||
FILE *f;
|
|
||||||
|
|
||||||
- f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp;
|
|
||||||
+ f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp; f_sctp = flag_sctp;
|
|
||||||
|
|
||||||
f = proc_fopen("/proc/net/snmp");
|
|
||||||
if (!f) {
|
|
||||||
@@ -539,6 +588,17 @@ int parsesnmp(int flag_raw, int flag_tcp
|
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ f = proc_fopen("/proc/net/sctp/snmp");
|
|
||||||
+ if (f) {
|
|
||||||
+ process_fd2(f,"/proc/net/sctp/snmp");
|
|
||||||
+ if (ferror(f)) {
|
|
||||||
+ perror("/proc/net/sctp/snmp");
|
|
||||||
+ fclose(f);
|
|
||||||
+ return(1);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
%global checkout 20150715git
|
%global checkout 20150915git
|
||||||
|
|
||||||
Summary: Basic networking tools
|
Summary: Basic networking tools
|
||||||
Name: net-tools
|
Name: net-tools
|
||||||
Version: 2.0
|
Version: 2.0
|
||||||
Release: 0.34.%{checkout}%{?dist}
|
Release: 0.35.%{checkout}%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
URL: http://sourceforge.net/projects/net-tools/
|
URL: http://sourceforge.net/projects/net-tools/
|
||||||
@ -23,29 +23,23 @@ Source9: arp-ethers.service
|
|||||||
# adds <delay> option that allows netstat to cycle printing through statistics every delay seconds.
|
# adds <delay> option that allows netstat to cycle printing through statistics every delay seconds.
|
||||||
Patch1: net-tools-cycle.patch
|
Patch1: net-tools-cycle.patch
|
||||||
|
|
||||||
# Fixed incorrect address display for ipx (#46434)
|
|
||||||
Patch2: net-tools-ipx.patch
|
|
||||||
|
|
||||||
# various man page fixes merged into one patch
|
# various man page fixes merged into one patch
|
||||||
Patch3: net-tools-man.patch
|
Patch2: net-tools-man.patch
|
||||||
|
|
||||||
# netstat: interface option now works as described in the man page (#61113, #115987)
|
# netstat: interface option now works as described in the man page (#61113, #115987)
|
||||||
Patch4: net-tools-interface.patch
|
Patch3: net-tools-interface.patch
|
||||||
|
|
||||||
# filter out duplicate tcp entries (#139407)
|
# filter out duplicate tcp entries (#139407)
|
||||||
Patch5: net-tools-duplicate-tcp.patch
|
Patch4: net-tools-duplicate-tcp.patch
|
||||||
|
|
||||||
# don't report statistics for virtual devices (#143981)
|
# don't report statistics for virtual devices (#143981)
|
||||||
Patch6: net-tools-statalias.patch
|
Patch5: net-tools-statalias.patch
|
||||||
|
|
||||||
# clear static buffers in interface.c by Ulrich Drepper (#176714)
|
# clear static buffers in interface.c by Ulrich Drepper (#176714)
|
||||||
Patch7: net-tools-interface_stack.patch
|
Patch6: net-tools-interface_stack.patch
|
||||||
|
|
||||||
# statistics for SCTP
|
|
||||||
Patch8: net-tools-sctp-statistics.patch
|
|
||||||
|
|
||||||
# ifconfig crash when interface name is too long (#190703)
|
# ifconfig crash when interface name is too long (#190703)
|
||||||
Patch9: net-tools-ifconfig-long-iface-crasher.patch
|
Patch7: net-tools-ifconfig-long-iface-crasher.patch
|
||||||
|
|
||||||
# use all interfaces instead of default (#1003875)
|
# use all interfaces instead of default (#1003875)
|
||||||
Patch20: ether-wake-interfaces.patch
|
Patch20: ether-wake-interfaces.patch
|
||||||
@ -64,14 +58,12 @@ Most of them are obsolete. For replacement check iproute package.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -c
|
%setup -q -c
|
||||||
%patch1 -p1 -b .cycle
|
%patch1 -p1 -b .cycle
|
||||||
%patch2 -p1 -b .ipx
|
%patch2 -p1 -b .man
|
||||||
%patch3 -p1 -b .man
|
%patch3 -p1 -b .interface
|
||||||
%patch4 -p1 -b .interface
|
%patch4 -p1 -b .dup-tcp
|
||||||
%patch5 -p1 -b .dup-tcp
|
%patch5 -p1 -b .statalias
|
||||||
%patch6 -p1 -b .statalias
|
%patch6 -p1 -b .stack
|
||||||
%patch7 -p1 -b .stack
|
%patch7 -p1 -b .long_iface
|
||||||
%patch8 -p1 -b .sctp
|
|
||||||
%patch9 -p1 -b .long_iface
|
|
||||||
|
|
||||||
cp %SOURCE1 ./config.h
|
cp %SOURCE1 ./config.h
|
||||||
cp %SOURCE2 ./config.make
|
cp %SOURCE2 ./config.make
|
||||||
@ -159,6 +151,10 @@ install -D -p -m 644 %{SOURCE9} %{buildroot}%{_unitdir}/arp-ethers.service
|
|||||||
%attr(0644,root,root) %{_unitdir}/arp-ethers.service
|
%attr(0644,root,root) %{_unitdir}/arp-ethers.service
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Sep 15 2015 Jiri Popelka <jpopelka@redhat.com> - 2.0-0.35.20150915git
|
||||||
|
- ether-wake: add interface into message (#1149502)
|
||||||
|
- latest upstream snapshot (ipx.patch & sctp-statistics.patch merged)
|
||||||
|
|
||||||
* Wed Jul 15 2015 Jiri Popelka <jpopelka@redhat.com> - 2.0-0.34.20150715git
|
* Wed Jul 15 2015 Jiri Popelka <jpopelka@redhat.com> - 2.0-0.34.20150715git
|
||||||
- latest upstream snapshot
|
- latest upstream snapshot
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user