latest upstream snapshot (#1162284)

This commit is contained in:
Jiri Popelka 2014-11-24 15:15:01 +01:00
parent ac1079b24d
commit fbff637082
7 changed files with 78 additions and 141 deletions

View File

@ -1,15 +1,15 @@
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-04-26 02:45:16.000000000 +0200 --- net-tools-2.0/lib/interface.c.cycle 2014-11-11 14:38:03.000000000 +0100
+++ net-tools-2.0/lib/interface.c 2014-07-07 14:41:47.304361493 +0200 +++ net-tools-2.0/lib/interface.c 2014-11-24 14:45:46.128480980 +0100
@@ -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;
static int if_readlist_proc(char *); static int if_readlist_proc(const char *);
+static int if_readlist_rep(char *, struct interface *); +static int if_readlist_rep(const char *, struct interface *);
static struct interface *if_cache_add(char *name) static struct interface *if_cache_add(const char *name)
{ {
@@ -138,11 +139,14 @@ struct interface *lookup_interface(char @@ -138,11 +139,14 @@ struct interface *lookup_interface(const
int for_all_interfaces(int (*doit) (struct interface *, void *), void *cookie) int for_all_interfaces(int (*doit) (struct interface *, void *), void *cookie)
{ {
struct interface *ife; struct interface *ife;
@ -25,12 +25,12 @@ diff -up net-tools-2.0/lib/interface.c.cycle net-tools-2.0/lib/interface.c
if (err) if (err)
return err; return err;
} }
@@ -378,6 +382,41 @@ static int if_readlist_proc(char *target @@ -379,6 +383,41 @@ static int if_readlist_proc(const char *
fclose(fh); fclose(fh);
return err; return err;
} }
+ +
+static int if_readlist_rep(char *target, struct interface *ife) +static int if_readlist_rep(const char *target, struct interface *ife)
+{ +{
+ FILE *fh; + FILE *fh;
+ char buf[512]; + char buf[512];
@ -68,48 +68,48 @@ 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-04-26 02:45:16.000000000 +0200 --- 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 2014-07-07 14:50:03.018957435 +0200 +++ net-tools-2.0/man/en_US/netstat.8 2014-11-24 14:47:36.140944944 +0100
@@ -34,6 +34,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]
.RB [ \-\-wide | \-W] .RB [ \-\-wide | \-W ]
+.RB [delay] +.RB [delay]
.P .P
.B netstat .B netstat
.RB { \-\-route | \-r } .RB { \-\-route | \-r }
@@ -43,6 +44,7 @@ netstat \- Print network connections, ro @@ -45,6 +46,7 @@ netstat \- Print network connections, ro
.RB [ \-\-numeric | \-n ] .RB [ \-\-numeric | \-n ]
.RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ] .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ]
.RB [ \-\-continuous | \-c] .RB [ \-\-continuous | \-c ]
+.RB [delay] +.RB [delay]
.P .P
.B netstat .B netstat
.RB { \-\-interfaces | \-i } .RB { \-\-interfaces | \-i }
@@ -53,12 +55,14 @@ netstat \- Print network connections, ro @@ -55,12 +57,14 @@ netstat \- Print network connections, ro
.RB [ \-\-numeric | \-n ] .RB [ \-\-numeric | \-n ]
.RB [ \-\-numeric-hosts "] [" \-\-numeric-ports "] [" \-\-numeric-users ] .RB [ \-\-numeric-hosts "] [" \-\-numeric-ports "] [" \-\-numeric-users ]
.RB [ \-\-continuous | \-c] .RB [ \-\-continuous | \-c ]
+.RB [delay] +.RB [delay]
.P .P
.B netstat .B netstat
.RB { \-\-groups | \-g } .RB { \-\-groups | \-g }
.RB [ \-\-numeric | \-n ] .RB [ \-\-numeric | \-n ]
.RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ] .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ]
.RB [ \-\-continuous | \-c] .RB [ \-\-continuous | \-c ]
+.RB [delay] +.RB [delay]
.P .P
.B netstat .B netstat
.RB { \-\-masquerade | \-M } .RB { \-\-masquerade | \-M }
@@ -66,6 +70,7 @@ netstat \- Print network connections, ro @@ -68,6 +72,7 @@ netstat \- Print network connections, ro
.RB [ \-\-numeric | \-n ] .RB [ \-\-numeric | \-n ]
.RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ] .RB [ \-\-numeric\-hosts "] [" \-\-numeric\-ports "] [" \-\-numeric\-users ]
.RB [ \-\-continuous | \-c] .RB [ \-\-continuous | \-c ]
+.RB [delay] +.RB [delay]
.P .P
.B netstat .B netstat
.RB { \-\-statistics | -s } .RB { \-\-statistics | -s }
@@ -74,6 +79,7 @@ netstat \- Print network connections, ro @@ -76,6 +81,7 @@ netstat \- Print network connections, ro
.RB [ \-\-udplite | \-U ] .RB [ \-\-udplite | \-U ]
.RB [ \-\-sctp | \-S ] .RB [ \-\-sctp | \-S ]
.RB [ \-\-raw | \-w ] .RB [ \-\-raw | \-w ]
@ -117,7 +117,7 @@ diff -up net-tools-2.0/man/en_US/netstat.8.cycle net-tools-2.0/man/en_US/netstat
.P .P
.B netstat .B netstat
.RB { \-\-version | \-V } .RB { \-\-version | \-V }
@@ -199,6 +205,10 @@ option, show interfaces that are not up @@ -208,6 +214,10 @@ option, show interfaces that are not up
Print routing information from the FIB. (This is the default.) Print routing information from the FIB. (This is the default.)
.SS "\-C" .SS "\-C"
Print routing information from the route cache. Print routing information from the route cache.
@ -129,8 +129,8 @@ 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-04-26 02:45:16.000000000 +0200 --- net-tools-2.0/netstat.c.cycle 2014-11-11 14:38:03.000000000 +0100
+++ net-tools-2.0/netstat.c 2014-07-07 14:41:47.305361476 +0200 +++ net-tools-2.0/netstat.c 2014-11-24 14:44:24.948614445 +0100
@@ -115,9 +115,9 @@ @@ -115,9 +115,9 @@
#endif #endif
@ -143,7 +143,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
void inittab6(void); void inittab6(void);
typedef enum { typedef enum {
@@ -341,10 +341,10 @@ static void prg_cache_clear(void) @@ -342,10 +342,10 @@ static void prg_cache_clear(void)
prg_cache_loaded = 0; 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) { static int extract_type_1_socket_inode(const char lname[], unsigned long * inode_p) {
@@ -1781,6 +1781,8 @@ static int rfcomm_info(void) @@ -1787,6 +1787,8 @@ static int rfcomm_info(void)
static int iface_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 < 0) {
if ((skfd = sockets_open(0)) < 0) { if ((skfd = sockets_open(0)) < 0) {
perror("socket"); perror("socket");
@@ -1790,20 +1792,21 @@ static int iface_info(void) @@ -1796,20 +1798,21 @@ static int iface_info(void)
} }
if (flag_exp < 2) { if (flag_exp < 2) {
ife_short = 1; ife_short = 1;
@ -190,7 +190,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
return 0; return 0;
} }
@@ -1819,7 +1822,7 @@ static void usage(void) @@ -1825,7 +1828,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 +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, _(" -r, --route display routing table\n"));
fprintf(stderr, _(" -i, --interfaces display interface table\n")); fprintf(stderr, _(" -i, --interfaces display interface table\n"));
@@ -1861,6 +1864,7 @@ int main @@ -1867,6 +1870,7 @@ int main
(int argc, char *argv[]) { (int argc, char *argv[]) {
int i; int i;
int lop; 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[] = static struct option longopts[] =
{ {
AFTRANS_OPTS, AFTRANS_OPTS,
@@ -2043,6 +2047,12 @@ int main @@ -2049,6 +2053,12 @@ int main
flag_sta++; 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) if (flag_int + flag_rou + flag_mas + flag_sta > 1)
usage(); usage();
@@ -2072,7 +2082,7 @@ int main @@ -2078,7 +2088,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,7 +229,7 @@ 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");
@@ -2085,17 +2095,18 @@ int main @@ -2091,17 +2101,18 @@ int main
if (!afname[0]) if (!afname[0])
safe_strncpy(afname, DFLT_AF, sizeof(afname)); safe_strncpy(afname, DFLT_AF, sizeof(afname));
@ -250,7 +250,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
#else #else
ENOSUPP("netstat", "AF INET6"); ENOSUPP("netstat", "AF INET6");
#endif #endif
@@ -2103,7 +2114,11 @@ int main @@ -2109,7 +2120,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 +263,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
} }
if (flag_rou) { if (flag_rou) {
@@ -2125,7 +2140,7 @@ int main @@ -2131,7 +2146,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 +272,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
} }
return (i); return (i);
} }
@@ -2134,7 +2149,7 @@ int main @@ -2140,7 +2155,7 @@ int main
i = iface_info(); i = iface_info();
if (!flag_cnt || i) if (!flag_cnt || i)
break; break;
@ -281,7 +281,7 @@ diff -up net-tools-2.0/netstat.c.cycle net-tools-2.0/netstat.c
} }
return (i); return (i);
} }
@@ -2321,7 +2336,7 @@ int main @@ -2327,7 +2342,7 @@ int main
if (!flag_cnt || i) if (!flag_cnt || i)
break; break;
@ -291,8 +291,8 @@ 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-04-26 02:45:16.000000000 +0200 --- net-tools-2.0/statistics.c.cycle 2014-11-11 14:38:03.000000000 +0100
+++ net-tools-2.0/statistics.c 2014-07-07 14:41:47.306361459 +0200 +++ net-tools-2.0/statistics.c 2014-11-24 14:44:24.949614431 +0100
@@ -502,7 +502,7 @@ void process6_fd(FILE *f) @@ -502,7 +502,7 @@ void process6_fd(FILE *f)
} }

