aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2014-04-15 15:19:10 +0200
committerLukas Nykryn <lnykryn@redhat.com>2014-04-24 13:39:17 +0200
commit50742d10d095d9d86750e6ae7f97076985145ff0 (patch)
treecee2fd4336d7b6ff67145afda6f06805d1ca94c2
parent32e8cbc1c91ada764ef4b5bb817b0c045d3fb3a4 (diff)
downloadinitscripts-50742d10d095d9d86750e6ae7f97076985145ff0.tar
initscripts-50742d10d095d9d86750e6ae7f97076985145ff0.tar.gz
initscripts-50742d10d095d9d86750e6ae7f97076985145ff0.tar.bz2
initscripts-50742d10d095d9d86750e6ae7f97076985145ff0.tar.xz
initscripts-50742d10d095d9d86750e6ae7f97076985145ff0.zip
move ppp support to ppp package
-rw-r--r--Makefile5
-rw-r--r--initscripts.spec15
-rw-r--r--ppp/ip-down18
-rw-r--r--ppp/ip-down.ipv6to4114
-rw-r--r--ppp/ip-up17
-rw-r--r--ppp/ip-up.ipv6to4193
-rw-r--r--ppp/ipv6-down70
-rw-r--r--ppp/ipv6-up112
-rw-r--r--src/Makefile11
-rw-r--r--src/ppp-watch.823
-rw-r--r--src/ppp-watch.c864
-rwxr-xr-xsysconfig/network-scripts/ifdown-ppp51
-rwxr-xr-xsysconfig/network-scripts/ifup-ppp157
13 files changed, 4 insertions, 1646 deletions
diff --git a/Makefile b/Makefile
index ccf79931..e8f473a4 100644
--- a/Makefile
+++ b/Makefile
@@ -42,16 +42,13 @@ install:
cp -af rc.d/init.d $(ROOT)/etc/rc.d/
install -m644 sysconfig/debug sysconfig/init sysconfig/netconsole sysconfig/readonly-root $(ROOT)/etc/sysconfig/
cp -af sysconfig/network-scripts $(ROOT)/etc/sysconfig/
- cp -af ppp NetworkManager $(ROOT)/etc
+ cp -af NetworkManager $(ROOT)/etc
mkdir -p $(ROOT)/usr/lib/systemd/
cp -af systemd/* $(ROOT)/usr/lib/systemd/
- mkdir -p $(ROOT)/etc/ppp/peers
mkdir -p $(ROOT)/usr/lib
cp -af udev $(ROOT)/usr/lib
chmod 755 $(ROOT)/etc/rc.d/* $(ROOT)/etc/rc.d/init.d/*
chmod 644 $(ROOT)/etc/rc.d/init.d/functions
- chmod 755 $(ROOT)/etc/ppp/peers
- chmod 755 $(ROOT)/etc/ppp/ip*
chmod 755 $(ROOT)/etc/sysconfig/network-scripts/ifup-*
chmod 755 $(ROOT)/etc/sysconfig/network-scripts/ifdown-*
chmod 755 $(ROOT)/etc/sysconfig/network-scripts/init*
diff --git a/initscripts.spec b/initscripts.spec
index 68b40284..0c5d0f03 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -1,8 +1,7 @@
Summary: The inittab file and the /etc/init.d scripts
Name: initscripts
Version: 9.53
-# ppp-watch is GPLv2+, everything else is GPLv2
-License: GPLv2 and GPLv2+
+License: GPLv2
Group: System Environment/Base
Release: 1%{?dist}
URL: http://fedorahosted.org/releases/i/n/initscripts/
@@ -29,6 +28,7 @@ Requires: cpio
Requires: hostname
Conflicts: ipsec-tools < 0.8.0-2
Conflicts: NetworkManager < 0.9.9.0-37.git20140131.el7
+Conflicts: ppp < 2.4.6-3
Requires(pre): /usr/sbin/groupadd
Requires(post): /sbin/chkconfig, coreutils
Requires(preun): /sbin/chkconfig
@@ -132,8 +132,6 @@ rm -rf $RPM_BUILD_ROOT
/etc/sysconfig/network-scripts/init.ipv6-global
%config(noreplace) /etc/sysconfig/network-scripts/ifcfg-lo
/etc/sysconfig/network-scripts/ifup-post
-/etc/sysconfig/network-scripts/ifdown-ppp
-/etc/sysconfig/network-scripts/ifup-ppp
/etc/sysconfig/network-scripts/ifup-routes
/etc/sysconfig/network-scripts/ifdown-routes
/etc/sysconfig/network-scripts/ifup-plip
@@ -187,17 +185,8 @@ rm -rf $RPM_BUILD_ROOT
/usr/lib/udev/rules.d/*
/usr/lib/udev/rename_device
/usr/sbin/service
-/usr/sbin/ppp-watch
%{_mandir}/man*/*
%dir %attr(775,root,root) /var/run/netreport
-%dir /etc/ppp
-%dir /etc/ppp/peers
-/etc/ppp/ip-up
-/etc/ppp/ip-down
-/etc/ppp/ip-up.ipv6to4
-/etc/ppp/ip-down.ipv6to4
-/etc/ppp/ipv6-up
-/etc/ppp/ipv6-down
%dir /etc/NetworkManager
%dir /etc/NetworkManager/dispatcher.d
/etc/NetworkManager/dispatcher.d/00-netreport
diff --git a/ppp/ip-down b/ppp/ip-down
deleted file mode 100644
index bfb08711..00000000
--- a/ppp/ip-down
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-# This file should not be modified -- make local changes to
-# /etc/ppp/ip-down.local instead
-
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-export PATH
-
-LOGDEVICE=$6
-REALDEVICE=$1
-
-/etc/ppp/ip-down.ipv6to4 ${LOGDEVICE}
-
-[ -x /etc/ppp/ip-down.local ] && /etc/ppp/ip-down.local "$@"
-
-/etc/sysconfig/network-scripts/ifdown-post --realdevice ${REALDEVICE} \
- ifcfg-${LOGDEVICE}
-
-exit 0
diff --git a/ppp/ip-down.ipv6to4 b/ppp/ip-down.ipv6to4
deleted file mode 100644
index 29f1c646..00000000
--- a/ppp/ip-down.ipv6to4
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/bin/sh
-#
-# ip-down.ipv6to4
-#
-#
-# Taken from:
-# (P) & (C) 2000-2005 by Peter Bieringer <pb@bieringer.de>
-#
-# You will find more information on the initscripts-ipv6 homepage at
-# http://www.deepspace6.net/projects/initscripts-ipv6.html
-#
-# Version 2005-09-22
-#
-# Calling parameters:
-# $1: interface name
-#
-# Called (mostly) by /etc/ppp/ip-down.local
-# like: /etc/ppp/ip-down.ipv6to4 $1 >>/var/log/ppp-ipv6to4.log 2>&1
-#
-# Note: this script will *check* whether the existing 6to4 tunnel
-# was set before by using "ip-up.ipv6to4" comparing IPv4 address
-# of device with the generated 6to4 prefix
-#
-# Uses following information from /etc/sysconfig/network-scripts/ifcfg-$1:
-# IPV6TO4INIT=yes|no: controls configuration
-# IPV6TO4_ROUTING="<device>-<suffix>/<prefix length> ...": information to setup additional interfaces
-#
-# IPV6_CONTROL_RADVD=yes|no: controls radvd triggering
-# IPV6_RADVD_PIDFILE=<file>: PID file of radvd for sending signals, default is "/var/run/radvd/radvd.pid"
-# IPV6_RADVD_TRIGGER_ACTION=startstop|reload|restart|SIGHUP: how to trigger radvd (optional, default is SIGHUP)
-#
-
-
-if [ -z "$1" ]; then
- echo $"Argument 1 is empty but should contain interface name - skip IPv6to4 initialization"
- exit 1
-fi
-
-# Get global network configuration
-. /etc/sysconfig/network
-
-# Source IPv4 helper functions
-cd /etc/sysconfig/network-scripts
-. ./network-functions
-
-CONFIG=$1
-[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
-source_config
-
-# IPv6 don't need aliases anymore, config is skipped
-REALDEVICE=${DEVICE%%:*}
-[ "$DEVICE" != "$REALDEVICE" ] && exit 0
-
-if [ ! -f /etc/sysconfig/network-scripts/network-functions-ipv6 ]; then
- exit 1
-fi
-
-. /etc/sysconfig/network-scripts/network-functions-ipv6
-
-
-# Run basic IPv6 test, if not ok, skip IPv6 initialization
-ipv6_test testonly || exit 0
-
-# Test status of ppp device
-ipv6_test_device_status $DEVICE
-if [ $? != 0 -a $? != 11 ]; then
- # device doesn't exist or other problem occurs
- exit 1
-fi
-
-# Test status of tun6to4 device
-ipv6_test_device_status tun6to4
-if [ $? = 0 -o $? = 11 ]; then
- # Device exists
- valid6to4config="yes"
-
- # Get IPv4 address from interface
- ipv4addr="$(ipv6_get_ipv4addr_of_device $DEVICE)"
- if [ -z "$ipv4addr" ]; then
- # Has no IPv4 address
- valid6to4config="no"
- fi
-
- # Get local IPv4 address of dedicated tunnel
- ipv4addr6to4local="$(ipv6_get_ipv4addr_of_tunnel tun6to4 local)"
-
- # IPv6to4 not enabled on this interface?
- if [ $IPV6TO4INIT != "yes" ]; then
- # Check against configured 6to4 tunnel to see if this interface was regardless used before
- if [ "$ipv4addr" != "$ipv4addr6to4local" ]; then
- # IPv4 address of interface does't match local tunnel address, interface was not used for current 6to4 setup
- valid6to4config="no"
- fi
- fi
-
-fi
-
-if [ "$valid6to4config" = "yes" ]; then
- if [ "$IPV6_CONTROL_RADVD" = "yes" ]; then
- # Control running radvd
- ipv6_trigger_radvd down "$IPV6_RADVD_TRIGGER_ACTION" $IPV6_RADVD_PIDFILE
- fi
-
- if [ -n "$IPV6TO4_ROUTING" ]; then
- # Delete routes to local networks
- for devsuf in $IPV6TO4_ROUTING; do
- dev="${devsuf%%-*}"
- ipv6_cleanup_6to4_device $dev
- done
- fi
-
- # Delete all configured 6to4 address
- ipv6_cleanup_6to4_tunnels tun6to4
-fi
diff --git a/ppp/ip-up b/ppp/ip-up
deleted file mode 100644
index e610674d..00000000
--- a/ppp/ip-up
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-# This file should not be modified -- make local changes to
-# /etc/ppp/ip-up.local instead
-
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-export PATH
-
-LOGDEVICE=$6
-REALDEVICE=$1
-
-[ -f /etc/sysconfig/network-scripts/ifcfg-${LOGDEVICE} ] && /etc/sysconfig/network-scripts/ifup-post --realdevice ${REALDEVICE} ifcfg-${LOGDEVICE}
-
-/etc/ppp/ip-up.ipv6to4 ${LOGDEVICE}
-
-[ -x /etc/ppp/ip-up.local ] && /etc/ppp/ip-up.local "$@"
-
-exit 0
diff --git a/ppp/ip-up.ipv6to4 b/ppp/ip-up.ipv6to4
deleted file mode 100644
index 6a85bbb3..00000000
--- a/ppp/ip-up.ipv6to4
+++ /dev/null
@@ -1,193 +0,0 @@
-#!/bin/sh
-#
-# ip-up.ipv6to4
-#
-#
-# Taken from:
-# (P) & (C) 2000-2005 by Peter Bieringer <pb@bieringer.de>
-#
-# You will find more information on the initscripts-ipv6 homepage at
-# http://www.deepspace6.net/projects/initscripts-ipv6.html
-#
-# Version: 2005-09-22
-#
-# Calling parameters:
-# $1: interface name
-#
-# Called (mostly) by /etc/ppp/ip-up.local
-# like: /etc/ppp/ip-up.ipv6to4 $1 >>/var/log/ppp-ipv6to4.log 2>&1
-#
-# Note: this script will *kill* older still existing 6to4 tunnels regardless
-# whether they were set before by another device
-#
-# Uses following information from /etc/sysconfig/network-scripts/ifcfg-$1:
-# IPV6TO4INIT=yes|no: controls configuration
-# IPV6TO4_IPV4ADDR=<IPv4 address>: special local address for 6to4 tunneling (only needed behind a NAT gateway)
-# IPV6TO4_RELAY=<IPv4 address>: remote 6to4 relay router address (default: 192.88.99.1)
-# IPV6TO4_MTU=<MTU for IPv6>: controls IPv6 MTU for the 6to4 link (optional, default is MTU of interface - 20)
-# IPV6TO4_ROUTING="<device>-<suffix>/<prefix length> ...": information to setup additional interfaces
-# Example: IPV6TO4_ROUTING="eth0-:f101::1/64 eth1-:f102::1/64"
-#
-# IPV6_CONTROL_RADVD=yes|no: controls radvd triggering
-# IPV6_RADVD_PIDFILE=<file>: PID file of radvd for sending signals, default is "/var/run/radvd/radvd.pid"
-# IPV6_RADVD_TRIGGER_ACTION=startstop|reload|restart|SIGHUP: how to trigger radvd (optional, default is SIGHUP)
-#
-# Requirements
-# radvd-0.6.2p3 or newer supporting option "Base6to4Interface"
-#
-
-
-if [ -z "$1" ]; then
- echo $"Argument 1 is empty but should contain interface name - skip IPv6to4 initialization"
- exit 1
-fi
-
-# Get global network configuration
-. /etc/sysconfig/network
-
-# Source IPv4 helper functions
-cd /etc/sysconfig/network-scripts
-. ./network-functions
-
-CONFIG=$1
-[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
-source_config
-
-# IPv6 don't need aliases anymore, config is skipped
-REALDEVICE=${DEVICE%%:*}
-[ "$DEVICE" != "$REALDEVICE" ] && exit 0
-
-if [ ! -f /etc/sysconfig/network-scripts/network-functions-ipv6 ]; then
- exit 1
-fi
-
-. /etc/sysconfig/network-scripts/network-functions-ipv6
-
-
-# Run basic IPv6 test (and make sure the ipv6 module will be loaded), if not ok, skip IPv6 initialization
-ipv6_test || exit 1
-
-# Setup of 6to4, if configured
-valid6to4config="yes"
-if [ "$IPV6TO4INIT" = "yes" ]; then
- if [ -n "$IPV6TO4_IPV4ADDR" ]; then
- # Take 6to4-dedicated configured IPv4 address from config file (precedence 1)
- ipv4addr="$IPV6TO4_IPV4ADDR"
- else
- # Get IPv4 address from interface (precedence 2)
- ipv4addr="$(ipv6_get_ipv4addr_of_device $DEVICE)"
- if [ -z "$ipv4addr" ]; then
- # Take configured IPv4 address of interface from config file (precedence 3)
- ipv4addr="$IPADDR"
- fi
- fi
- if [ -n "$ipv4addr" ]; then
- # Test for non-global IPv4 address
- if ! ipv6_test_ipv4_addr_global_usable $ipv4addr; then
- net_log $"Given IPv4 address '$ipv4addr' is not globally usable" info
- valid6to4config="no"
- fi
- else
- net_log $"IPv6to4 configuration needs an IPv4 address on related interface or otherwise specified" info
- valid6to4config="no"
- fi
- if [ -z "$IPV6TO4_RELAY" ]; then
- IPV6TO4_RELAY="192.88.99.1"
- fi
-
- # Check/generate relay address
- ipv6to4_relay="$(ipv6_create_6to4_relay_address $IPV6TO4_RELAY)"
- if [ $? -ne 0 ]; then
- valid6to4config="no"
- fi
-
- if [ "$valid6to4config" = "yes" ]; then
- # Delete routes to local networks
- for devsuf in $IPV6TO4_ROUTING; do
- dev="${devsuf%%-*}"
- ipv6_cleanup_6to4_device $dev
- done
-
- # Cleanup all old data (needed, if "ip-down.ipv6to4" wasn't executed), delete all configured 6to4 address
- ipv6_cleanup_6to4_tunnels tun6to4
-
- # Get MTU of master device
- ipv4mtu="$(/sbin/ip link show dev $DEVICE | awk '/\<mtu\>/ { print $5 }')"
- if [ -n "$ipv4mtu" ]; then
- # IPv6 tunnel MTU is IPv4 MTU minus 20 for IPv4 header
- tunnelmtu=$[ $ipv4mtu - 20 ]
- fi
-
- if [ -n "$IPV6TO4_MTU" ]; then
- if [ $IPV6TO4_MTU -gt $tunnelmtu ]; then
- net_log $"Warning: configured MTU '$IPV6TO4_MTU' for 6to4 exceeds maximum limit of '$tunnelmtu', ignored" warning
- else
- tunnelmtu=$IPV6TO4_MTU
- fi
- fi
-
- # Setup new data
- ipv6_add_6to4_tunnel tun6to4 $ipv4addr "" $tunnelmtu || exit 1
-
- # Add route to for compatible addresses (removed later again)
- ipv6_add_route "::/96" "::" tun6to4
-
- # Add default route, if device matches
- if [ "$IPV6_DEFAULTDEV" = "tun6to4" ]; then
- if [ -n "$IPV6_DEFAULTGW" ]; then
- net_log $"Warning: interface 'tun6to4' does not support 'IPV6_DEFAULTGW', ignored" warning
- fi
- ipv6_set_default_route $ipv6to4_relay tun6to4
- fi
-
- # Add static routes
- if [ -f /etc/sysconfig/static-routes-ipv6 ]; then
- LC_ALL=C grep -w "^tun6to4" /etc/sysconfig/static-routes-ipv6 | while read device network gateway; do
- if [ -z "$network" ]; then
- continue
- fi
- if [ -z "$gateway" ]; then
- gateway="$ipv6to4_relay"
- fi
- ipv6_add_route $network $gateway tun6to4
- done
- fi
-
- # Setup additional static IPv6 routes (newer config style)
- if [ -f "/etc/sysconfig/network-scripts/route6-tun6to4" ]; then
- sed -ne 's/#.*//' -e '/[^[:space:]]/p' /etc/sysconfig/network-scripts/route6-tun6to4 | while read line; do
- if echo "$line" | grep -vq 'via'; then
- # Add gateway if missing
- line="$line via $ipv6to4_relay"
- fi
- /sbin/ip -6 route add $line
- done
- fi
-
- # Cleanup autmatically generated autotunnel (not needed for 6to4)
- /sbin/ip -6 route del ::/96 dev tun6to4
- /sbin/ip -6 addr del tun6to4 "::$ipv4addr/128" dev tun6to4
-
- if [ "$IPV6_CONTROL_RADVD" = "yes" ]; then
- # Control running radvd
- ipv6_trigger_radvd up "$IPV6_RADVD_TRIGGER_ACTION" $IPV6_RADVD_PIDFILE
-
- if [ -n "$IPV6TO4_ROUTING" ]; then
- # Generate 6to4 address
- ipv6to4prefix="$(ipv6_create_6to4_prefix $ipv4addr)"
- if [ -n "$ipv6to4prefix" ]; then
- # Add IPv6 address to interface (required interface route will be set automatically)
- for devsuf in $IPV6TO4_ROUTING; do
- dev="${devsuf%%-*}"
- suf="$(echo $devsuf | awk -F- '{ print $2 }')"
- ipv6_add_addr_on_device ${dev} ${ipv6to4prefix}${suf}
- done
- else
- net_log $"Error occurred while calculating the IPv6to4 prefix"
- fi
- else
- net_log $"radvd control enabled, but config is not complete"
- fi
- fi
- fi
-fi
diff --git a/ppp/ipv6-down b/ppp/ipv6-down
deleted file mode 100644
index b290585a..00000000
--- a/ppp/ipv6-down
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/sh
-#
-# ipv6-down
-#
-# Called by pppd after IPV6CP/down was finished
-#
-# This file should not be modified -- make local changes to
-# /etc/ppp/ipv6-down.local instead
-#
-#
-# Taken from:
-# (P) & (C) 2001-2006 by Peter Bieringer <pb@bieringer.de>
-#
-# You will find more information on the initscripts-ipv6 homepage at
-# http://www.deepspace6.net/projects/initscripts-ipv6.html
-#
-# RHL integration assistance by Pekka Savola <pekkas@netcore.fi>
-#
-# Calling parameters:
-# $1: interface name
-# $6: logical interface name (set by pppd option ipparam)
-#
-# Version 2006-08-02
-#
-# Uses following information from /etc/sysconfig/network-scripts/ifcfg-$1:
-# IPV6INIT=yes|no: controls IPv6 configuration for this interface
-#
-
-
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-export PATH
-
-LOGDEVICE=$6
-REALDEVICE=$1
-
-[ -f /etc/sysconfig/network ] || exit 0
-. /etc/sysconfig/network
-
-cd /etc/sysconfig/network-scripts
-. ./network-functions
-
-CONFIG=$LOGDEVICE
-[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
-source_config
-
-[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
-. /etc/sysconfig/network-scripts/network-functions-ipv6
-
-[ -x /etc/ppp/ipv6-down.local ] && /etc/ppp/ipv6-down.local "$@"
-
-
-if [ "$IPV6_CONTROL_RADVD" = "yes" ]; then
- # Control running radvd
- ipv6_trigger_radvd down "$IPV6_RADVD_TRIGGER_ACTION" $IPV6_RADVD_PIDFILE
-fi
-
-# IPv6 test, no module loaded, exit if system is not IPv6-ready
-ipv6_test testonly || exit 0
-
-# Test device status
-ipv6_test_device_status $REALDEVICE
-if [ $? != 0 -a $? != 11 ]; then
- # device doesn't exist or other problem occurs
- exit 1
-fi
-
-# Delete all current configured IPv6 addresses on this interface
-ipv6_cleanup_device $REALDEVICE
-
-exit 0
diff --git a/ppp/ipv6-up b/ppp/ipv6-up
deleted file mode 100644
index 059afec6..00000000
--- a/ppp/ipv6-up
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/bin/bash
-#
-# ipv6-up
-#
-# Called by pppd after IPV6CP/up was finished
-#
-# This file should not be modified -- make local changes to
-# /etc/ppp/ipv6-up.local instead
-#
-# Taken from:
-# (P) & (C) 2001-2006 by Peter Bieringer <pb@bieringer.de>
-#
-# You will find more information on the initscripts-ipv6 homepage at
-# http://www.deepspace6.net/projects/initscripts-ipv6.html
-#
-# RHL integration assistance by Pekka Savola <pekkas@netcore.fi>
-#
-# Calling parameters:
-# $1: interface name
-# $6: logical interface name (set by pppd option ipparam)
-#
-#
-# Version: 2006-08-02
-#
-# Uses following information from "/etc/sysconfig/network":
-# IPV6_DEFAULTDEV=<device>: controls default route (optional)
-#
-# Uses following information from "/etc/sysconfig/network-scripts/ifcfg-$1":
-# IPV6INIT=yes|no: controls IPv6 configuration for this interface
-# IPV6ADDR=<IPv6 address>[/<prefix length>]: specify primary static IPv6 address
-# IPV6ADDR_SECONDARIES="<IPv6 address>[/<prefix length>] ..." (optional)
-# IPV6_MTU=<MTU for IPv6>: controls IPv6 MTU for this link (optional)
-#
-
-
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-export PATH
-
-LOGDEVICE=$6
-REALDEVICE=$1
-
-[ -f /etc/sysconfig/network ] || exit 0
-. /etc/sysconfig/network
-
-cd /etc/sysconfig/network-scripts
-. ./network-functions
-. ./network-functions-ipv6
-
-CONFIG=$LOGDEVICE
-[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
-source_config
-
-# Test whether IPv6 configuration is disabled for this interface
-[[ "$IPV6INIT" = [nN0]* ]] && exit 0
-
-[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
-. /etc/sysconfig/network-scripts/network-functions-ipv6
-
-# IPv6 test, module loaded, exit if system is not IPv6-ready
-ipv6_test || exit 1
-
-# Test device status
-ipv6_test_device_status $REALDEVICE
-if [ $? != 0 -a $? != 11 ]; then
- # device doesn't exist or other problem occurs
- exit 1
-fi
-
-# Setup IPv6 address on specified interface
-if [ -n "$IPV6ADDR" ]; then
- ipv6_add_addr_on_device $REALDEVICE $IPV6ADDR || exit 1
-fi
-
-# Set IPv6 MTU, if given
-if [ -n "$IPV6_MTU" ]; then
- ipv6_set_mtu $REALDEVICE $IPV6_MTU
-fi
-
-# Setup additional IPv6 addresses from list, if given
-if [ -n "$IPV6ADDR_SECONDARIES" ]; then
- for ipv6addr in $IPV6ADDR_SECONDARIES; do
- ipv6_add_addr_on_device $REALDEVICE $ipv6addr
- done
-fi
-
-# Setup default IPv6 route through device
-if [ "$IPV6_DEFAULTDEV" = "$LOGDEVICE" ]; then
- ipv6_set_default_route "" "$REALDEVICE" "$REALDEVICE"
-fi
-
-# Setup additional static IPv6 routes on specified interface, if given
-if [ -f /etc/sysconfig/static-routes-ipv6 ]; then
- LC_ALL=C grep -w "^$LOGDEVICE" /etc/sysconfig/static-routes-ipv6 | while read device args; do
- ipv6_add_route $args $REALDEVICE
- done
-fi
-
-# Setup additional static IPv6 routes (newer config style)
-if [ -f "/etc/sysconfig/network-scripts/route6-$DEVICE" ]; then
- sed -ne 's/#.*//' -e '/[^[:space:]]/p' "/etc/sysconfig/network-scripts/route6-$DEVICE" | while read line; do
- /sbin/ip -6 route add $line
- done
-fi
-
-if [ "$IPV6_CONTROL_RADVD" = "yes" ]; then
- # Control running radvd
- ipv6_trigger_radvd up "$IPV6_RADVD_TRIGGER_ACTION" $IPV6_RADVD_PIDFILE
-fi
-
-[ -x /etc/ppp/ipv6-up.local ] && /etc/ppp/ipv6-up.local "$@"
-
-exit 0
diff --git a/src/Makefile b/src/Makefile
index dc4bf593..7875abc5 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,8 +2,7 @@ CFLAGS+=$(RPM_OPT_FLAGS) -Wall -D_GNU_SOURCE
LDFLAGS+=$(RPM_LD_FLAGS)
PROGS=usernetctl netreport usleep ipcalc \
- ppp-watch consoletype genhostid rename_device
-PPPWATCH_OBJS=ppp-watch.o shvar.o
+ consoletype genhostid rename_device
CONSOLE_INIT_OBJS=console_init.o shvar.o
USLEEP_OBJS=usleep.o
@@ -24,7 +23,6 @@ install:
install -m 2755 netreport $(ROOT)/usr/sbin/netreport
install -m 755 ipcalc $(ROOT)/usr/bin/ipcalc
install -m 755 genhostid $(ROOT)/usr/sbin/genhostid
- install -m 755 ppp-watch $(ROOT)/usr/sbin/ppp-watch
install -m 755 consoletype $(ROOT)/usr/sbin/consoletype
install -m 755 sushell $(ROOT)/usr/sbin/sushell
install -m 755 rename_device $(ROOT)/usr/lib/udev/rename_device
@@ -32,7 +30,6 @@ install:
install -m 644 netreport.1 $(ROOT)$(mandir)/man1
install -m 644 usleep.1 $(ROOT)$(mandir)/man1
install -m 644 usernetctl.8 $(ROOT)$(mandir)/man8
- install -m 644 ppp-watch.8 $(ROOT)$(mandir)/man8
install -m 644 ipcalc.1 $(ROOT)$(mandir)/man1
install -m 644 consoletype.1 $(ROOT)$(mandir)/man1
install -m 644 ifup.8 $(ROOT)$(mandir)/man8
@@ -45,9 +42,6 @@ ipcalc: ipcalc.o
usleep: $(USLEEP_OBJS)
$(CC) $(LDFLAGS) -o $@ $(USLEEP_OBJS) -lpopt
-ppp-watch: $(PPPWATCH_OBJS)
- $(CC) $(LDFLAGS) -o $@ $(PPPWATCH_OBJS) `pkg-config glib-2.0 --libs`
-
usernetctl.o: usernetctl.c
$(CC) $(CFLAGS) -fPIE -c usernetctl.c -o usernetctl.o
@@ -63,9 +57,6 @@ netreport: netreport.o
shvar.o: shvar.c
$(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -c shvar.c -o shvar.o
-ppp-watch.o: ppp-watch.c
- $(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -c ppp-watch.c -o ppp-watch.o
-
rename_device: rename_device.c
$(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -o $@ $< `pkg-config glib-2.0 --libs`
diff --git a/src/ppp-watch.8 b/src/ppp-watch.8
deleted file mode 100644
index d2b8cc4b..00000000
--- a/src/ppp-watch.8
+++ /dev/null
@@ -1,23 +0,0 @@
-.TH PPP-WATCH 8 "Red Hat, Inc." "RHS" \" -*- nroff -*-
-.SH NAME
-ppp-watch \- daemon to make PPP interfaces act more like other interfaces
-.SH SYNOPSIS
-.B ppp-watch
-\fIinterface-name\fP [boot]
-.SH DESCRIPTION
-.B ppp-watch
-manages one PPP connection, including starting, stopping, and redialing.
-It makes starting and stopping the connection synchronous activities.
-
-.B ppp-watch
-is not really meant to be called directly. It should only be used from
-within the ifup-ppp script.
-.SH OPTIONS
-.TP
-.I interface-name
-The name of the PPP interface to bring up.
-.TP
-boot
-ppp-watch is being called at boot time and should time out after a
-while if the PPP connection does not come up in order not to hang
-the boot sequence.
diff --git a/src/ppp-watch.c b/src/ppp-watch.c
deleted file mode 100644
index cbe35360..00000000
--- a/src/ppp-watch.c
+++ /dev/null
@@ -1,864 +0,0 @@
-/*
- * ppp-watch.c
- *
- * Bring up a PPP connection and Do The Right Thing[tm] to make bringing
- * the connection up or down with ifup and ifdown synchronous. Takes
- * one argument: the logical name of the device to bring up. Does not
- * detach until the interface is up or has permanently failed to come up.
- *
- * Copyright 1999-2007 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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.
- *
- */
-
-/* Algorithm:
- * fork
- * if child:
- * Register with netreport. (now exit implies deregister first)
- * fork/exec ifup-ppp daemon <interface>
- * else:
- * while (1):
- * sigsuspend()
- * if SIGTERM or SIGINT:
- * kill pppd pgrp
- * exit
- * if SIGHUP:
- * reload ifcfg files
- * kill pppd pgrp
- * wait for SIGCHLD to redial
- * if SIGIO:
- * if no physical device found: continue
- * elif physical device is down:
- * wait for pppd to exit to redial if appropriate
- * else: (physical device is up)
- * detach; continue
- * if SIGCHLD: (pppd exited)
- * wait()
- * if pppd exited:
- * if PERSIST: redial
- * else: exit
- * else: (pppd was killed)
- * exit
- *
- *
- * When ppp-watch itself dies for reasons of its own, it uses a return code
- * higher than 25 so as not to clash with pppd return codes, which, as of
- * this writing, range from 0 to 19.
- */
-
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/resource.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <termios.h>
-#include <net/if.h>
-#include <glib.h>
-#include "shvar.h"
-
-#define IFCFGPREFIX "/etc/sysconfig/network-scripts/ifcfg-"
-#define IFUP_PPP "/etc/sysconfig/network-scripts/ifup-ppp"
-
-static int theSigterm = 0;
-static int theSigint = 0;
-static int theSighup = 0;
-static int theSigio = 0;
-static int theSigchld = 0;
-static int theSigalrm = 0;
-static int pipeArray[2];
-
-// patch to respect the maxfail parameter to ppp
-// Scott Sharkey <ssharkey@linux-no-limits.com>
-static int dialCount = 0;
-static pid_t theChild;
-static void failureExit(int exitCode);
-
-static void
-interrupt_child(int signo) {
- kill(theChild, SIGINT);
-}
-
-static void
-set_signal(int signo, void (*handler)(int)) {
- struct sigaction act;
- act.sa_handler = handler;
- act.sa_flags = SA_RESTART;
- sigemptyset(&act.sa_mask);
- sigaction(signo, &act, NULL);
-}
-
-/* Create a pipe, and fork off a child. This is the end of the road for
- * the parent, which will wait for an exit status byte on the pipe (which
- * is written by the child). */
-static void
-detach(char *device) {
- pid_t childpid;
- unsigned char exitCode;
- int fd;
-
- if (pipe(pipeArray) == -1)
- exit(25);
-
- childpid = fork();
- if (childpid == -1)
- exit(26);
-
- if (childpid != 0) {
- /* The parent only cares about notifications from the child. */
- close (pipeArray[1]);
-
- /* Certain signals are meant for our child, the watcher process. */
- theChild = childpid;
- set_signal(SIGINT, interrupt_child);
- set_signal(SIGTERM, interrupt_child);
- set_signal(SIGHUP, interrupt_child);
-
- /* Read the pipe until the child gives us an exit code as a byte. */
- while (read (pipeArray[0], &exitCode, 1) == -1) {
- switch (errno) {
- case EINTR: continue;
- default: exit (27); /* this will catch EIO in particular */
- }
- }
- switch (exitCode) {
- case 0:
- break;
-
- case 1:
- fprintf(stderr, "Device %s: An immediately fatal error of some kind occurred, such as an "
- "essential system call failing, or running out of virtual memory.\n", device);
- break;
-
- case 2:
- fprintf(stderr, "Device %s: An error was detected in processing the options given, such as "
- "two mutually exclusive options being used.\n", device);
- break;
-
- case 3:
- fprintf(stderr, "Device %s: Pppd is not setuid-root and the invoking user is not root.\n", device);
- break;
-
- case 4:
- fprintf(stderr, "Device %s: The kernel does not support PPP, for example, the PPP kernel "
- "driver is not included or cannot be loaded.\n", device);
- break;
-
- case 5:
- fprintf(stderr, "Device %s: Pppd terminated because it was sent a SIGINT, SIGTERM or SIGHUP signal.\n", device);
- break;
-
- case 6:
- fprintf(stderr, "Device %s: The serial port could not be locked.\n", device);
- break;
-
- case 7:
- fprintf(stderr, "Device %s: The serial port could not be opened.\n", device);
- break;
-
- case 8:
- fprintf(stderr, "Device %s: The connect script failed (maybe wrong password or wrong phone number).\n", device);
- break;
-
- case 9:
- fprintf(stderr, "Device %s: The command specified as the argument to the pty option could not be run.\n", device);
- break;
-
- case 10:
- fprintf(stderr, "Device %s: The PPP negotiation failed, that is, it didn't reach the point "
- "where at least one network protocol (e.g. IP) was running.\n", device);
- break;
-
- case 11:
- fprintf(stderr, "Device %s: The peer system failed (or refused) to authenticate itself.\n", device);
- break;
-
- case 12:
- fprintf(stderr, "Device %s: The link was established successfully and terminated because it was idle.\n", device);
- break;
-
- case 13:
- fprintf(stderr, "Device %s: The link was established successfully and terminated because the connect time limit was reached.\n", device);
- break;
-
- case 14:
- fprintf(stderr, "Device %s: Callback was negotiated and an incoming call should arrive shortly.\n", device);
- break;
-
- case 15:
- fprintf(stderr, "Device %s: The link was terminated because the peer is not responding to echo requests.\n", device);
- break;
-
- case 16:
- fprintf(stderr, "Device %s: The link was terminated by the modem hanging up.\n", device);
- break;
-
- case 18:
- fprintf(stderr, "Device %s: The init script failed (returned a non-zero exit status).\n", device);
- break;
-
- case 19:
- fprintf(stderr, "Device %s: We failed to authenticate ourselves to the peer.\n", device);
- break;
-
- case 33:
- fprintf(stderr, "%s already up, initiating redial\n", device);
- break;
- case 34:
- fprintf(stderr, "Failed to activate %s, retrying in the background\n", device);
- break;
- default:
- fprintf(stderr, "Failed to activate %s with error %d\n", device, exitCode);
- break;
- }
- exit(exitCode);
- }
-
- /* We're in the child process, which only writes the exit status
- * of the pppd process to its parent (i.e., it reads nothing). */
- close (pipeArray[0]);
-
- /* Don't leak this into programs we call. */
- fcntl(pipeArray[1], F_SETFD, FD_CLOEXEC);
-
- /* Redirect stdio to /dev/null. */
- fd = open("/dev/null", O_RDONLY);
- dup2(fd, STDIN_FILENO);
- close(fd);
-
- fd = open("/dev/null", O_WRONLY);
- dup2(fd, STDOUT_FILENO);
- dup2(fd, STDERR_FILENO);
- close(fd);
-
- /* Become session and process group leader. */
- setsid();
- setpgid(0, 0);
-}
-
-/* Do magic with the pid file (/var/run/pppwatch-$DEVICE.pid):
- * Try to open it for writing. If it exists, send a SIGHUP to whatever PID
- * is already listed in it and remove it. Repeat until we can open it.
- * Write out our PID, and return. */
-static void
-doPidFile(char *device) {
- static char pidFilePath[PATH_MAX] = "";
- int fd = -1;
- FILE *f = NULL;
- pid_t pid = 0;
-
- if (device == NULL) {
- /* Remove an existing pid file -- we're exiting. */
- if(strlen(pidFilePath) > 0) {
- unlink(pidFilePath);
- }
- } else {
- /* Set up the name of the pid file, used only the first time. */
- snprintf(pidFilePath, sizeof(pidFilePath), "/var/run/pppwatch-%s.pid",
- device);
-
- /* Create the pid file. */
- do {
- fd = open(pidFilePath, O_WRONLY|O_TRUNC|O_CREAT|O_EXCL|O_NOFOLLOW,
- S_IRUSR|S_IWUSR | S_IRGRP | S_IROTH);
- if(fd == -1) {
- /* Try to open the file for read. */
- fd = open(pidFilePath, O_RDONLY);
- if(fd == -1)
- failureExit(36); /* This is not good. */
-
- /* We're already running, send a SIGHUP (we presume that they
- * are calling ifup for a reason, so they probably want to
- * redial) and then exit cleanly and let things go on in the
- * background. Muck with the filename so that we don't go
- * deleting the pid file for the already-running instance.
- */
- f = fdopen(fd, "r");
- if(f == NULL)
- failureExit(37);
-
- pid = 0;
- fscanf(f, "%d", &pid);
- fclose(f);
-
- if(pid) {
- /* Try to kill it. */
- if (kill(pid, SIGHUP) == -1) {
- /* No such pid, remove the bogus pid file. */
- unlink(pidFilePath);
- } else {
- /* Got it. Don't mess with the pid file on
- * our way out. */
- memset(pidFilePath, '\0', sizeof(pidFilePath));
- failureExit(33);
- }
- }
- }
- } while(fd == -1);
-
- f = fdopen(fd, "w");
- if(f == NULL)
- failureExit(31);
- fprintf(f, "%d\n", getpid());
- fclose(f);
- }
-}
-
-/* Fork off and exec() a child process. If reap_child is non-zero,
- * wait for the child to exit and return 0 if it ran successfully,
- * otherwise return 0 right away and let the SIGCHLD handler deal. */
-static int
-fork_exec(gboolean reap, char *path, char *arg1, char *arg2, char *arg3)
-{
- pid_t childpid;
- int status;
-
- sigset_t sigs;
-
- childpid = fork();
- if (childpid == -1)
- exit(26);
-
- if (childpid == 0) {
- /* Do the exec magic. Prepare by clearing the signal mask for pppd. */
- sigemptyset(&sigs);
- sigprocmask(SIG_SETMASK, &sigs, NULL);
-
- if (!reap) {
- /* Make sure that the pppd is the leader for its process group. */
- setsid();
- setpgid(0, 0);
- }
-
- execl(path, path, arg1, arg2, arg3, NULL);
- perror(path);
- _exit (1);
- }
-
- if (reap) {
- waitpid (childpid, &status, 0);
- if (WIFEXITED(status) && (WEXITSTATUS(status) == 0)) {
- return 0;
- } else {
- return 1;
- }
- } else {
- return 0;
- }
-}
-
-/* Relay the pppd's exit code up to the parent -- can only be called once,
- * because the parent exits as soon as it reads a byte. */
-static void
-relay_exitcode(unsigned char code)
-{
- unsigned char exitCode;
- exitCode = code;
- write(pipeArray[1], &exitCode, 1);
- close(pipeArray[1]);
-}
-
-/* Unregister with netreport, relay a status byte to the parent, clean up
- * the pid file, and bail. */
-static void
-failureExit(int exitCode) {
- fork_exec(TRUE, "/sbin/netreport", "-r", NULL, NULL);
- relay_exitcode(exitCode);
- doPidFile(NULL);
- exit(exitCode);
-}
-
-/* Keeps track of which signals we've seen so far. */
-static void
-signal_tracker (int signum) {
- switch(signum) {
- case SIGTERM:
- theSigterm = 1; break;
- case SIGINT:
- theSigint = 1; break;
- case SIGHUP:
- theSighup = 1; break;
- case SIGIO:
- theSigio = 1; break;
- case SIGCHLD:
- theSigchld = 1; break;
- case SIGALRM:
- theSigalrm = 1; break;
- }
-}
-
-/* Return a shvarFile for this interface, taking into account one level of
- * inheritance (eeewww). */
-static shvarFile *
-shvarfilesGet(const char *interfaceName) {
- shvarFile *ifcfg = NULL;
- char ifcfgName[PATH_MAX];
- char *ifcfgParentDiff = NULL;
-
- /* Start with the basic configuration. */
- snprintf(ifcfgName, sizeof(ifcfgName), "%s%s", IFCFGPREFIX, interfaceName);
- ifcfg = svNewFile(ifcfgName);
- if (ifcfg == NULL)
- return NULL;
-
- /* Do we have a parent interface (i.e., for ppp0-blah, ppp0) to inherit? */
- ifcfgParentDiff = strchr(ifcfgName + sizeof(IFCFGPREFIX), '-');
- if (ifcfgParentDiff) {
- *ifcfgParentDiff = '\0';
- ifcfg->parent = svNewFile(ifcfgName);
- }
-
- /* This is very unclean, but we have to close the shvar descriptors in
- * case they've been numbered STDOUT_FILENO or STDERR_FILENO, which would
- * be disastrous if inherited by a child process. */
- close (ifcfg->fd);
- ifcfg->fd = 0;
-
- if (ifcfg->parent) {
- close (ifcfg->parent->fd);
- ifcfg->parent->fd = 0;
- }
-
- return ifcfg;
-}
-
-/* Convert a logical interface name to a real one by reading the lock
- * file created by pppd. */
-static void
-pppLogicalToPhysical(int *pppdPid, char *logicalName, char **physicalName) {
- char mapFileName[PATH_MAX];
- char buffer[20];
- char *p, *q;
- int fd, n;
- char *physicalDevice = NULL;
-
- snprintf(mapFileName, sizeof(mapFileName), "/var/run/ppp-%s.pid",
- logicalName);
- fd = open(mapFileName, O_RDONLY);
- if (fd != -1) {
- n = read(fd, buffer, sizeof(buffer) - 1);
- close(fd);
- if (n > 0) {
- buffer[n] = '\0';
- /* Split up the file at the first line break -- the PID is on the
- * first line. */
- if((p = strchr(buffer, '\n')) != NULL) {
- *p = '\0';
- p++;
- if (pppdPid) {
- *pppdPid = atoi(buffer);
- }
- /* The physical device name is on the second line. */
- if((q = strchr(p, '\n')) != NULL) {
- *q = '\0';
- physicalDevice = strdup(p);
- }
- }
- }
- }
-
- if (physicalDevice) {
- if (physicalName) {
- *physicalName = physicalDevice;
- } else {
- free(physicalDevice);
- }
- } else {
- if (physicalName) {
- *physicalName = NULL;
- }
- }
-}
-
-/* Return a boolean value indicating if the interface is up. If not, or
- * if we don't know, return FALSE. */
-static gboolean
-interfaceIsUp(char *device) {
- int sock = -1;
- int family[] = {PF_INET, PF_IPX, PF_AX25, PF_APPLETALK, 0};
- int p = 0;
- struct ifreq ifr;
- gboolean retcode = FALSE;
-
- /* Create a socket suitable for doing routing ioctls. */
- for (p = 0; (sock == -1) && family[p]; p++) {
- sock = socket(family[p], SOCK_DGRAM, 0);
- }
- if (sock == -1)
- return FALSE;
-
- /* Populate the request structure for getting the interface's status. */
- memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name) - 1);
- ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0';
-
- /* We return TRUE iff the ioctl succeeded and the interface is UP. */
- if (ioctl(sock, SIOCGIFFLAGS, &ifr) == -1) {
- retcode = FALSE;
- } else if (ifr.ifr_flags & IFF_UP) {
- retcode = TRUE;
- }
-
- close(sock);
-
- return retcode;
-}
-
-/* Very, very minimal hangup function. This just attempts to hang up a device
- * that should already be hung up, so it does not need to be bulletproof. */
-static void
-hangup(shvarFile *ifcfg) {
- int fd;
- char *line;
- struct termios original_ts, ts;
-
- line = svGetValue(ifcfg, "MODEMPORT");
- if (line == NULL)
- return;
-
- fd = open(line, O_RDWR | O_NOCTTY | O_NONBLOCK);
- if (fd != -1) {
- if (tcgetattr(fd, &ts) != -1) {
- original_ts = ts;
- write(fd, "\r", 1); /* tickle modems that do not like dropped DTR */
- usleep(1000);
- cfsetospeed(&ts, B0);
- tcsetattr(fd, TCSANOW, &ts);
- usleep(100000);
- tcsetattr(fd, TCSANOW, &original_ts);
- }
- close(fd);
- }
- free(line);
-}
-
-int
-main(int argc, char **argv) {
- int status;
- pid_t waited;
- char *device, *real_device, *physicalDevice = NULL;
- char *boot = NULL;
- shvarFile *ifcfg;
- sigset_t blockedsigs, unblockedsigs;
- int pppdPid = 0;
- int timeout = 30;
- char *temp;
- gboolean dying = FALSE;
- int sendsig;
- gboolean connectedOnce = FALSE;
- int maxfail = 0; // MAXFAIL Patch <ssharkey@linux-no-limits.com>
-
- if (argc < 2) {
- fprintf (stderr, "usage: ppp-watch <interface-name> [boot]\n");
- exit(30);
- }
-
- if (strncmp(argv[1], "ifcfg-", 6) == 0) {
- device = argv[1] + 6;
- } else {
- device = argv[1];
- }
-
- detach(device); /* Prepare a child process to monitor pppd. When we
- return, we'll be in the child. */
-
- if ((argc > 2) && (strcmp("boot", argv[2]) == 0)) {
- boot = argv[2];
- }
-
- ifcfg = shvarfilesGet(device);
- if (ifcfg == NULL)
- failureExit(28);
-
- real_device = svGetValue(ifcfg, "DEVICE");
- if (real_device == NULL)
- real_device = device;
-
- doPidFile(real_device);
-
- /* We'll want to know which signal interrupted our sleep below, so
- * attach a signal handler to these. */
- set_signal(SIGTERM, signal_tracker);
- set_signal(SIGINT, signal_tracker);
- set_signal(SIGHUP, signal_tracker);
- set_signal(SIGIO, signal_tracker);
- set_signal(SIGCHLD, signal_tracker);
-
- /* We time out only if we're being run at boot-time. */
- if (boot) {
- temp = svGetValue(ifcfg, "BOOTTIMEOUT");
- if (temp) {
- timeout = atoi(temp);
- if (timeout < 1) timeout = 1;
- free(temp);
- } else {
- timeout = 30;
- }
- set_signal(SIGALRM, signal_tracker);
- alarm(timeout);
- }
-
- /* Register us to get a signal when something changes. Yes, that's vague. */
- fork_exec(TRUE, "/sbin/netreport", NULL, NULL, NULL);
-
- /* Reset theSigchld, which should have been triggered by netreport. */
- theSigchld = 0;
-
- /* We don't set up the procmask until after we have received the netreport
- * signal. Do so now. */
- sigemptyset(&blockedsigs);
- sigaddset(&blockedsigs, SIGTERM);
- sigaddset(&blockedsigs, SIGINT);
- sigaddset(&blockedsigs, SIGHUP);
- sigaddset(&blockedsigs, SIGIO);
- sigaddset(&blockedsigs, SIGCHLD);
- if (boot) {
- sigaddset(&blockedsigs, SIGALRM);
- }
- sigprocmask(SIG_BLOCK, &blockedsigs, NULL);
-
- sigfillset(&unblockedsigs);
- sigdelset(&unblockedsigs, SIGTERM);
- sigdelset(&unblockedsigs, SIGINT);
- sigdelset(&unblockedsigs, SIGHUP);
- sigdelset(&unblockedsigs, SIGIO);
- sigdelset(&unblockedsigs, SIGCHLD);
- if (boot) {
- sigdelset(&unblockedsigs, SIGALRM);
- }
- sigprocmask(SIG_UNBLOCK, &unblockedsigs, NULL);
-
- /* Initialize the retry timeout using the RETRYTIMEOUT setting. */
- temp = svGetValue(ifcfg, "RETRYTIMEOUT");
- if (temp) {
- timeout = atoi(temp);
- free(temp);
- } else {
- timeout = 30;
- }
-
- /* Start trying to bring the interface up. */
- fork_exec(FALSE, IFUP_PPP, "daemon", device, boot);
-
- while (TRUE) {
- /* Wait for a signal. */
- if (!theSigterm &&
- !theSigint &&
- !theSighup &&
- !theSigio &&
- !theSigchld &&
- !theSigalrm) {
- sigsuspend(&unblockedsigs);
- }
-
- /* If we got SIGTERM or SIGINT, give up and hang up. */
- if (theSigterm || theSigint) {
- theSigterm = theSigint = 0;
-
- /* If we've already tried to exit this way, use SIGKILL instead
- * of SIGTERM, because pppd's just being stubborn. */
- if (dying) {
- sendsig = SIGKILL;
- } else {
- sendsig = SIGTERM;
- }
- dying = TRUE;
-
- /* Get the pid of our child pppd. */
- pppLogicalToPhysical(&pppdPid, device, NULL);
-
- /* We don't know what our child pid is. This is very confusing. */
- if (!pppdPid) {
- failureExit(35);
- }
-
- /* Die, pppd, die. */
- kill(pppdPid, sendsig);
- if (sendsig == SIGKILL) {
- kill(-pppdPid, SIGTERM); /* Give it a chance to die nicely, then
- kill its whole process group. */
- usleep(2500000);
- kill(-pppdPid, sendsig);
- hangup(ifcfg);
- failureExit(32);
- }
- }
-
- /* If we got SIGHUP, reload and redial. */
- if (theSighup) {
- theSighup = 0;
-
- /* Free and reload the configuration structure. */
- if (ifcfg->parent)
- svCloseFile(ifcfg->parent);
- svCloseFile(ifcfg);
- ifcfg = shvarfilesGet(device);
-
- /* Get the PID of our child pppd. */
- pppLogicalToPhysical(&pppdPid, device, NULL);
- kill(pppdPid, SIGTERM);
-
- /* We'll redial when the SIGCHLD arrives, even if PERSIST is
- * not set (the latter handled by clearing the "we've connected
- * at least once" flag). */
- connectedOnce = FALSE;
-
- /* We don't want to delay before redialing, either, so cut
- * the retry timeout to zero. */
- timeout = 0;
- }
-
- /* If we got a SIGIO (from netreport, presumably), check if the
- * interface is up and return zero (via our parent) if it is. */
- if (theSigio) {
- theSigio = 0;
-
- pppLogicalToPhysical(NULL, device, &physicalDevice);
- if (physicalDevice) {
- if (interfaceIsUp(physicalDevice)) {
- /* The interface is up, so report a success to a parent if
- * we have one. Any errors after this we just swallow. */
- relay_exitcode(0);
- connectedOnce = TRUE;
- alarm(0);
- }
- free(physicalDevice);
- }
- }
-
- /* If we got a SIGCHLD, then pppd died (possibly because we killed it),
- * and we need to restart it after timeout seconds. */
- if (theSigchld) {
- theSigchld = 0;
-
- /* Find its pid, which is also its process group ID. */
- waited = waitpid(-1, &status, 0);
- if (waited == -1) {
- continue;
- }
-
- /* Now, we need to kill any children of pppd still in pppd's
- * process group, in case they are hanging around.
- * pppd is dead (we just waited for it) but there is no
- * guarantee that its children are dead, and they will
- * hold the modem if we do not get rid of them.
- * We have kept the old pid/pgrp around in pppdPid. */
- if (pppdPid) {
- kill(-pppdPid, SIGTERM); /* give it a chance to die nicely */
- usleep(2500000);
- kill(-pppdPid, SIGKILL);
- hangup(ifcfg);
- }
- pppdPid = 0;
-
- /* Bail if the child exitted abnormally or we were already
- * signalled to kill it. */
- if (!WIFEXITED(status)) {
- failureExit(29);
- }
- if (dying) {
- failureExit(WEXITSTATUS(status));
- }
-
- /* Error conditions from which we do not expect to recover
- * without user intervention -- do not fill up the logs. */
- switch (WEXITSTATUS(status)) {
- case 1: case 2: case 3: case 4: case 6:
- case 7: case 9: case 14: case 17:
- failureExit(WEXITSTATUS(status));
- break;
- default:
- break;
- }
-
- /* PGB 08/20/02: We no longer retry connecting MAXFAIL
- times on a failed connect script unless RETRYCONNECT is
- true. */
- if ((WEXITSTATUS(status) == 8) &&
- !svTrueValue(ifcfg, "RETRYCONNECT", FALSE)) {
- failureExit(WEXITSTATUS(status));
- }
-
- /* If we've never connected, or PERSIST is set, dial again, up
- * to MAXFAIL times. */
- if ((WEXITSTATUS(status) == 8) ||
- !connectedOnce ||
- svTrueValue(ifcfg, "PERSIST", FALSE)) {
- /* If we've been connected (i.e., if we didn't force a redial,
- * but the connection went down) wait for DISCONNECTTIMEOUT
- * seconds before redialing. */
- if (connectedOnce) {
- connectedOnce = FALSE;
- temp = svGetValue(ifcfg, "DISCONNECTTIMEOUT");
- if (temp) {
- timeout = atoi(temp);
- free(temp);
- } else {
- timeout = 2;
- }
- }
- sigprocmask(SIG_UNBLOCK, &blockedsigs, NULL);
- sleep(timeout);
- sigprocmask(SIG_BLOCK, &blockedsigs, NULL);
- if (!theSigterm &&
- !theSigint &&
- !theSighup &&
- !theSigio &&
- !theSigchld &&
- !theSigalrm) {
- fork_exec(FALSE, IFUP_PPP, "daemon", device, boot);
- }
- /* Reinitialize the retry timeout. */
- temp = svGetValue(ifcfg, "RETRYTIMEOUT");
- if (temp) {
- timeout = atoi(temp);
- free(temp);
- } else {
- timeout = 30;
- }
-// Scott Sharkey <ssharkey@linux-no-limits.com>
-// MAXFAIL Patch...
- temp = svGetValue(ifcfg, "MAXFAIL");
- if (temp) {
- maxfail = atoi(temp);
- free(temp);
- } else {
- maxfail = 0;
- }
- if ( maxfail != 0 ) {
- dialCount++;
- if ( dialCount >= maxfail )
- failureExit(WEXITSTATUS(status));
- }
- } else {
- failureExit(WEXITSTATUS(status));
- }
- }
-
- /* We timed out, and we're running at boot-time. */
- if (theSigalrm) {
- failureExit(34);
- }
- }
-}
diff --git a/sysconfig/network-scripts/ifdown-ppp b/sysconfig/network-scripts/ifdown-ppp
deleted file mode 100755
index fca64638..00000000
--- a/sysconfig/network-scripts/ifdown-ppp
+++ /dev/null
@@ -1,51 +0,0 @@
-#! /bin/bash
-
-cd /etc/sysconfig/network-scripts
-. ./network-functions
-
-CONFIG=$1
-source_config
-
-if [ "$TYPE" = "xDSL" ] && [ -x /usr/sbin/adsl-stop ] ; then
- adsl-stop /etc/sysconfig/network-scripts/$CONFIG
- exit $?
-fi
-
-CONFIG=${CONFIG##ifcfg-}
-
-if [ "${DEMAND}" = "yes" ] && [ -f /var/run/ppp-${CONFIG}.pid ] ; then
- PID=$(head -1 /var/run/ppp-${CONFIG}.pid)
- kill -TERM ${PID}
- sleep 2
- [ ! -d /proc/${PID} ] && exit 0
- sleep 5
- [ ! -d /proc/${PID} ] && exit 0
- kill -TERM ${PID}
- [ ! -d /proc/${PID} ] && exit 0
- exit 1
-fi
-
-file=/var/run/pppwatch-${DEVICE}.pid
-
-if [ ! -f $file ]; then
- # ppp isn't running, or we didn't start it
- exit 0
-fi
-
-PID=$(cat $file)
-[ -n "${PID}" ] || exit 1
-
-kill -TERM ${PID} > /dev/null 2>&1
-[ ! -d /proc/${PID} ] && exit 0
-sleep 2
-[ ! -d /proc/${PID} ] && exit 0
-sleep 5
-[ ! -d /proc/${PID} ] && exit 0
-sleep 10
-[ ! -d /proc/${PID} ] && exit 0
-
-# killing ppp-watch twice in a row causes it to send a SIGKILL to pppd pgrp
-kill -TERM ${PID} > /dev/null 2>&1
-[ ! -d /proc/${PID} ] && exit 0
-
-exit 1
diff --git a/sysconfig/network-scripts/ifup-ppp b/sysconfig/network-scripts/ifup-ppp
deleted file mode 100755
index fb30639d..00000000
--- a/sysconfig/network-scripts/ifup-ppp
+++ /dev/null
@@ -1,157 +0,0 @@
-#! /bin/bash
-
-. /etc/init.d/functions
-
-cd /etc/sysconfig/network-scripts
-. ./network-functions
-
-# ifup-post for PPP is handled through /etc/ppp/ip-up
-if [ "${1}" = daemon ] ; then
- # we've been called from ppp-watch, so don't invoke it for persistence
- shift
-else
- # just in case a full path to the configuration file is passed in
- CONFIG=${1##*/} # CONFIG=$(basename $1)
- [ -f "${CONFIG}" ] || CONFIG=ifcfg-${1}
- source_config
- # don't start ppp-watch by xDSL
- if [ "${DEMAND}" != yes -a "$TYPE" != "xDSL" ] ; then
- # let ppp-watch do the right thing
- exec /sbin/ppp-watch "${CONFIG##ifcfg-}" "$2"
- fi
-fi
-
-CONFIG=$1
-[ -f "${CONFIG}" ] || CONFIG=ifcfg-${1}
-source_config
-
-if [ -z "${DISCONNECTTIMEOUT}" ]; then
- DISCONNECTTIMEOUT=2
-fi
-
-if [ -z "${RETRYTIMEOUT}" ]; then
- RETRYTIMEOUT=30
-fi
-
-if [ -z "${IDLETIMEOUT}" ]; then
- IDLETIMEOUT=600
-fi
-
-if [ "${2}" = "boot" -a "${ONBOOT}" = "no" ]; then
- exit
-fi
-
-[ -x /usr/sbin/pppd ] || {
- echo $"pppd does not exist or is not executable"
- echo $"ifup-ppp for ${DEVICE} exiting"
- /usr/bin/logger -p daemon.info -t ifup-ppp \
- $"pppd does not exist or is not executable for ${DEVICE}"
- exit 1
-}
-
-# check that xDSL connection
-if [ "$TYPE" = "xDSL" ] ; then
- if [ -x /usr/sbin/adsl-start ] ; then
- adsl-start /etc/sysconfig/network-scripts/$CONFIG
- exit $?
- else
- /usr/bin/logger -p daemon.info -t ifup-ppp \
- $"adsl-start does not exist or is not executable for ${DEVICE}"
- exit 1
- fi
-fi
-
-PEERCONF=/etc/ppp/peers/${DEVNAME}
-
-if [ "${DEBUG}" = "yes" ]; then
- CHATDBG="-v"
-fi
-
-if [ ! -f ${PEERCONF} ]; then
- if [ -z "${WVDIALSECT}" ] ; then
- CHATSCRIPT=/etc/sysconfig/network-scripts/chat-${DEVNAME}
- [ -f ${CHATSCRIPT} ] || {
- echo $"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist"
- echo $"ifup-ppp for ${DEVNAME} exiting"
- /usr/bin/logger -p daemon.info -t ifup-ppp \
- $"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist for ${DEVICE}"
- exit 1
- }
- fi
- /usr/bin/logger -s -p daemon.notice -t ifup-ppp \
- $"Setting up a new ${PEERCONF} config file"
- if [ -f /etc/ppp/peers/${DEVICE} ]; then
- cp -f /etc/ppp/peers/${DEVICE} ${PEERCONF}
- else
- touch ${PEERCONF}
- fi
- if [ "${WVDIALSECT}" ]; then
- echo "connect \"/usr/bin/wvdial --remotename ${DEVNAME} --chat '${WVDIALSECT}'\"" >> ${PEERCONF}
- else
- echo "connect \"/usr/sbin/chat ${CHATDBG} -f ${CHATSCRIPT}\"" >> ${PEERCONF}
- fi
-fi
-
-opts="lock"
-if [ "${HARDFLOWCTL}" != no ] ; then
- opts="$opts modem crtscts"
-fi
-if [ "${ESCAPECHARS}" != yes ] ; then
- opts="$opts asyncmap 00000000"
-fi
-if [ "${DEFROUTE}" != no ] ; then
- # pppd will no longer delete an existing default route
- # so we have to help it out a little here.
- DEFRT=$(ip route list match 0.0.0.0/0)
- [ -n "${DEFRT}" ] && echo "$DEFRT" > /etc/default-routes
- echo "$DEFRT" | while read spec; do
- ip route del $spec;
- done
- opts="$opts defaultroute"
-fi
-if [ "${PEERDNS}" != no ] ; then
- cp -f /etc/resolv.conf /etc/resolv.conf.save
- opts="$opts usepeerdns"
-fi
-if [ -n "${MRU}" ] ; then
- opts="$opts mru ${MRU}"
-fi
-if [ -n "${MTU}" ] ; then
- opts="$opts mtu ${MTU}"
-fi
-if [ -n "${IPADDR}${REMIP}" ] ; then
- # if either IP address is set, the following will work.
- opts="$opts ${IPADDR}:${REMIP}"
-fi
-if [ -n "${PAPNAME}" ] ; then
- opts="$opts user ${PAPNAME} remotename ${DEVNAME}"
-fi
-if [ "${DEBUG}" = yes ] ; then
- opts="$opts debug"
-fi
-
-if [ ${DEMAND} = yes ] ; then
- opts="$opts demand ktune idle ${IDLETIMEOUT} holdoff ${RETRYTIMEOUT}"
- exec=
-else
- opts="$opts nodetach"
- exec=exec
-fi
-
-/usr/bin/logger -p daemon.info -t ifup-ppp \
- $"pppd started for ${DEVNAME} on ${MODEMPORT} at ${LINESPEED}"
-
-$exec pppd $opts ${MODEMPORT} ${LINESPEED} \
- ipparam ${DEVNAME} linkname ${DEVNAME} call ${DEVNAME}\
- noauth \
- ${PPPOPTIONS} || exit
-
-if [ "${DEMAND}" = "yes" ] ; then
- # pppd is a tad slow to write the pid-file.
- sleep 2
- if [ -f /var/run/ppp-${DEVNAME}.pid ] ; then
- REALDEVICE=$(tail -1 /var/run/ppp-${DEVNAME}.pid)
- /etc/sysconfig/network-scripts/ifup-routes ${REALDEVICE} ${DEVNAME}
- fi
-fi
-