latest snapshot

This commit is contained in:
Jiri Popelka 2013-06-07 12:35:53 +02:00
parent ecf4561855
commit c90847a319
7 changed files with 106 additions and 105 deletions

1
.gitignore vendored
View File

@ -12,3 +12,4 @@ net-tools-1.60.tar.bz2
/net-tools-2.0.20121106git.tar.xz
/net-tools-2.0.20130109git.tar.xz
/net-tools-2.0.20130425git.tar.xz
/net-tools-2.0.20130607git.tar.xz

View File

@ -1,6 +1,6 @@
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 2012-10-01 07:40:47.000000000 +0200
+++ net-tools-2.0/lib/interface.c 2012-10-04 11:26:37.982693893 +0200
--- net-tools-2.0/lib/interface.c.cycle 2013-05-23 05:27:34.000000000 +0200
+++ net-tools-2.0/lib/interface.c 2013-06-07 11:55:07.966208687 +0200
@@ -93,6 +93,7 @@ int if_list_all = 0; /* do we have reque
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)
{
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 2012-10-01 07:40:47.000000000 +0200
+++ net-tools-2.0/man/en_US/netstat.8 2012-10-04 11:26:37.983693882 +0200
--- net-tools-2.0/man/en_US/netstat.8.cycle 2013-05-23 05:27:34.000000000 +0200
+++ net-tools-2.0/man/en_US/netstat.8 2013-06-07 11:48:06.168552352 +0200
@@ -33,6 +33,7 @@ netstat \- Print network connections, ro
.RB [ \-\-verbose | \-v ]
.RB [ \-\-continuous | \-c]
@ -129,9 +129,9 @@ diff -up net-tools-2.0/man/en_US/netstat.8.cycle net-tools-2.0/man/en_US/netstat
.SH OUTPUT
.P
diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
--- net-tools-2.0/netstat.c.cycle 2012-10-01 07:40:47.000000000 +0200
+++ net-tools-2.0/netstat.c 2012-10-04 11:26:37.983693882 +0200
@@ -114,9 +114,9 @@
--- net-tools-2.0/netstat.c.cycle 2013-05-23 05:27:34.000000000 +0200
+++ net-tools-2.0/netstat.c 2013-06-07 11:54:22.615796530 +0200
@@ -115,9 +115,9 @@
#endif
/* prototypes for statistics.c */
@ -143,7 +143,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
void inittab6(void);
typedef enum {
@@ -342,10 +342,10 @@ static void prg_cache_clear(void)
@@ -343,10 +343,10 @@ static void prg_cache_clear(void)
prg_cache_loaded = 0;
}
@ -156,7 +156,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) {
@@ -1785,6 +1785,8 @@ static int rfcomm_info(void)
@@ -1781,6 +1781,8 @@ static int rfcomm_info(void)
static int iface_info(void)
{
@ -165,7 +165,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
if (skfd < 0) {
if ((skfd = sockets_open(0)) < 0) {
perror("socket");
@@ -1794,20 +1796,21 @@ static int iface_info(void)
@@ -1790,20 +1792,21 @@ static int iface_info(void)
}
if (flag_exp < 2) {
ife_short = 1;
@ -190,7 +190,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
return 0;
}
@@ -1823,7 +1826,7 @@ static void usage(void)
@@ -1819,7 +1822,7 @@ static void usage(void)
{
fprintf(stderr, _("usage: netstat [-vWeenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n"));
fprintf(stderr, _(" netstat [-vWnNcaeol] [<Socket> ...]\n"));
@ -199,7 +199,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, _(" -i, --interfaces display interface table\n"));
@@ -1865,6 +1868,7 @@ int main
@@ -1861,6 +1864,7 @@ int main
(int argc, char *argv[]) {
int i;
int lop;
@ -207,7 +207,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
static struct option longopts[] =
{
AFTRANS_OPTS,
@@ -2047,6 +2051,12 @@ int main
@@ -2043,6 +2047,12 @@ int main
flag_sta++;
}
@ -220,7 +220,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)
usage();
@@ -2076,7 +2086,7 @@ int main
@@ -2072,7 +2082,7 @@ int main
flag_not & FLAG_NUM_PORT, flag_exp);
if (i || !flag_cnt)
break;
@ -229,11 +229,10 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
}
#else
ENOSUPP("netstat", "FW_MASQUERADE");
@@ -2088,18 +2098,18 @@ int main
if (flag_sta) {
@@ -2085,17 +2095,18 @@ int main
if (!afname[0])
strcpy(afname, DFLT_AF);
-
+ for (;;) {
if (!strcmp(afname, "inet")) {
#if HAVE_AFINET
@ -251,7 +250,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
#else
ENOSUPP("netstat", "AF INET6");
#endif
@@ -2107,7 +2117,11 @@ int main
@@ -2103,7 +2114,11 @@ int main
printf(_("netstat: No statistics support for specified address family: %s\n"), afname);
exit(1);
}
@ -264,7 +263,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
}
if (flag_rou) {
@@ -2129,7 +2143,7 @@ int main
@@ -2125,7 +2140,7 @@ int main
i = route_info(afname, options);
if (i || !flag_cnt)
break;
@ -273,7 +272,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
}
return (i);
}
@@ -2138,7 +2152,7 @@ int main
@@ -2134,7 +2149,7 @@ int main
i = iface_info();
if (!flag_cnt || i)
break;
@ -282,7 +281,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
}
return (i);
}
@@ -2325,7 +2339,7 @@ int main
@@ -2321,7 +2336,7 @@ int main
if (!flag_cnt || i)
break;
@ -292,8 +291,8 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
}
return (i);
diff -up net-tools-2.0/statistics.c.cycle net-tools-2.0/statistics.c
--- net-tools-2.0/statistics.c.cycle 2012-10-01 07:40:47.000000000 +0200
+++ net-tools-2.0/statistics.c 2012-10-04 11:26:37.984693871 +0200
--- net-tools-2.0/statistics.c.cycle 2013-05-23 05:27:34.000000000 +0200
+++ net-tools-2.0/statistics.c 2013-06-07 11:49:35.234451789 +0200
@@ -502,7 +502,7 @@ void process6_fd(FILE *f)
}

