From 9b2dbe00100d4e1077404b9d781f35adad979467 Mon Sep 17 00:00:00 2001 From: "David Kaspar [Dee'Kej]" Date: Thu, 24 May 2018 16:06:03 +0200 Subject: netreport functionality dropped This concept is quite outdated, and not sane to use at all. --- Makefile | 1 - doc/sysconfig.txt | 3 +- etc/NetworkManager/dispatcher.d/00-netreport | 11 ----- initscripts.spec | 5 -- man/netreport.1 | 22 --------- network-scripts/ifdown-post | 3 -- network-scripts/ifup-aliases | 11 ----- network-scripts/ifup-post | 3 -- network-scripts/network-functions | 18 ------- src/Makefile | 10 +--- src/netreport.c | 72 ---------------------------- usr/lib/tmpfiles.d/initscripts.conf | 2 - 12 files changed, 2 insertions(+), 159 deletions(-) delete mode 100755 etc/NetworkManager/dispatcher.d/00-netreport delete mode 100644 man/netreport.1 delete mode 100644 src/netreport.c delete mode 100644 usr/lib/tmpfiles.d/initscripts.conf diff --git a/Makefile b/Makefile index 813ca45e..574204e6 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,6 @@ install-post: install-etc install -m 0755 -d $(DESTDIR)$(sharedstatedir)/stateless/state install -m 0755 -d $(DESTDIR)$(sharedstatedir)/stateless/writable install -m 0755 -d $(DESTDIR)$(libexecdir)/initscripts/legacy-actions - install -m 0775 -d $(DESTDIR)/run/netreport for idx in {0..6}; do \ dir=$(DESTDIR)$(sysconfdir)/rc.d/rc$$idx.d; \ install -m 0755 -d $$dir; \ diff --git a/doc/sysconfig.txt b/doc/sysconfig.txt index c0d14897..891a10eb 100644 --- a/doc/sysconfig.txt +++ b/doc/sysconfig.txt @@ -401,8 +401,7 @@ Files in /etc/sysconfig/network-scripts/ Not really a public file. Contains functions which the scripts use for bringing interfaces up and down. In particular, it contains - most of the code for handling alternative interface configurations - and interface change notification through netreport. + most of the code for handling alternative interface configurations. /etc/sysconfig/network-scripts/network-functions-ipv6: diff --git a/etc/NetworkManager/dispatcher.d/00-netreport b/etc/NetworkManager/dispatcher.d/00-netreport deleted file mode 100755 index eee7fb38..00000000 --- a/etc/NetworkManager/dispatcher.d/00-netreport +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -cd /etc/sysconfig/network-scripts -. ./network-functions - -[ -f ../network ] && . ../network - -# Notify programs that have requested notification -do_netreport - -exit 0 diff --git a/initscripts.spec b/initscripts.spec index 9dcaf690..53a9cad1 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -166,8 +166,6 @@ fi # NOTE: /etc/profile.d/ is owned by setup package. # /etc/sysconfig/ is owned by filesystem package. -%dir %{_sysconfdir}/NetworkManager -%dir %{_sysconfdir}/NetworkManager/dispatcher.d %dir %{_sysconfdir}/rc.d %dir %{_sysconfdir}/rc.d/init.d %dir %{_sysconfdir}/rc.d/rc[0-6].d @@ -181,7 +179,6 @@ fi %dir %{_sharedstatedir}/stateless %dir %{_sharedstatedir}/stateless/state %dir %{_sharedstatedir}/stateless/writable -%dir /run/netreport # --------------- @@ -193,7 +190,6 @@ fi %ghost %config(noreplace, missingok) %verify(not md5 size mtime) %{_sysconfdir}/rc.d/rc.local -%{_sysconfdir}/NetworkManager/dispatcher.d/00-netreport %{_sysconfdir}/rc.d/init.d/functions %{_sysconfdir}/rc.d/init.d/netconsole %{_sysconfdir}/rc.d/init.d/network @@ -212,7 +208,6 @@ fi %ghost %{_sbindir}/ifup %ghost %{_sbindir}/ifdown -%attr(2755,root,root) %{_sbindir}/netreport %attr(4755,root,root) %{_sbindir}/usernetctl %{_prefix}/lib/systemd/fedora-* diff --git a/man/netreport.1 b/man/netreport.1 deleted file mode 100644 index 75ed0747..00000000 --- a/man/netreport.1 +++ /dev/null @@ -1,22 +0,0 @@ -.TH NETREPORT 1 "Red Hat, Inc." "RH" \" -*- nroff -*- -.SH NAME -netreport \- request notification of network interface changes -.SH SYNOPSIS -.B netreport -\fI[\fP-r\fI]\fP -.SH DESCRIPTION -.B netreport -tells the network management scripts to send a SIGIO signal -to the process which called netreport when any network interface -status changes occur. -.SH OPTIONS -.TP -.B -r -Remove the current request (if any) for the calling process. -.PP -.SH NOTES -If a program does not call netreport with the -.B -r -option before it exits, and another process is created with the -same PID before any changes take place in interface status, it -is possible that the new process will receive a spurious SIGIO. diff --git a/network-scripts/ifdown-post b/network-scripts/ifdown-post index 9db16ad3..ab6b1b55 100755 --- a/network-scripts/ifdown-post +++ b/network-scripts/ifdown-post @@ -62,9 +62,6 @@ if [ "${REALDEVICE}" != "lo" ]; then > /dev/null 2>&1 fi -# Notify programs that have requested notification -do_netreport - if [ -x /sbin/ifdown-local ]; then /sbin/ifdown-local ${DEVICE} fi diff --git a/network-scripts/ifup-aliases b/network-scripts/ifup-aliases index 52d43ea8..8a943c1b 100755 --- a/network-scripts/ifup-aliases +++ b/network-scripts/ifup-aliases @@ -230,7 +230,6 @@ function new_interface () else if [ "$rdev_mark" != "remove" ]; then /sbin/ip addr flush dev $parent_device label $parent_device:${DEVNUM} - do_netreport=yes fi newmark=remove setup_this=yes @@ -253,7 +252,6 @@ function new_interface () if [ "$mark_remove" != "remove" ]; then eval " rdev_${rdevip}_mark=remove "; /sbin/ip addr flush dev $parent_device label $parent_device:$rdevip - do_netreport=yes fi fi @@ -303,7 +301,6 @@ function new_interface () /etc/sysconfig/network-scripts/ifup-routes ${DEVICE} ${NAME} - do_netreport=yes ifuplocal_queue="$ifuplocal_queue $DEVICE" fi fi @@ -363,16 +360,8 @@ for DEVNUM in $rdev_LIST ; do eval " rdev_mark=\$rdev_${DEVNUM}_mark " if [ -z "$rdev_mark" ]; then /sbin/ip addr flush dev $parent_device label $parent_device:${DEVNUM} - do_netreport=yes fi done -# -# Notify of new device creation -# - -if [ -n "$do_netreport" ]; then - do_netreport -fi if [ -x /sbin/ifup-local ]; then for DEVICE in $ifuplocal_queue ; do diff --git a/network-scripts/ifup-post b/network-scripts/ifup-post index f8a91add..e1c5e391 100755 --- a/network-scripts/ifup-post +++ b/network-scripts/ifup-post @@ -141,9 +141,6 @@ if [ "${REALDEVICE}" != "lo" ]; then > /dev/null 2>&1 fi -# Notify programs that have requested notification -do_netreport - if [ -x /sbin/ifup-local ]; then /sbin/ifup-local ${DEVICE} fi diff --git a/network-scripts/network-functions b/network-scripts/network-functions index c2756b19..a2382e33 100644 --- a/network-scripts/network-functions +++ b/network-scripts/network-functions @@ -278,24 +278,6 @@ toggle_value () echo '' fi } - -do_netreport () -{ - # Notify programs that have requested notification - ( - cd /run/netreport || exit - for i in * ; do - if [ -f $i ]; then - if [ "$(id -u)" = "0" ]; then - OWNER=$(stat -c %U $i) - su -s /bin/bash $OWNER -c "kill -SIGIO $i >/dev/null 2>&1 || rm -f $i >/dev/null 2>&1" > /dev/null 2>&1 - else - kill -SIGIO $i >/dev/null 2>&1 || rm -f $i >/dev/null 2>&1 - fi - fi - done - ) -} is_nm_running () { diff --git a/src/Makefile b/src/Makefile index 193d5af2..8825e45b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -21,7 +21,7 @@ CC = gcc CFLAGS += $(RPM_OPT_FLAGS) -Wall -D_GNU_SOURCE -fPIE LDFLAGS += $(RPM_LD_FLAGS) -pie -z relro -z now -PROGS = consoletype genhostid netreport rename_device usernetctl usleep +PROGS = consoletype genhostid rename_device usernetctl usleep all: $(PROGS) @@ -32,7 +32,6 @@ install: all install -m 0755 build/usleep $(DESTDIR)$(bindir) install -m 0755 build/consoletype $(DESTDIR)$(sbindir) install -m 0755 build/genhostid $(DESTDIR)$(sbindir) - install -m 0755 build/netreport $(DESTDIR)$(sbindir) install -m 0755 build/usernetctl $(DESTDIR)$(sbindir) install -m 0755 build/rename_device $(DESTDIR)$(libdir)/udev @@ -53,13 +52,6 @@ build/genhostid.o: genhostid.c $(CC) $(CFLAGS) -c -o $@ $^ -netreport: build/netreport.o - $(CC) $(LDFLAGS) -o build/$@ $^ - -build/netreport.o: netreport.c - $(CC) $(CFLAGS) -c -o $@ $^ - - rename_device: build/rename_device.o $(CC) $(LDFLAGS) -o build/$@ $^ `pkg-config glib-2.0 --libs` diff --git a/src/netreport.c b/src/netreport.c deleted file mode 100644 index 204a77d7..00000000 --- a/src/netreport.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 1997-2002 Red Hat, Inc. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ -#include -#include -#include -#include -#include -#include - -/* this will be running setgid root, so be careful! */ - -static void -usage(void) { - fprintf(stderr, "usage: netreport [-r]\n"); - exit(1); -} - -#define ADD 1 -#define DEL 0 -int main(int argc, char ** argv) { - int action = ADD; - /* more than long enough for "/run/netreport/\0" */ - char netreport_name[64]; - int netreport_file; - - if (argc > 2) { - usage(); - } - - if (argc > 1) { - if (argc == 2 && strcmp(argv[1], "-r") == 0) { - action = DEL; - } else { - usage(); - } - } - - snprintf(netreport_name, sizeof(netreport_name), - "/run/netreport/%d", getppid()); - if (action == ADD) { - netreport_file = open(netreport_name, - O_EXCL|O_CREAT|O_WRONLY|O_TRUNC|O_NOFOLLOW, 0); - if (netreport_file == -1) { - if (errno != EEXIST) { - perror("Could not create netreport file"); - exit (1); - } - } else { - close(netreport_file); - } - } else { - /* ignore errors; not much we can do, won't hurt anything */ - unlink(netreport_name); - } - - return 0; -} diff --git a/usr/lib/tmpfiles.d/initscripts.conf b/usr/lib/tmpfiles.d/initscripts.conf deleted file mode 100644 index 8d2a2968..00000000 --- a/usr/lib/tmpfiles.d/initscripts.conf +++ /dev/null @@ -1,2 +0,0 @@ - -d /run/netreport 0775 root root - -- cgit v1.2.1