- remove duplicate arp entries (#185604)
This commit is contained in:
parent
1fbcbe544c
commit
02ab27fccd
41
net-tools-1.60-fgets.patch
Normal file
41
net-tools-1.60-fgets.patch
Normal file
@ -0,0 +1,41 @@
|
||||
Fix for when arp_disp_2() is called without opt_n set. If there is a DNS lookup, an
|
||||
entry is added to /proc/net/arp after fopen(), resulting in a duplicate entry.
|
||||
|
||||
--- net-tools-1.60/arp.c.fgets 2005-12-10 14:52:04.000000000 -0500
|
||||
+++ net-tools-1.60/arp.c 2005-12-11 00:15:59.000000000 -0500
|
||||
@@ -528,7 +528,7 @@ static int arp_show(char *name)
|
||||
int type, flags;
|
||||
FILE *fp;
|
||||
char *hostname;
|
||||
- int num, entries = 0, showed = 0;
|
||||
+ int num, entries, showed = 0;
|
||||
|
||||
host[0] = '\0';
|
||||
|
||||
@@ -546,18 +546,21 @@ static int arp_show(char *name)
|
||||
perror(_PATH_PROCNET_ARP);
|
||||
return (-1);
|
||||
}
|
||||
+ /* Count number of entries, in case file changes */
|
||||
+ for (entries = 0; fgets(line, sizeof(line), fp); entries++);
|
||||
+ entries--;
|
||||
+ fseek (fp, 0L, SEEK_SET);
|
||||
/* Bypass header -- read until newline */
|
||||
if (fgets(line, sizeof(line), fp) != (char *) NULL) {
|
||||
strcpy(mask, "-");
|
||||
strcpy(dev, "-");
|
||||
/* Read the ARP cache entries. */
|
||||
- for (; fgets(line, sizeof(line), fp);) {
|
||||
- num = sscanf(line, "%s 0x%x 0x%x %100s %100s %100s\n",
|
||||
- ip, &type, &flags, hwa, mask, dev);
|
||||
- if (num < 4)
|
||||
+ for (num = 0; num < entries; num++) {
|
||||
+ fgets(line, sizeof(line), fp);
|
||||
+ if (sscanf(line, "%s 0x%x 0x%x %100s %100s %100s\n",
|
||||
+ ip, &type, &flags, hwa, mask, dev) < 4)
|
||||
break;
|
||||
|
||||
- entries++;
|
||||
/* if the user specified hw-type differs, skip it */
|
||||
if (hw_set && (type != hw->type))
|
||||
continue;
|
@ -3,7 +3,7 @@
|
||||
Summary: Basic networking tools.
|
||||
Name: net-tools
|
||||
Version: 1.60
|
||||
Release: 63
|
||||
Release: 64
|
||||
License: GPL
|
||||
Group: System Environment/Base
|
||||
Source0: http://www.tazenda.demon.co.uk/phil/net-tools/net-tools-%{version}.tar.bz2
|
||||
@ -60,6 +60,7 @@ Patch45: net-tools-1.60-interface_stack.patch
|
||||
Patch46: net-tools-1.60-selinux.patch
|
||||
Patch47: net-tools-1.60-netstat_stop_trim.patch
|
||||
Patch48: net-tools-1.60-netstat_inode.patch
|
||||
Patch49: net-tools-1.60-fgets.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-root
|
||||
Requires(post,preun): chkconfig
|
||||
@ -116,6 +117,7 @@ ifconfig, netstat, route, and others.
|
||||
%patch46 -p1 -b .selinux
|
||||
%patch47 -p1 -b .trim
|
||||
%patch48 -p1 -b .inode
|
||||
%patch49 -p1 -b .fgets
|
||||
|
||||
cp %SOURCE2 ./config.h
|
||||
cp %SOURCE3 ./config.make
|
||||
@ -227,6 +229,9 @@ exit 0
|
||||
%{_sysconfdir}/rc.d/init.d/netplugd
|
||||
|
||||
%changelog
|
||||
* Thu Mar 16 2006 Radek Vokál <rvokal@redhat.com> - 1.60-54
|
||||
- remove duplicate arp entries (#185604)
|
||||
|
||||
* Thu Feb 23 2006 Radek Vokál <rvokal@redhat.com> - 1.60-63
|
||||
- show inodes in netstat (#180974)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user