View File

@ -1,6 +1,6 @@
diff -up net-tools-2.0/lib/inet6.c.inet6-lookup net-tools-2.0/lib/inet6.c
--- net-tools-2.0/lib/inet6.c.inet6-lookup 2012-10-01 07:40:47.000000000 +0200
+++ net-tools-2.0/lib/inet6.c 2012-10-04 11:29:22.686750407 +0200
--- net-tools-2.0/lib/inet6.c.inet6-lookup 2013-06-07 11:56:33.463094292 +0200
+++ net-tools-2.0/lib/inet6.c 2013-06-07 11:57:31.732330709 +0200
@@ -149,33 +149,9 @@ static const char *INET6_sprint(struct s
}
@ -37,8 +37,8 @@ diff -up net-tools-2.0/lib/inet6.c.inet6-lookup net-tools-2.0/lib/inet6.c
diff -up net-tools-2.0/lib/inet6_gr.c.inet6-lookup net-tools-2.0/lib/inet6_gr.c
--- net-tools-2.0/lib/inet6_gr.c.inet6-lookup 2012-10-01 07:40:47.000000000 +0200
+++ net-tools-2.0/lib/inet6_gr.c 2012-10-04 11:29:22.687750395 +0200
--- net-tools-2.0/lib/inet6_gr.c.inet6-lookup 2013-05-23 05:27:34.000000000 +0200
+++ net-tools-2.0/lib/inet6_gr.c 2013-06-07 11:56:33.464094279 +0200
@@ -108,7 +108,7 @@ int rprint_fib6(int ext, int numeric)
addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
inet6_aftype.input(1, addr6, (struct sockaddr *) &saddr6);
@ -58,8 +58,8 @@ diff -up net-tools-2.0/lib/inet6_gr.c.inet6-lookup net-tools-2.0/lib/inet6_gr.c
/* Decode the flags. */
diff -up net-tools-2.0/lib/inet6_sr.c.inet6-lookup net-tools-2.0/lib/inet6_sr.c
--- net-tools-2.0/lib/inet6_sr.c.inet6-lookup 2012-10-01 07:40:47.000000000 +0200
+++ net-tools-2.0/lib/inet6_sr.c 2012-10-04 11:29:22.687750395 +0200
--- net-tools-2.0/lib/inet6_sr.c.inet6-lookup 2013-05-23 05:27:34.000000000 +0200
+++ net-tools-2.0/lib/inet6_sr.c 2013-06-07 11:56:33.464094279 +0200
@@ -32,6 +32,7 @@
#include "net-support.h"
#include "pathnames.h"

