- fixed overflow patch (#551625)

- ifconfig interface:0 del <IP> will remove the Aliased IP on IA64
    (#473211)
- interface slip: cast keepalive/outfill to unsigned long to fix warnings
    on 64bit hosts -- no functional changes since these only have an 8bit
    range anyways
- interface: fix IPv6 parsing of interfaces with large indexes (> 255)
    (Debian #433543)
This commit is contained in:
Jiří Popelka 2010-01-02 11:51:31 +00:00
parent d0b7400c33
commit 1f3e550147
7 changed files with 85 additions and 32 deletions

33
net-tools-1.60-IA64.patch Normal file
View File

@ -0,0 +1,33 @@
diff -up net-tools-1.60/ifconfig.c.IA64 net-tools-1.60/ifconfig.c
--- net-tools-1.60/ifconfig.c.IA64 2010-01-02 11:35:39.000000000 +0100
+++ net-tools-1.60/ifconfig.c 2010-01-02 11:35:39.000000000 +0100
@@ -894,7 +894,8 @@ int main(int argc, char **argv)
continue;
}
- memcpy(&ip, &sin.sin_addr.s_addr, sizeof(unsigned long));
+ memset(&ip, 0, sizeof(unsigned long));
+ memcpy(&ip, &sin.sin_addr.s_addr, sizeof(sin.sin_addr.s_addr));
if (get_nmbc_parent(ifr.ifr_name, &nm, &bc) < 0) {
fprintf(stderr, _("Interface %s not initialized\n"),
diff -up net-tools-1.60/lib/interface.c.IA64 net-tools-1.60/lib/interface.c
--- net-tools-1.60/lib/interface.c.IA64 2010-01-02 11:35:39.000000000 +0100
+++ net-tools-1.60/lib/interface.c 2010-01-02 12:03:05.000000000 +0100
@@ -491,14 +491,14 @@ int if_fetch(struct interface *ife)
if (ioctl(skfd, SIOCGOUTFILL, &ifr) < 0)
ife->outfill = 0;
else
- ife->outfill = (unsigned int) ifr.ifr_data;
+ ife->outfill = (unsigned long) ifr.ifr_data;
#endif
#ifdef SIOCGKEEPALIVE
strcpy(ifr.ifr_name, ifname);
if (ioctl(skfd, SIOCGKEEPALIVE, &ifr) < 0)
ife->keepalive = 0;
else
- ife->keepalive = (unsigned int) ifr.ifr_data;
+ ife->keepalive = (unsigned long) ifr.ifr_data;
#endif
}
#endif

View File

@ -0,0 +1,12 @@
diff -up net-tools-1.60/lib/interface.c.large-indexes net-tools-1.60/lib/interface.c
--- net-tools-1.60/lib/interface.c.large-indexes 2010-01-02 12:05:13.000000000 +0100
+++ net-tools-1.60/lib/interface.c 2010-01-02 12:34:24.000000000 +0100
@@ -766,7 +766,7 @@ void ife_print_long(struct interface *pt
/* FIXME: should be integrated into interface.c. */
if ((f = fopen(_PATH_PROCNET_IFINET6, "r")) != NULL) {
- while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
+ while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %08x %02x %02x %02x %20s\n",
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
addr6p[4], addr6p[5], addr6p[6], addr6p[7],
&if_idx, &plen, &scope, &dad_status, devname) != EOF) {

View File

@ -23,7 +23,7 @@
FILE *procinfo;
@@ -980,17 +983,21 @@
@@ -980,16 +983,20 @@
get_sname(htons(local_port), "tcp",
flag_not & FLAG_NUM_PORT));
@ -35,8 +35,7 @@
+ }
strcat(local_addr, ":");
strncat(local_addr, buffer, sizeof(local_addr));
local_addr[sizeof(local_addr)-1] = 0;
strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1);
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT));
-
@ -49,7 +48,7 @@
+ }
strcat(rem_addr, ":");
strncat(rem_addr, buffer, sizeof(rem_addr));
strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1);
@@ -1776,6 +1783,7 @@
{"fib", 0, 0, 'F'},
{"groups", 0, 0, 'g'},

