- netplug moved to separate package

- #319981 and #322901 - minor man pages changes
- applied changes from berlios cvs, which fix: Berlios #16232, Gentoo
    #283759 and polish Makefile and slattach
This commit is contained in:
Jiří Popelka 2009-09-30 13:23:57 +00:00
parent 14f06a4777
commit 4a78a731c3
11 changed files with 211 additions and 336 deletions

View File

@ -1,17 +0,0 @@
--- net-tools-1.60/netplug-1.2.9/Makefile.kill_bitkeeper 2005-01-10 11:36:32.000000000 +0100
+++ net-tools-1.60/netplug-1.2.9/Makefile 2005-01-10 11:38:01.796744224 +0100
@@ -24,10 +24,12 @@
install $(install_opts) -m 755 scripts/rc.netplugd $(initdir)/netplugd
install $(install_opts) -m 444 man/man8/netplugd.8 $(mandir)/man8
-bk_root := $(shell bk root)
+#bk_root := $(shell bk root)
+bk_root := $(shell)
tar_root := netplug-$(version)
tar_file := $(bk_root)/$(tar_root).tar.bz2
-files := $(shell bk sfiles -Ug)
+#files := $(shell bk sfiles -Ug)
+file := $(shell)
tarball: $(tar_file)

View File

@ -1,11 +1,12 @@
diff -up net-tools-1.60/lib/ec_hw.c.old net-tools-1.60/lib/ec_hw.c
--- net-tools-1.60/lib/ec_hw.c.old 1999-11-20 22:02:53.000000000 +0100
+++ net-tools-1.60/lib/ec_hw.c 2008-02-25 09:04:00.000000000 +0100
@@ -18,6 +18,7 @@
diff -up net-tools-1.60/lib/ec_hw.c.ec_hw_null net-tools-1.60/lib/ec_hw.c
--- net-tools-1.60/lib/ec_hw.c.ec_hw_null 1999-11-20 22:02:53.000000000 +0100
+++ net-tools-1.60/lib/ec_hw.c 2009-09-15 16:33:27.000000000 +0200
@@ -15,7 +15,7 @@
#include "config.h"
#if HAVE_HWEC
-
+#include <stdlib.h>
#include <net/if_arp.h>
#include "net-support.h"
+#define NULL ((void *) 0)
struct hwtype ec_hwtype =
{

View File

@ -1,50 +0,0 @@
--- net-tools-1.60/netplug-1.2.9/main.c 2004-02-22 06:52:14.000000000 +0100
+++ net-tools-1.60.new/netplug-1.2.9/main.c 2004-05-06 18:28:22.845977718 +0200
@@ -149,10 +149,10 @@
/* Poll the existing interface state, so we can catch any state
changes for which we may not have neen a netlink message. */
+static int sockfd = -1;
static void
poll_interfaces(void)
{
- static int sockfd = -1;
if (sockfd == -1) {
sockfd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
@@ -182,6 +182,12 @@
for_each_iface(pollflags);
}
+int poll_flags(struct if_info *i) {
+ if (if_match(i->name))
+ ifsm_flagpoll(i);
+ return 0;
+}
+
int debug = 0;
int
@@ -287,17 +293,11 @@
{ child_handler_pipe[0], POLLIN, 0 },
};
- {
- /* Run over each of the interfaces we know and care about, and
- make sure the state machine has done the appropriate thing
- for their current state. */
- int poll_flags(struct if_info *i) {
- if (if_match(i->name))
- ifsm_flagpoll(i);
- return 0;
- }
- for_each_iface(poll_flags);
- }
+ /* Run over each of the interfaces we know and care about, and
+ make sure the state machine has done the appropriate thing
+ for their current state. */
+ for_each_iface(poll_flags);
+
for(;;) {
int ret;

View File

@ -0,0 +1,69 @@
diff -up net-tools-1.60/lib/Makefile.makefile-berlios net-tools-1.60/lib/Makefile
--- net-tools-1.60/lib/Makefile.makefile-berlios 2009-09-15 18:07:12.000000000 +0200
+++ net-tools-1.60/lib/Makefile 2009-09-15 18:07:12.000000000 +0200
@@ -36,7 +36,7 @@ OBJS = $(sort $(VARIA) $(AFOBJS) $(HWOBJ
# This can be overwritten by the TOPLEVEL Makefile
TOPDIR=..
-CFLAGS += -I$(TOPDIR) -idirafter $(TOPDIR)/include # -fPIC
+CFLAGS += -I$(TOPDIR) -I$(TOPDIR)/include # -fPIC
SONAME=libnet-tools.so.0
.SUFFIXES: .a .so
diff -up net-tools-1.60/Makefile.makefile-berlios net-tools-1.60/Makefile
--- net-tools-1.60/Makefile.makefile-berlios 2009-09-15 18:07:12.000000000 +0200
+++ net-tools-1.60/Makefile 2009-09-15 18:08:25.000000000 +0200
@@ -88,10 +88,9 @@ endif
# Compiler and Linker Options
# You may need to uncomment and edit these if you are using libc5 and IPv6.
-COPTS = -D_GNU_SOURCE -O2 -Wall -g # -I/usr/inet6/include
-ifeq ($(origin LOPTS), undefined)
-LOPTS =
-endif
+CFLAGS ?= -O2 -g
+CFLAGS += -fno-strict-aliasing # code needs a lot of work before strict aliasing is safe
+CPPFLAGS += -D_GNU_SOURCE
RESLIB = # -L/usr/inet6/lib -linet6
ifeq ($(HAVE_AFDECnet),1)
@@ -119,8 +118,9 @@ CFLAGS += -DHAVE_SELINUX
else
endif
-CFLAGS += $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH)
-LDFLAGS += $(LOPTS) -L$(NET_LIB_PATH)
+CPPFLAGS += -I. -I$(TOPDIR)/include -I$(NET_LIB_PATH)
+LDFLAGS += -L$(NET_LIB_PATH)
+
SUBDIRS = man/ $(NET_LIB_PATH)/
@@ -131,8 +131,6 @@ LD = $(CC)
NLIB = -l$(NET_LIB_NAME)
-MDEFINES = COPTS='$(COPTS)' LOPTS='$(LOPTS)' TOPDIR='$(TOPDIR)'
-
%.o: %.c config.h version.h intl.h net-features.h $<
$(CC) $(CFLAGS) -c $<
@@ -181,14 +179,15 @@ $(NET_LIB): config.h version.h intl.h li
i18n.h: i18ndir
-libdir:
- @$(MAKE) -C $(NET_LIB_PATH) $(MDEFINES)
+libdir: version.h
+ @$(MAKE) -C $(NET_LIB_PATH)
i18ndir:
@$(MAKE) -C po
subdirs:
- @for i in $(SUBDIRS); do $(MAKE) -C $$i $(MDEFINES) ; done
+ @for i in $(SUBDIRS); do $(MAKE) -C $$i || exit $$? ; done
+
ifconfig: $(NET_LIB) ifconfig.o
$(CC) $(LDFLAGS) -o ifconfig ifconfig.o $(NLIB) $(RESLIB)

View File

@ -0,0 +1,53 @@
diff -up net-tools-1.60/man/de_DE/arp.8.man-RHEL-bugs net-tools-1.60/man/de/arp.8
--- net-tools-1.60/man/de_DE/arp.8.man-RHEL-bugs 2009-09-09 15:52:27.000000000 +0200
+++ net-tools-1.60/man/de_DE/arp.8 2009-09-09 15:59:33.000000000 +0200
@@ -120,11 +120,9 @@ Flagge) kann
.B Netmaske
f\(:ur ARP-Eintr\(:age f\(:ur ganze Subnetze angegeben werde. Von dieser
Praxis wird abgeraten. Sie wird von \(:alteren Kerneln unterst\(:utzt, da
-sie gelegentlich n\(:utzlich ist. Wird die
-If the
-.B temp
-Flagge nicht angegeben, so werden die erzeugten Eintr\(:age nicht dauerhaft
-in den ARP-Cache eingetragen.
+sie gelegentlich n\(:utzlich ist.
+Der Eintrag wird permanent im ARP-Cache gespeichert,
+wenn das \fBtemp\fR-Flag nicht angegeben wird.
.br
.B ANMERKUNG:
Ab der Kernelversion 2.2.0 ist es nicht mehr m\(:oglich ARP-Eintr\(:age f\(:ur
diff -up net-tools-1.60/man/en_US/hostname.1.man-RHEL-bugs net-tools-1.60/man/en_US/hostname.1
--- net-tools-1.60/man/en_US/hostname.1.man-RHEL-bugs 2009-09-09 15:52:27.000000000 +0200
+++ net-tools-1.60/man/en_US/hostname.1 2009-09-09 15:52:27.000000000 +0200
@@ -100,11 +100,11 @@ complete FQDN of the system is returned
.LP
The function
.BR gethostname(2)
-is used to get the hostname. Only when the
-.BR "hostname \-s"
-is called will
-.BR gethostbyname(3)
-be called. The difference in
+is used to get the hostname.
+When \fBhostname\fR
+is called with \fB-s\fR, \fB-a\fR, \fB-i\fR, \fB-f\fR or \fB-d\fR
+the \fBgethostbyname(3)\fR will be called.
+The difference in
.BR gethostname(2)
and
.BR gethostbyname(3)
@@ -117,11 +117,9 @@ and
to decide whether to read information in
.IR /etc/sysconfig/network
or
-.IR /etc/hosts
-. To add another dimension to this,
-the
-.B hostname
-is also set when the network interface is brought up.
+.IR /etc/hosts .
+If \fBgethostbyname(3)\fR cannot resolve host name,
+\fIUnknown host\fR warning is returned.
.SS "SET NAME"
When called with one argument or with the

View File

@ -0,0 +1,14 @@
diff -up net-tools-1.60/lib/masq_info.c.masqinfo-raw-ip net-tools-1.60/lib/masq_info.c
--- net-tools-1.60/lib/masq_info.c.masqinfo-raw-ip 2000-10-28 12:59:42.000000000 +0200
+++ net-tools-1.60/lib/masq_info.c 2009-09-15 17:05:24.000000000 +0200
@@ -119,7 +119,9 @@ static int read_masqinfo(FILE * f, struc
ms->src.sin_family = AF_INET;
ms->dst.sin_family = AF_INET;
- if (strcmp("TCP", buf) == 0)
+ if (strcmp("IP", buf) == 0)
+ ms->proto = "ip";
+ else if (strcmp("TCP", buf) == 0)
ms->proto = "tcp";
else if (strcmp("UDP", buf) == 0)
ms->proto = "udp";

View File

@ -1,32 +0,0 @@
--- net-tools-1.60/netplug-1.2.9/scripts/rc.netplugd.old 2007-06-08 13:03:45.000000000 +0200
+++ net-tools-1.60/netplug-1.2.9/scripts/rc.netplugd 2007-06-08 13:04:01.000000000 +0200
@@ -17,11 +17,6 @@
# Source networking configuration.
. /etc/sysconfig/network
-# Check that networking is up.
-[ ${NETWORKING} = "no" ] && exit 0
-
-[ -x /sbin/netplugd ] || exit 0
-
if [ -f /etc/sysconfig/netplugd ]; then
. /etc/sysconfig/netplugd
fi
@@ -30,6 +25,8 @@
case "$1" in
start)
# Start daemon.
+ [ ${NETWORKING} = "no" ] && exit 1
+ [ -x /sbin/netplugd ] || exit 1
echo -n $"Starting network plug daemon: "
daemon /sbin/netplugd ${NETPLUGDARGS} -p /var/run/netplugd.pid
RETVAL=$?
@@ -57,7 +54,7 @@
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
- RETVAL=1
+ RETVAL=3
;;
esac

View File

@ -0,0 +1,24 @@
diff -up net-tools-1.60/slattach.c.slattach-fchown net-tools-1.60/slattach.c
--- net-tools-1.60/slattach.c.slattach-fchown 2000-10-28 12:59:41.000000000 +0200
+++ net-tools-1.60/slattach.c 2009-09-15 18:17:01.000000000 +0200
@@ -195,15 +195,17 @@ tty_lock(char *path, int mode)
return(-1);
}
- (void) close(fd);
-
/* Make sure UUCP owns the lockfile. Required by some packages. */
if ((pw = getpwnam(_UID_UUCP)) == NULL) {
if (opt_q == 0) fprintf(stderr, _("slattach: tty_lock: UUCP user %s unknown!\n"),
_UID_UUCP);
+ (void) close(fd);
return(0); /* keep the lock anyway */
}
- (void) chown(saved_path, pw->pw_uid, pw->pw_gid);
+ (void) fchown(fd, pw->pw_uid, pw->pw_gid);
+
+ (void) close(fd);
+
saved_lock = 1;
} else { /* unlock */
if (saved_lock != 1) return(0);

View File

@ -1,22 +1,19 @@
%define npversion 1.2.9
Summary: Basic networking tools
Name: net-tools
Version: 1.60
Release: 95%{?dist}
Release: 96%{?dist}
License: GPL+
Group: System Environment/Base
URL: http://net-tools.berlios.de/
Source0: http://www.tazenda.demon.co.uk/phil/net-tools/net-tools-%{version}.tar.bz2
Source1: http://www.red-bean.com/~bos/netplug/netplug-%{npversion}.tar.bz2
Source2: net-tools-%{version}-config.h
Source3: net-tools-%{version}-config.make
Source4: ether-wake.c
Source5: ether-wake.8
Source6: mii-diag.c
Source7: mii-diag.8
Source8: iptunnel.8
Source9: ipmaddr.8
Source1: net-tools-%{version}-config.h
Source2: net-tools-%{version}-config.make
Source3: ether-wake.c
Source4: ether-wake.8
Source5: mii-diag.c
Source6: mii-diag.8
Source7: iptunnel.8
Source8: ipmaddr.8
Patch1: net-tools-1.57-bug22040.patch
Patch2: net-tools-1.60-miiioctl.patch
Patch3: net-tools-1.60-manydevs.patch
@ -45,10 +42,8 @@ Patch29: net-tools-1.60-num-ports.patch
Patch30: net-tools-1.60-duplicate-tcp.patch
Patch31: net-tools-1.60-statalias.patch
Patch32: net-tools-1.60-isofix.patch
Patch33: net-tools-1.60-bitkeeper.patch
Patch34: net-tools-1.60-ifconfig_ib.patch
Patch35: net-tools-1.60-de.patch
Patch36: netplug-1.2.9-execshield.patch
Patch37: net-tools-1.60-pie.patch
Patch38: net-tools-1.60-ifaceopt.patch
Patch39: net-tools-1.60-trim_iface.patch
@ -75,7 +70,6 @@ Patch59: net-tools-1.60-arp-unaligned-access.patch
Patch60: net-tools-1.60-sctp-quiet.patch
Patch61: net-tools-1.60-remove_node.patch
Patch62: net-tools-1.60-netstat-interfaces-crash.patch
Patch63: net-tools-1.60-netplugd_init.patch
Patch64: net-tools-1.60-ec_hw_null.patch
Patch65: net-tools-1.60-statistics_buffer.patch
Patch66: net-tools-1.60-sctp-addrs.patch
@ -103,10 +97,21 @@ Patch76: net-tools-1.60-ib-warning.patch
# notes in man pages, saying that these tools are obsolete
Patch77: net-tools-1.60-man-obsolete.patch
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(postun): /sbin/service
# Bug 319981 hostname -s gives hostname: Unknown host when the FQDN does not resolve
# Bug 322901 Sens negating error in man page translation (arp)
Patch78: net-tools-1.60-man-RHEL-bugs.patch
# handle raw "IP" masqinfo
Patch79: net-tools-1.60-masqinfo-raw-ip.patch
# touch up build system to respect normal toolchain env vars rather than requiring people to set random custom ones
# add missing dependency on version.h to libdir target to fix parallel build failures
# convert -idirafter to -I
Patch80: net-tools-1.60-makefile-berlios.patch
# slattach: use fchown() rather than chown() to avoid race between creation and permission changing
Patch81: net-tools-1.60-slattach-fchown.patch
BuildRequires: gettext, libselinux
BuildRequires: libselinux-devel
@ -116,7 +121,7 @@ including ifconfig, netstat, route, and others.
Most of them are obsolete. For replacement check iproute package.
%prep
%setup -q -a 1
%setup -q
%patch1 -p1 -b .bug22040
%patch2 -p1 -b .miiioctl
%patch3 -p0 -b .manydevs
@ -145,10 +150,8 @@ Most of them are obsolete. For replacement check iproute package.
%patch30 -p1 -b .dup-tcp
%patch31 -p1 -b .statalias
%patch32 -p1 -b .isofix
%patch33 -p1 -b .bitkeeper
%patch34 -p1 -b .ifconfig_ib
%patch35 -p1
%patch36 -p1 -b .execshield
%patch37 -p1 -b .pie
%patch38 -p1 -b .ifaceopt
%patch39 -p1 -b .trim-iface
@ -175,7 +178,6 @@ Most of them are obsolete. For replacement check iproute package.
%patch60 -p1 -b .quiet
%patch61 -p1
%patch62 -p1 -b .iface-crash
%patch63 -p1
%patch64 -p1
%patch65 -p1 -b .buffer
%patch66 -p1 -b .sctp-addrs
@ -190,15 +192,19 @@ Most of them are obsolete. For replacement check iproute package.
%patch75 -p1 -b .debug-fix
%patch76 -p1 -b .ib-warning
%patch77 -p1 -b .man-obsolete
%patch78 -p1 -b .man-RHEL-bugs
%patch79 -p1 -b .masqinfo-raw-ip
%patch80 -p1 -b .makefile-berlios
%patch81 -p1 -b .slattach-fchown
cp %SOURCE2 ./config.h
cp %SOURCE3 ./config.make
cp %SOURCE4 .
cp %SOURCE5 ./man/en_US
cp %SOURCE6 .
cp %SOURCE1 ./config.h
cp %SOURCE2 ./config.make
cp %SOURCE3 .
cp %SOURCE4 ./man/en_US
cp %SOURCE5 .
cp %SOURCE6 ./man/en_US
cp %SOURCE7 ./man/en_US
cp %SOURCE8 ./man/en_US
cp %SOURCE9 ./man/en_US
%ifarch alpha
perl -pi -e "s|-O2||" Makefile
@ -239,12 +245,8 @@ export CFLAGS="$RPM_OPT_FLAGS $CFLAGS"
make
gcc $RPM_OPT_FLAGS -o ether-wake ether-wake.c
gcc $RPM_OPT_FLAGS -o mii-diag mii-diag.c
pushd netplug-%{npversion}
make
popd
%install
rm -rf %{buildroot}
mv man/de_DE man/de
mv man/fr_FR man/fr
mv man/pt_BR man/pt
@ -254,24 +256,13 @@ make BASEDIR=%{buildroot} mandir=%{_mandir} install
install -m 755 ether-wake %{buildroot}/sbin
install -m 755 mii-diag %{buildroot}/sbin
pushd netplug-%{npversion}
make install prefix=%{buildroot} \
initdir=%{buildroot}/%{_initrddir} \
mandir=%{buildroot}/%{_mandir}
mv README README.netplugd
mv TODO TODO.netplugd
popd
ln -s %{_mandir}/man8/netplugd.8.gz %{buildroot}/%{_mandir}/man5/netplug.5.gz
ln -s %{_mandir}/man8/netplugd.8.gz %{buildroot}/%{_mandir}/man5/netplug.d.5.gz
ln -s %{_mandir}/man8/netplugd.8.gz %{buildroot}/%{_mandir}/man5/netplugd.conf.5.gz
rm %{buildroot}/sbin/rarp
rm %{buildroot}%{_mandir}/man8/rarp.8*
rm %{buildroot}%{_mandir}/de/man8/rarp.8*
rm %{buildroot}%{_mandir}/fr/man8/rarp.8*
rm %{buildroot}%{_mandir}/pt/man8/rarp.8*
mkdir -p %{buildroot}%{_sysconfdir}
touch %{buildroot}%{_sysconfdir}/ethers
echo "# see man ethers for syntax" > %{buildroot}%{_sysconfdir}/ethers
@ -280,37 +271,24 @@ echo "# see man ethers for syntax" > %{buildroot}%{_sysconfdir}/ethers
%clean
rm -rf %{buildroot}
%post
/sbin/chkconfig --add netplugd
exit 0
%preun
if [ "$1" = "0" ]; then
/sbin/chkconfig --del netplugd || :
/sbin/service netplugd stop &> /dev/null || :
fi
exit 0
%postun
/sbin/service netplugd condrestart >/dev/null 2>&1 || :
exit 0
%files -f %{name}.lang
%defattr(-,root,root)
%doc netplug-%{npversion}/TODO.netplugd netplug-%{npversion}/README.netplugd COPYING
%doc COPYING
/bin/*
/sbin/*
%{_mandir}/man[158]/*
%lang(de) %{_mandir}/de/man[158]/*
%lang(fr) %{_mandir}/fr/man[158]/*
%lang(pt) %{_mandir}/pt/man[158]/*
%dir %{_sysconfdir}/netplug
%config(noreplace) %{_sysconfdir}/netplug/netplugd.conf
%config(noreplace) %{_sysconfdir}/ethers
%{_sysconfdir}/netplug.d
%{_sysconfdir}/rc.d/init.d/netplugd
%changelog
* Tue Sep 30 2009 Jiri Popelka <jpopelka@redhat.com> - 1.60-96
- netplug moved to separate package
- #319981 and #322901 - minor man pages changes
- applied changes from berlios cvs, which fix: Berlios #16232, Gentoo #283759 and polish Makefile and slattach
* Tue Sep 1 2009 Jiri Popelka <jpopelka@redhat.com> - 1.60-95
- netstat - avoid name resolution for listening or established sockets (-l) by return fast.
- netstat - --continuous should flush stdout

View File

@ -1,164 +0,0 @@
--- net-tools-1.60/netplug-1.2.9/if_info.c.execshield 2005-01-08 06:57:08.000000000 +0100
+++ net-tools-1.60/netplug-1.2.9/if_info.c 2005-02-28 14:43:05.596799288 +0100
@@ -95,15 +95,16 @@
return buf;
}
-void
-for_each_iface(int (*func)(struct if_info *))
+struct if_info *
+for_each_iface(int (*func)(struct if_info *, long), long param)
{
for(int i = 0; i < INFOHASHSZ; i++) {
for(struct if_info *info = if_info[i]; info != NULL; info = info->next) {
- if ((*func)(info))
- return;
+ if ((*func)(info, param))
+ return info;
}
}
+ return NULL;
}
/* Reevaluate the state machine based on the current state and flag settings */
@@ -285,22 +286,20 @@
}
/* handle a script termination and update the state accordingly */
+int find_pid(struct if_info *i, long param) {
+ if (i->worker == param) {
+ return 1;
+ }
+ return 0;
+}
+
void ifsm_scriptdone(pid_t pid, int exitstatus)
{
int exitok = WIFEXITED(exitstatus) && WEXITSTATUS(exitstatus) == 0;
struct if_info *info;
assert(WIFEXITED(exitstatus) || WIFSIGNALED(exitstatus));
- int find_pid(struct if_info *i) {
- if (i->worker == pid) {
- info = i;
- return 1;
- }
- return 0;
- }
-
- info = NULL;
- for_each_iface(find_pid);
+ info = for_each_iface(find_pid, pid);
if (info == NULL) {
do_log(LOG_INFO, "Unexpected child %d exited with status %d",
--- net-tools-1.60/netplug-1.2.9/netplug.h.execshield 2005-01-08 06:57:09.000000000 +0100
+++ net-tools-1.60/netplug-1.2.9/netplug.h 2005-02-28 14:43:05.597799136 +0100
@@ -83,7 +83,7 @@
struct rtattr *attrs[]);
int if_info_save_interface(struct nlmsghdr *hdr, void *arg);
void parse_rtattrs(struct rtattr *tb[], int max, struct rtattr *rta, int len);
-void for_each_iface(int (*func)(struct if_info *));
+struct if_info *for_each_iface(int (*func)(struct if_info *, long), long param);
void ifsm_flagpoll(struct if_info *info);
void ifsm_flagchange(struct if_info *info, unsigned int newflags);
--- net-tools-1.60/netplug-1.2.9/Makefile.execshield 2005-02-28 14:43:05.000000000 +0100
+++ net-tools-1.60/netplug-1.2.9/Makefile 2005-02-28 14:47:42.123760800 +0100
@@ -9,8 +9,8 @@
install_opts :=
-CFLAGS += -Wall -Werror -std=gnu99 -DNP_ETC_DIR='"$(etcdir)"' \
- -DNP_SCRIPT_DIR='"$(scriptdir)"' -ggdb3 -O3 -DNP_VERSION='"$(version)"'
+CFLAGS += -std=gnu99 -DNP_ETC_DIR='"$(etcdir)"' \
+ -DNP_SCRIPT_DIR='"$(scriptdir)"' -DNP_VERSION='"$(version)"'
netplugd: config.o netlink.o lib.o if_info.o main.o
$(CC) $(LDFLAGS) -o $@ $^
--- net-tools-1.60/netplug-1.2.9/main.c.execshield 2005-01-08 06:57:09.000000000 +0100
+++ net-tools-1.60/netplug-1.2.9/main.c 2005-02-28 14:43:05.599798832 +0100
@@ -161,11 +161,28 @@
ce.pid = info->si_pid;
ret = waitpid(info->si_pid, &ce.status, 0);
if (ret == info->si_pid)
- write(child_handler_pipe[1], &ce, sizeof(ce));
+ (void)write(child_handler_pipe[1], &ce, sizeof(ce));
}
/* Poll the existing interface state, so we can catch any state
changes for which we may not have neen a netlink message. */
+static int pollflags(struct if_info *info, long param) {
+ struct ifreq ifr;
+
+ if (!if_match(info->name))
+ return 0;
+
+ memcpy(ifr.ifr_name, info->name, sizeof(ifr.ifr_name));
+ if (ioctl(param, SIOCGIFFLAGS, &ifr) < 0)
+ do_log(LOG_ERR, "%s: can't get flags: %m", info->name);
+ else {
+ ifsm_flagchange(info, ifr.ifr_flags);
+ ifsm_flagpoll(info);
+ }
+
+ return 0;
+}
+
static void
poll_interfaces(void)
{
@@ -180,24 +197,13 @@
close_on_exec(sockfd);
}
- int pollflags(struct if_info *info) {
- struct ifreq ifr;
-
- if (!if_match(info->name))
- return 0;
-
- memcpy(ifr.ifr_name, info->name, sizeof(ifr.ifr_name));
- if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) < 0)
- do_log(LOG_ERR, "%s: can't get flags: %m", info->name);
- else {
- ifsm_flagchange(info, ifr.ifr_flags);
- ifsm_flagpoll(info);
- }
-
- return 0;
- }
+ for_each_iface(pollflags, sockfd);
+}
- for_each_iface(pollflags);
+static int poll_flags(struct if_info *i, long param) {
+ if (if_match(i->name))
+ ifsm_flagpoll(i);
+ return 0;
}
int debug = 0;
@@ -331,17 +337,11 @@
{ child_handler_pipe[0], POLLIN, 0 },
};
- {
- /* Run over each of the interfaces we know and care about, and
- make sure the state machine has done the appropriate thing
- for their current state. */
- int poll_flags(struct if_info *i) {
- if (if_match(i->name))
- ifsm_flagpoll(i);
- return 0;
- }
- for_each_iface(poll_flags);
- }
+ /* Run over each of the interfaces we know and care about, and
+ make sure the state machine has done the appropriate thing
+ for their current state. */
+ for_each_iface(poll_flags, 0);
+
for(;;) {
int ret;

View File

@ -1,5 +1,4 @@
888774accab40217dde927e21979c165 net-tools-1.60.tar.bz2
3bc8062d8033e3f897b015f2889ce5a9 netplug-1.2.9.tar.bz2
64a9a08dd016d02b6af3deef3277ad98 mii-diag.c
8c6ac053fcab98a3fce2181e7da878ea mii-diag.8
15fe21b9cac19a79649c41fa7919e888 ether-wake.c