View File

@ -1,6 +1,6 @@
diff -up net-tools-2.0/include/interface.h.stack net-tools-2.0/include/interface.h
--- net-tools-2.0/include/interface.h.stack 2012-10-01 07:40:47.000000000 +0200
+++ net-tools-2.0/include/interface.h 2012-10-04 11:33:44.294371323 +0200
--- net-tools-2.0/include/interface.h.stack 2013-05-23 05:27:34.000000000 +0200
+++ net-tools-2.0/include/interface.h 2013-06-07 11:58:25.474623871 +0200
@@ -72,7 +72,7 @@ extern int do_if_print(struct interface
extern int procnetdev_version(char *buf);
@ -11,8 +11,8 @@ diff -up net-tools-2.0/include/interface.h.stack net-tools-2.0/include/interface
extern void ife_print(struct interface *ptr);
diff -up net-tools-2.0/lib/interface.c.stack net-tools-2.0/lib/interface.c
--- net-tools-2.0/lib/interface.c.stack 2012-10-04 11:33:44.292371355 +0200
+++ net-tools-2.0/lib/interface.c 2012-10-04 11:33:44.295371307 +0200
--- net-tools-2.0/lib/interface.c.stack 2013-06-07 11:58:25.471623910 +0200
+++ net-tools-2.0/lib/interface.c 2013-06-07 12:00:13.901191277 +0200
@@ -214,10 +214,11 @@ out:
return err;
}
@ -26,7 +26,7 @@ diff -up net-tools-2.0/lib/interface.c.stack net-tools-2.0/lib/interface.c
while (*p) {
if (isspace(*p))
break;
@@ -320,20 +321,22 @@ int get_dev_fields(char *bp, struct inte
@@ -320,9 +321,10 @@ int get_dev_fields(char *bp, struct inte
static int if_readlist_proc(char *target)
{
FILE *fh;
@ -38,15 +38,14 @@ diff -up net-tools-2.0/lib/interface.c.stack net-tools-2.0/lib/interface.c
fh = fopen(_PATH_PROCNET_DEV, "r");
if (!fh) {
fprintf(stderr, _("Warning: cannot open %s (%s). Limited output.\n"),
@@ -330,10 +332,11 @@ static int if_readlist_proc(char *target
_PATH_PROCNET_DEV, strerror(errno));
return -2;
- }
}
- if (fgets(buf, sizeof buf, fh))
- /* eat line */;
- if (fgets(buf, sizeof buf, fh))
- /* eat line */;
+ }
+ if (getline(&line, &linelen, fh) == -1 /* eat line */
+ || getline(&line, &linelen, fh) == -1) { /* eat line */
+ err = -1;

View File

@ -1,7 +1,7 @@
diff -up net-tools-2.0/netstat.c.sctp net-tools-2.0/netstat.c
--- net-tools-2.0/netstat.c.sctp 2012-10-04 11:34:36.645522120 +0200
+++ net-tools-2.0/netstat.c 2012-10-04 11:34:36.655521958 +0200
@@ -114,7 +114,7 @@
--- net-tools-2.0/netstat.c.sctp 2013-06-07 12:01:24.868249557 +0200
+++ net-tools-2.0/netstat.c 2013-06-07 12:11:20.789262337 +0200
@@ -115,7 +115,7 @@
#endif
/* prototypes for statistics.c */
@ -10,7 +10,7 @@ diff -up net-tools-2.0/netstat.c.sctp net-tools-2.0/netstat.c
void inittab(void);
int parsesnmp6(int, int, int);
void inittab6(void);
@@ -887,161 +887,264 @@ static int igmp_info(void)
@@ -888,161 +888,261 @@ static int igmp_info(void)
igmp_do_one, "igmp", "igmp6");
}
@ -78,6 +78,25 @@ diff -up net-tools-2.0/netstat.c.sctp net-tools-2.0/netstat.c
{
- 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;
@ -107,31 +126,6 @@ diff -up net-tools-2.0/netstat.c.sctp net-tools-2.0/netstat.c
+ return get_afntype(sa->sa_family);
+}
- 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);
- }
+static void sctp_eps_do_one(int lnr, char *line, const char *proto)
+{
+ char buffer[1024];
+ int state, port;
+ int uid;
+ unsigned long inode;
- /* 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));
@ -180,6 +174,12 @@ diff -up net-tools-2.0/netstat.c.sctp net-tools-2.0/netstat.c
- 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;
@ -219,21 +219,6 @@ diff -up net-tools-2.0/netstat.c.sctp net-tools-2.0/netstat.c
+ for(this_local_addr=strtok(laddrs_str," \t\n");
+ this_local_addr;
+ this_local_addr=strtok(0," \t\n"))
- /* 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);
+ {
+ char local_addr[64];
+ ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr);
@ -353,7 +338,21 @@ diff -up net-tools-2.0/netstat.c.sctp net-tools-2.0/netstat.c
+ 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);
@ -391,9 +390,8 @@ diff -up net-tools-2.0/netstat.c.sctp net-tools-2.0/netstat.c
+{
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)",
@ -414,7 +412,7 @@ diff -up net-tools-2.0/netstat.c.sctp net-tools-2.0/netstat.c
}
static void addr_do_one(char *buf, size_t buf_len, size_t short_len, struct aftype *ap,
@@ -2237,7 +2340,7 @@ int main
@@ -2234,7 +2334,7 @@ int main
if (!strcmp(afname, "inet")) {
#if HAVE_AFINET
inittab();
@ -424,8 +422,8 @@ diff -up net-tools-2.0/netstat.c.sctp net-tools-2.0/netstat.c
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 2012-10-04 11:34:36.623522476 +0200
+++ net-tools-2.0/statistics.c 2012-10-04 11:34:36.655521958 +0200
--- net-tools-2.0/statistics.c.sctp 2013-06-07 12:01:24.849249810 +0200
+++ net-tools-2.0/statistics.c 2013-06-07 12:28:00.804733500 +0200
@@ -21,7 +21,7 @@
#define UFWARN(x)
#endif
@ -471,7 +469,7 @@ diff -up net-tools-2.0/statistics.c.sctp net-tools-2.0/statistics.c
{"TcpExt", Tcpexttab, sizeof(Tcpexttab), &f_tcp},
{NULL}
};
@@ -502,11 +524,37 @@ void process6_fd(FILE *f)
@@ -502,11 +524,38 @@ void process6_fd(FILE *f)
}
@ -503,6 +501,7 @@ diff -up net-tools-2.0/statistics.c.sctp net-tools-2.0/statistics.c
+}
+
+int parsesnmp(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp)
+
{
FILE *f;
@ -511,7 +510,7 @@ diff -up net-tools-2.0/statistics.c.sctp net-tools-2.0/statistics.c
f = proc_fopen("/proc/net/snmp");
if (!f) {
@@ -539,6 +587,17 @@ int parsesnmp(int flag_raw, int flag_tcp
@@ -539,6 +588,17 @@ int parsesnmp(int flag_raw, int flag_tcp
fclose(f);
}

View File

@ -1,9 +1,9 @@
%global checkout 20130425git
%global checkout 20130607git
Summary: Basic networking tools
Name: net-tools
Version: 2.0
Release: 0.7.%{checkout}%{?dist}
Release: 0.8.%{checkout}%{?dist}
License: GPLv2+
Group: System Environment/Base
URL: http://sourceforge.net/projects/net-tools/
@ -163,6 +163,9 @@ install -m 644 %{SOURCE9} %{buildroot}%{_unitdir}
%attr(0644,root,root) %{_unitdir}/arp-ethers.service
%changelog
* Fri Jun 07 2013 Jiri Popelka <jpopelka@redhat.com> - 2.0-0.8.20130607git
- latest snapshot
* Thu Apr 25 2013 Jiri Popelka <jpopelka@redhat.com> - 2.0-0.7.20130425git
- latest snapshot

View File

@ -1 +1 @@
878caf6fff4452b911f8182e3170343a net-tools-2.0.20130425git.tar.xz
5247edb863e78a12f0326e6f77231c34 net-tools-2.0.20130607git.tar.xz