View File

@ -1,18 +1,18 @@
diff -up net-tools-2.0/lib/interface.c.long_iface net-tools-2.0/lib/interface.c diff -up net-tools-2.0/lib/interface.c.long_iface net-tools-2.0/lib/interface.c
--- net-tools-2.0/lib/interface.c.long_iface 2012-10-04 11:35:27.983694933 +0200 --- net-tools-2.0/lib/interface.c.long_iface 2014-11-24 15:09:45.130254503 +0100
+++ net-tools-2.0/lib/interface.c 2012-10-04 11:35:27.991694805 +0200 +++ net-tools-2.0/lib/interface.c 2014-11-24 15:10:54.662270496 +0100
@@ -216,6 +216,7 @@ out: @@ -216,6 +216,7 @@ out:
char *get_name(char **namep, char *p) static const char *get_name(char **namep, const char *p)
{ {
+ int count = 0; + int count = 0;
while (isspace(*p)) while (isspace(*p))
p++; p++;
char *name = *namep = p; char *name = *namep = p;
@@ -224,7 +225,13 @@ char *get_name(char **namep, char *p) @@ -224,7 +225,13 @@ static const char *get_name(char **namep
break; break;
if (*p == ':') { /* could be an alias */ if (*p == ':') { /* could be an alias */
char *dot = p++; const char *dot = p++;
- while (*p && isdigit(*p)) p++; - while (*p && isdigit(*p)) p++;
+ count++; + count++;
+ while (*p && isdigit(*p)) { + while (*p && isdigit(*p)) {
@ -24,7 +24,7 @@ diff -up net-tools-2.0/lib/interface.c.long_iface net-tools-2.0/lib/interface.c
if (*p == ':') { if (*p == ':') {
/* Yes it is, backup and copy it. */ /* Yes it is, backup and copy it. */
p = dot; p = dot;
@@ -240,6 +247,9 @@ char *get_name(char **namep, char *p) @@ -240,6 +247,9 @@ static const char *get_name(char **namep
break; break;
} }
*name++ = *p++; *name++ = *p++;

View File

@ -1,6 +1,6 @@
diff -up net-tools-2.0/man/en_US/netstat.8.interface net-tools-2.0/man/en_US/netstat.8 diff -up net-tools-2.0/man/en_US/netstat.8.interface net-tools-2.0/man/en_US/netstat.8
--- net-tools-2.0/man/en_US/netstat.8.interface 2014-10-07 11:42:22.683785562 +0200 --- net-tools-2.0/man/en_US/netstat.8.interface 2014-11-24 14:52:45.648623478 +0100
+++ net-tools-2.0/man/en_US/netstat.8 2014-10-07 11:42:22.686785520 +0200 +++ net-tools-2.0/man/en_US/netstat.8 2014-11-24 14:53:32.294972184 +0100
@@ -49,9 +49,9 @@ netstat \- Print network connections, ro @@ -49,9 +49,9 @@ netstat \- Print network connections, ro
.RB [delay] .RB [delay]
.P .P
@ -15,18 +15,18 @@ diff -up net-tools-2.0/man/en_US/netstat.8.interface net-tools-2.0/man/en_US/net
.RB [ \-\-numeric | \-n ] .RB [ \-\-numeric | \-n ]
@@ -134,8 +134,8 @@ and @@ -134,8 +134,8 @@ and
produce the same output. produce the same output.
.SS "\-\-groups , \-g" .SS "\-\-groups, \-g"
Display multicast group membership information for IPv4 and IPv6. Display multicast group membership information for IPv4 and IPv6.
-.SS "\-\-interfaces, \-i" -.SS "\-\-interfaces, \-i"
-Display a table of all network interfaces. -Display a table of all network interfaces.
+.SS "\-\-interfaces=\fIiface \fR, \fB\-I=\fIiface \fR, \fB\-i" +.SS "\-\-interfaces=\fIiface \fR, \fB\-I=\fIiface \fR, \fB\-i"
+Display a table of all network interfaces, or the specified \fIiface\fR. +Display a table of all network interfaces, or the specified \fIiface\fR.
.SS "\-\-masquerade , \-M" .SS "\-\-masquerade, \-M"
Display a list of masqueraded connections. Display a list of masqueraded connections.
.SS "\-\-statistics , \-s" .SS "\-\-statistics, \-s"
diff -up net-tools-2.0/netstat.c.interface net-tools-2.0/netstat.c diff -up net-tools-2.0/netstat.c.interface net-tools-2.0/netstat.c
--- net-tools-2.0/netstat.c.interface 2014-10-07 11:42:22.681785591 +0200 --- net-tools-2.0/netstat.c.interface 2014-11-24 14:52:45.644623534 +0100
+++ net-tools-2.0/netstat.c 2014-10-07 11:44:07.227294118 +0200 +++ net-tools-2.0/netstat.c 2014-11-24 14:52:45.652623422 +0100
@@ -144,6 +144,7 @@ static char *Release = RELEASE, *Signatu @@ -144,6 +144,7 @@ static char *Release = RELEASE, *Signatu
#define E_IOCTL -3 #define E_IOCTL -3
@ -35,7 +35,7 @@ diff -up net-tools-2.0/netstat.c.interface net-tools-2.0/netstat.c
int flag_rou = 0; int flag_rou = 0;
int flag_mas = 0; int flag_mas = 0;
int flag_sta = 0; int flag_sta = 0;
@@ -1782,6 +1783,7 @@ static int rfcomm_info(void) @@ -1788,6 +1789,7 @@ static int rfcomm_info(void)
static int iface_info(void) static int iface_info(void)
{ {
static int count=0; static int count=0;
@ -43,7 +43,7 @@ diff -up net-tools-2.0/netstat.c.interface net-tools-2.0/netstat.c
if (skfd < 0) { if (skfd < 0) {
if ((skfd = sockets_open(0)) < 0) { if ((skfd = sockets_open(0)) < 0) {
@@ -1796,7 +1798,11 @@ static int iface_info(void) @@ -1802,7 +1804,11 @@ static int iface_info(void)
printf(_("Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); printf(_("Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
} }
@ -56,7 +56,7 @@ diff -up net-tools-2.0/netstat.c.interface net-tools-2.0/netstat.c
perror(_("missing interface information")); perror(_("missing interface information"));
exit(1); exit(1);
} }
@@ -1822,9 +1828,10 @@ static void usage(void) @@ -1828,9 +1834,10 @@ 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"));
@ -68,7 +68,7 @@ diff -up net-tools-2.0/netstat.c.interface net-tools-2.0/netstat.c
fprintf(stderr, _(" -i, --interfaces display interface table\n")); fprintf(stderr, _(" -i, --interfaces display interface table\n"));
fprintf(stderr, _(" -g, --groups display multicast group memberships\n")); fprintf(stderr, _(" -g, --groups display multicast group memberships\n"));
fprintf(stderr, _(" -s, --statistics display networking statistics (like SNMP)\n")); fprintf(stderr, _(" -s, --statistics display networking statistics (like SNMP)\n"));
@@ -1869,7 +1876,7 @@ int main @@ -1875,7 +1882,7 @@ int main
{ {
AFTRANS_OPTS, AFTRANS_OPTS,
{"version", 0, 0, 'V'}, {"version", 0, 0, 'V'},
@ -77,7 +77,7 @@ diff -up net-tools-2.0/netstat.c.interface net-tools-2.0/netstat.c
{"help", 0, 0, 'h'}, {"help", 0, 0, 'h'},
{"route", 0, 0, 'r'}, {"route", 0, 0, 'r'},
#if HAVE_FW_MASQUERADE #if HAVE_FW_MASQUERADE
@@ -1913,7 +1920,7 @@ int main @@ -1919,7 +1926,7 @@ int main
getroute_init(); /* Set up AF routing support */ getroute_init(); /* Set up AF routing support */
afname[0] = '\0'; afname[0] = '\0';
@ -86,7 +86,7 @@ diff -up net-tools-2.0/netstat.c.interface net-tools-2.0/netstat.c
switch (i) { switch (i) {
case -1: case -1:
break; break;
@@ -1954,6 +1961,13 @@ int main @@ -1960,6 +1967,13 @@ int main
case 'p': case 'p':
flag_prg++; flag_prg++;
break; break;

View File

@ -1,24 +1,13 @@
diff -up net-tools-2.0/include/interface.h.stack net-tools-2.0/include/interface.h 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 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);
extern int get_dev_fields(char *bp, struct interface *ife);
-extern char * get_name(char *name, char *p);
+extern char * get_name(char **namep, char *p);
extern void ife_print(struct interface *ptr);
diff -up net-tools-2.0/lib/interface.c.stack net-tools-2.0/lib/interface.c 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 2013-06-07 11:58:25.471623910 +0200 --- net-tools-2.0/lib/interface.c.stack 2014-11-24 14:54:32.293134466 +0100
+++ net-tools-2.0/lib/interface.c 2013-06-07 12:00:13.901191277 +0200 +++ net-tools-2.0/lib/interface.c 2014-11-24 15:07:58.434764441 +0100
@@ -214,10 +214,11 @@ out: @@ -214,10 +214,11 @@ out:
return err; return err;
} }
-char *get_name(char *name, char *p) -static const char *get_name(char *name, const char *p)
+char *get_name(char **namep, char *p) +static const char *get_name(char **namep, const char *p)
{ {
while (isspace(*p)) while (isspace(*p))
p++; p++;
@ -26,8 +15,8 @@ diff -up net-tools-2.0/lib/interface.c.stack net-tools-2.0/lib/interface.c
while (*p) { while (*p) {
if (isspace(*p)) if (isspace(*p))
break; break;
@@ -320,9 +321,10 @@ int get_dev_fields(char *bp, struct inte @@ -320,9 +321,10 @@ static int get_dev_fields(const char *bp
static int if_readlist_proc(char *target) static int if_readlist_proc(const char *target)
{ {
FILE *fh; FILE *fh;
- char buf[512]; - char buf[512];
@ -38,7 +27,7 @@ diff -up net-tools-2.0/lib/interface.c.stack net-tools-2.0/lib/interface.c
fh = fopen(_PATH_PROCNET_DEV, "r"); fh = fopen(_PATH_PROCNET_DEV, "r");
if (!fh) { if (!fh) {
@@ -330,10 +332,11 @@ static int if_readlist_proc(char *target @@ -330,10 +332,11 @@ static int if_readlist_proc(const char *
_PATH_PROCNET_DEV, strerror(errno)); _PATH_PROCNET_DEV, strerror(errno));
return -2; return -2;
} }
@ -54,7 +43,7 @@ diff -up net-tools-2.0/lib/interface.c.stack net-tools-2.0/lib/interface.c
#if 0 /* pretty, but can't cope with missing fields */ #if 0 /* pretty, but can't cope with missing fields */
fmt = proc_gen_fmt(_PATH_PROCNET_DEV, 1, fh, fmt = proc_gen_fmt(_PATH_PROCNET_DEV, 1, fh,
@@ -358,13 +361,13 @@ static int if_readlist_proc(char *target @@ -358,14 +361,14 @@ static int if_readlist_proc(const char *
if (!fmt) if (!fmt)
return -1; return -1;
#else #else
@ -64,15 +53,16 @@ diff -up net-tools-2.0/lib/interface.c.stack net-tools-2.0/lib/interface.c
err = 0; err = 0;
- while (fgets(buf, sizeof buf, fh)) { - while (fgets(buf, sizeof buf, fh)) {
- char *s, name[IFNAMSIZ];
- s = get_name(name, buf);
+ while (getline(&line, &linelen, fh) != -1) { + while (getline(&line, &linelen, fh) != -1) {
+ char *s, *name; const char *s;
- char name[IFNAMSIZ];
- s = get_name(name, buf);
+ char *name;
+ s = get_name(&name, line); + s = get_name(&name, line);
ife = if_cache_add(name); ife = if_cache_add(name);
get_dev_fields(s, ife); get_dev_fields(s, ife);
ife->statistics_valid = 1; ife->statistics_valid = 1;
@@ -379,6 +382,8 @@ static int if_readlist_proc(char *target @@ -380,6 +383,8 @@ static int if_readlist_proc(const char *
#if 0 #if 0
free(fmt); free(fmt);
#endif #endif
@ -81,8 +71,8 @@ diff -up net-tools-2.0/lib/interface.c.stack net-tools-2.0/lib/interface.c
fclose(fh); fclose(fh);
return err; return err;
} }
@@ -386,24 +391,28 @@ static int if_readlist_proc(char *target @@ -387,24 +392,28 @@ static int if_readlist_proc(const char *
static int if_readlist_rep(char *target, struct interface *ife) static int if_readlist_rep(const char *target, struct interface *ife)
{ {
FILE *fh; FILE *fh;
- char buf[512]; - char buf[512];
@ -118,7 +108,7 @@ diff -up net-tools-2.0/lib/interface.c.stack net-tools-2.0/lib/interface.c
get_dev_fields(s, ife); get_dev_fields(s, ife);
if (target && !strcmp(target,name)) if (target && !strcmp(target,name))
{ {
@@ -416,6 +425,8 @@ static int if_readlist_rep(char *target, @@ -417,6 +426,8 @@ static int if_readlist_rep(const char *t
err = -1; err = -1;
} }

View File

@ -1,15 +0,0 @@
diff -up net-tools-2.0/netstat.c.probe net-tools-2.0/netstat.c
--- net-tools-2.0/netstat.c.probe 2012-10-04 11:36:15.085940621 +0200
+++ net-tools-2.0/netstat.c 2012-10-04 11:36:15.092940511 +0200
@@ -1267,6 +1267,11 @@ static void tcp_do_one(int lnr, const ch
(double) time_len / HZ, retr, timeout);
break;
+ case 4:
+ snprintf(timers, sizeof(timers), _("probe (%2.2f/%ld/%d)"),
+ (double) time_len / HZ, retr, timeout);
+ break;
+
default:
snprintf(timers, sizeof(timers), _("unkn-%d (%2.2f/%ld/%d)"),
timer_run, (double) time_len / HZ, retr, timeout);

View File

@ -1,33 +0,0 @@
diff --git a/netstat.c b/netstat.c
index 911d0c3..d6037a0 100644
--- a/netstat.c
+++ b/netstat.c
@@ -167,6 +167,7 @@ int flag_exp = 1;
int flag_wide= 0;
int flag_prg = 0;
int flag_arg = 0;
+int flag_noprot = 0;
int flag_ver = 0;
int flag_l2cap = 0;
int flag_rfcomm = 0;
@@ -181,9 +182,9 @@ FILE *procinfo;
perror((file)); \
return -1; \
} \
- if (flag_arg || flag_ver) \
+ if (!flag_noprot && (flag_arg || flag_ver)) \
ESYSNOT("netstat", (name)); \
- if (flag_arg) \
+ if (!flag_noprot && flag_arg) \
rc = 1; \
} else { \
do { \
@@ -2308,7 +2309,7 @@ int main
if ((flag_inet || flag_inet6 || flag_sta) &&
!(flag_tcp || flag_sctp || flag_udp || flag_udplite || flag_raw))
- flag_tcp = flag_sctp = flag_udp = flag_udplite = flag_raw = 1;
+ flag_noprot = flag_tcp = flag_sctp = flag_udp = flag_udplite = flag_raw = 1;
if ((flag_tcp || flag_sctp || flag_udp || flag_udplite || flag_raw || flag_igmp) &&
!(flag_inet || flag_inet6))

View File

@ -1,9 +1,9 @@
%global checkout 20141007git %global checkout 20141124git
Summary: Basic networking tools Summary: Basic networking tools
Name: net-tools Name: net-tools
Version: 2.0 Version: 2.0
Release: 0.30.%{checkout}%{?dist} Release: 0.31.%{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/
@ -47,15 +47,9 @@ 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 Patch9: net-tools-ifconfig-long-iface-crasher.patch
# fixed tcp timers info in netstat (#466845)
Patch10: net-tools-netstat-probe.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
# make sctp quiet on systems without sctp (#1063906)
Patch21: net-tools-sctp-quiet.patch
BuildRequires: bluez-libs-devel BuildRequires: bluez-libs-devel
BuildRequires: gettext, libselinux BuildRequires: gettext, libselinux
BuildRequires: libselinux-devel BuildRequires: libselinux-devel
@ -78,7 +72,6 @@ Most of them are obsolete. For replacement check iproute package.
%patch7 -p1 -b .stack %patch7 -p1 -b .stack
%patch8 -p1 -b .sctp %patch8 -p1 -b .sctp
%patch9 -p1 -b .long_iface %patch9 -p1 -b .long_iface
%patch10 -p1 -b .probe
cp %SOURCE1 ./config.h cp %SOURCE1 ./config.h
cp %SOURCE2 ./config.make cp %SOURCE2 ./config.make
@ -90,7 +83,6 @@ cp %SOURCE7 ./man/en_US
cp %SOURCE8 ./man/en_US cp %SOURCE8 ./man/en_US
%patch20 -p1 -b .interfaces %patch20 -p1 -b .interfaces
%patch21 -p1 -b .sctp-quiet
touch ./config.h touch ./config.h
@ -167,6 +159,9 @@ 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
* Mon Nov 24 2014 Jiri Popelka <jpopelka@redhat.com> - 2.0-0.31.20141124git
- latest upstream snapshot (#1162284)
* Thu Nov 20 2014 Jiri Popelka <jpopelka@redhat.com> - 2.0-0.30.20141007git * Thu Nov 20 2014 Jiri Popelka <jpopelka@redhat.com> - 2.0-0.30.20141007git
- ether-wake: apply Debian's hardening patch - ether-wake: apply Debian's hardening patch