View File

@ -24,7 +24,7 @@
+ if ((strlen(local_addr) + strlen(buffer)) >= 27)
local_addr[22 - strlen(buffer)] = '\0';
strcat(local_addr, ":");
strncat(local_addr, buffer, sizeof(local_addr));
strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1);
@@ -934,8 +934,8 @@
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT));
@ -35,7 +35,7 @@
+ if ((strlen(rem_addr) + strlen(buffer)) >= 27)
rem_addr[22 - strlen(buffer)] = '\0';
strcat(rem_addr, ":");
strncat(rem_addr, buffer, sizeof(rem_addr));
strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1);
@@ -958,7 +958,7 @@
retr, timeout);
break;
@ -55,7 +55,7 @@
+ if ((strlen(local_addr) + strlen(buffer)) >= 27)
local_addr[22 - strlen(buffer)] = '\0';
strcat(local_addr, ":");
strncat(local_addr, buffer, sizeof(local_addr));
strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1);
@@ -1055,8 +1055,8 @@
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT));
@ -66,7 +66,7 @@
+ if ((strlen(rem_addr) + strlen(buffer)) >= 27)
rem_addr[22 - strlen(buffer)] = '\0';
strcat(rem_addr, ":");
strncat(rem_addr, buffer, sizeof(rem_addr));
strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1);
@@ -1081,7 +1081,7 @@
retr, timeout);
break;

View File

@ -1,63 +1,57 @@
diff -ur net-tools-1.60.orig/netstat.c net-tools-1.60/netstat.c
--- net-tools-1.60.orig/netstat.c 2004-04-07 11:47:05.000000000 -0400
+++ net-tools-1.60/netstat.c 2004-04-07 16:47:15.000000000 -0400
@@ -777,7 +777,8 @@
diff -up net-tools-1.60/netstat.c.overflow net-tools-1.60/netstat.c
--- net-tools-1.60/netstat.c.overflow 2010-01-02 10:45:45.000000000 +0100
+++ net-tools-1.60/netstat.c 2010-01-02 10:50:50.000000000 +0100
@@ -777,7 +777,7 @@ static void tcp_do_one(int lnr, const ch
local_addr[22 - strlen(buffer)] = '\0';
strcat(local_addr, ":");
- strcat(local_addr, buffer);
+ strncat(local_addr, buffer, sizeof(local_addr));
+ local_addr[sizeof(local_addr)-1] = 0;
+ strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1);
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT));
@@ -785,7 +786,8 @@
@@ -785,7 +785,7 @@ static void tcp_do_one(int lnr, const ch
rem_addr[22 - strlen(buffer)] = '\0';
strcat(rem_addr, ":");
- strcat(rem_addr, buffer);
+ strncat(rem_addr, buffer, sizeof(rem_addr));
+ rem_addr[sizeof(rem_addr)-1] = 0;
+ strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1);
timers[0] = '\0';
if (flag_opt)
@@ -926,7 +928,8 @@
@@ -926,7 +926,7 @@ static void udp_do_one(int lnr, const ch
if ((strlen(local_addr) + strlen(buffer)) > 22)
local_addr[22 - strlen(buffer)] = '\0';
strcat(local_addr, ":");
- strcat(local_addr, buffer);
+ strncat(local_addr, buffer, sizeof(local_addr));
+ local_addr[sizeof(local_addr)-1] = 0;
+ strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1);
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT));
@@ -935,7 +938,8 @@
@@ -935,7 +935,7 @@ static void udp_do_one(int lnr, const ch
if ((strlen(rem_addr) + strlen(buffer)) > 22)
rem_addr[22 - strlen(buffer)] = '\0';
strcat(rem_addr, ":");
- strcat(rem_addr, buffer);
+ strncat(rem_addr, buffer, sizeof(rem_addr));
+ rem_addr[sizeof(rem_addr)-1] = 0;
+ strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1);
timers[0] = '\0';
if (flag_opt)
@@ -1045,7 +1049,8 @@
@@ -1045,7 +1045,7 @@ static void raw_do_one(int lnr, const ch
if ((strlen(local_addr) + strlen(buffer)) > 22)
local_addr[22 - strlen(buffer)] = '\0';
strcat(local_addr, ":");
- strcat(local_addr, buffer);
+ strncat(local_addr, buffer, sizeof(local_addr));
+ local_addr[sizeof(local_addr)-1] = 0;
+ strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1);
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT));
@@ -1054,7 +1059,8 @@
@@ -1054,7 +1054,7 @@ static void raw_do_one(int lnr, const ch
if ((strlen(rem_addr) + strlen(buffer)) > 22)
rem_addr[22 - strlen(buffer)] = '\0';
strcat(rem_addr, ":");
- strcat(rem_addr, buffer);
+ strncat(rem_addr, buffer, sizeof(rem_addr));
+ rem_addr[sizeof(rem_addr)-1] = 0;
+ strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1);
timers[0] = '\0';
if (flag_opt)

View File

@ -10,7 +10,7 @@
+ local_addr[27 - strlen(buffer) - 1] = '\0';
strcat(local_addr, ":");
strncat(local_addr, buffer, sizeof(local_addr));
strncat(local_addr, buffer, sizeof(local_addr)-strlen(local_addr)-1);
@@ -782,8 +782,8 @@
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT));
@ -21,7 +21,7 @@
+ rem_addr[27 - strlen(buffer) - 1] = '\0';
strcat(rem_addr, ":");
strncat(rem_addr, buffer, sizeof(rem_addr));
strncat(rem_addr, buffer, sizeof(rem_addr)-strlen(rem_addr)-1);
@@ -816,7 +816,7 @@
timer_run, (double) time_len / HZ, retr, timeout);
break;

View File

@ -1,7 +1,7 @@
Summary: Basic networking tools
Name: net-tools
Version: 1.60
Release: 100%{?dist}
Release: 101%{?dist}
License: GPL+
Group: System Environment/Base
URL: http://net-tools.berlios.de/
@ -117,6 +117,13 @@ Patch82: net-tools-1.60-hostname-short.patch
# use <linux/mii.h> instead of "mii.h" and fix Bug #491358
Patch83: net-tools-1.60-mii-refactor.patch
# Bug 473211: ifconfig interface:0 del <IP> will remove the Aliased IP on IA64
# interface slip: cast keepalive/outfill to unsigned long to fix warnings on 64bit hosts -- no functional changes since these only have an 8bit range anyways
Patch84: net-tools-1.60-IA64.patch
# interface: fix IPv6 parsing of interfaces with large indexes (> 255) (Debian #433543)
Patch85: net-tools-1.60-large-indexes.patch
BuildRequires: gettext, libselinux
BuildRequires: libselinux-devel
Requires: hostname
@ -205,6 +212,8 @@ Most of them are obsolete. For replacement check iproute package.
%patch81 -p1 -b .slattach-fchown
%patch82 -p1 -b .hostname-short
%patch83 -p1 -b .mii-refactor
%patch84 -p1 -b .IA64
%patch85 -p1 -b .large-indexes
cp %SOURCE1 ./config.h
cp %SOURCE2 ./config.make
@ -304,6 +313,12 @@ rm -rf %{buildroot}
%config(noreplace) %{_sysconfdir}/ethers
%changelog
* Sat Jan 2 2010 Jiri Popelka <jpopelka@redhat.com> - 1.60-101
- fixed overflow patch (#551625)
- ifconfig interface:0 del <IP> will remove the Aliased IP on IA64 (#473211)
- interface slip: cast keepalive/outfill to unsigned long to fix warnings on 64bit hosts -- no functional changes since these only have an 8bit range anyways
- interface: fix IPv6 parsing of interfaces with large indexes (> 255) (Debian #433543)
* Mon Dec 21 2009 Jiri Popelka <jpopelka@redhat.com> - 1.60-100
- Move hostname to separate package