[ppp] spec: move ppp initscripts to ppp package

Michal Sekletar msekleta at fedoraproject.org
Thu Apr 24 11:52:23 UTC 2014


commit e3ff43f81265ccf70cf080301252778e182ca61c
Author: Michal Sekletar <msekleta at redhat.com>
Date:   Wed Apr 16 11:22:38 2014 +0200

    spec: move ppp initscripts to ppp package
    
    Related: #1088220

 .gitignore      |    1 +
 ifdown-ppp      |   51 +++++++++++++++
 ifup-ppp        |  157 ++++++++++++++++++++++++++++++++++++++++++++
 ip-down         |   18 +++++
 ip-down.ipv6to4 |  114 ++++++++++++++++++++++++++++++++
 ip-up           |   17 +++++
 ip-up.ipv6to4   |  193 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ipv6-down       |   70 ++++++++++++++++++++
 ipv6-up         |  112 ++++++++++++++++++++++++++++++++
 ppp.spec        |   50 +++++++++++++--
 sources         |    1 +
 11 files changed, 778 insertions(+), 6 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index aea9d80..f432f90 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 ppp-2.4.5.tar.gz
 /ppp-2.4.6.tar.gz
+/ppp-watch.tar.xz
diff --git a/ifdown-ppp b/ifdown-ppp
new file mode 100755
index 0000000..fca6463
--- /dev/null
+++ b/ifdown-ppp
@@ -0,0 +1,51 @@
+#! /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/ifup-ppp b/ifup-ppp
new file mode 100755
index 0000000..fb30639
--- /dev/null
+++ b/ifup-ppp
@@ -0,0 +1,157 @@
+#! /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
+
diff --git a/ip-down b/ip-down
new file mode 100644
index 0000000..bfb0871
--- /dev/null
+++ b/ip-down
@@ -0,0 +1,18 @@
+#!/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/ip-down.ipv6to4 b/ip-down.ipv6to4
new file mode 100644
index 0000000..29f1c64
--- /dev/null
+++ b/ip-down.ipv6to4
@@ -0,0 +1,114 @@
+#!/bin/sh
+#
+# ip-down.ipv6to4
+#
+#
+# Taken from:
+# (P) & (C) 2000-2005 by Peter Bieringer <pb at 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/ip-up b/ip-up
new file mode 100644
index 0000000..e610674
--- /dev/null
+++ b/ip-up
@@ -0,0 +1,17 @@
+#!/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/ip-up.ipv6to4 b/ip-up.ipv6to4
new file mode 100644
index 0000000..6a85bbb
--- /dev/null
+++ b/ip-up.ipv6to4
@@ -0,0 +1,193 @@
+#!/bin/sh
+#
+# ip-up.ipv6to4
+#
+#
+# Taken from:
+# (P) & (C) 2000-2005 by Peter Bieringer <pb at 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/ipv6-down b/ipv6-down
new file mode 100644
index 0000000..b290585
--- /dev/null
+++ b/ipv6-down
@@ -0,0 +1,70 @@
+#!/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 at 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 at 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/ipv6-up b/ipv6-up
new file mode 100644
index 0000000..059afec
--- /dev/null
+++ b/ipv6-up
@@ -0,0 +1,112 @@
+#!/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 at 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 at 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/ppp.spec b/ppp.spec
index eb74e32..b9321cc 100644
--- a/ppp.spec
+++ b/ppp.spec
@@ -3,7 +3,7 @@
 Summary: The Point-to-Point Protocol daemon
 Name: ppp
 Version: 2.4.6
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: BSD and LGPLv2+ and GPLv2+ and Public Domain
 Group: System Environment/Daemons
 URL: http://www.samba.org/ppp
@@ -11,6 +11,15 @@ Source0: ftp://ftp.samba.org/pub/ppp/ppp-%{version}.tar.gz
 Source1: ppp-pam.conf
 Source2: ppp-logrotate.conf
 Source3: ppp-tmpfiles.conf
+Source4: ip-down
+Source5: ip-down.ipv6to4
+Source6: ip-up
+Source7: ip-up.ipv6to4
+Source8: ipv6-down
+Source9: ipv6-up
+Source10: ifup-ppp
+Source11: ifdown-ppp
+Source12: ppp-watch.tar.xz
 
 # Fedora-specific
 Patch0001: 0001-build-sys-use-gcc-as-our-compiler-of-choice.patch
@@ -39,8 +48,8 @@ Patch0023: 0023-build-sys-install-rp-pppoe-plugin-files-with-standar.patch
 Patch0024: 0024-build-sys-install-pppoatm-plugin-files-with-standard.patch
 Patch0025: 0025-pppd-install-pppd-binary-using-standard-perms-755.patch
 
-BuildRequires: pam-devel, libpcap-devel, openssl-devel, systemd, systemd-devel
-Requires: glibc >= 2.0.6, /etc/pam.d/system-auth, libpcap >= 14:0.8.3-6, systemd
+BuildRequires: pam-devel, libpcap-devel, openssl-devel, systemd, systemd-devel, glib2-devel
+Requires: glibc >= 2.0.6, /etc/pam.d/system-auth, libpcap >= 14:0.8.3-6, systemd, initscripts >= 9.54
 Requires(pre): /usr/bin/getent
 Requires(pre): /usr/sbin/groupadd
 
@@ -59,17 +68,21 @@ Group: Development/Libraries
 This package contains the header files for building plugins for ppp.
 
 %prep
-%autosetup -N
+%setup -q
 %autopatch -p1
 
+tar -xJf %{SOURCE12}
+
 %build
 export RPM_OPT_FLAGS="$RPM_OPT_FLAGS -fPIC -Wall"
 %configure
 make %{?_smp_mflags}
+make -C ppp-watch %{?_smp_mflags}
 
 %install
 make INSTROOT=%{buildroot} install install-etcppp
 find scripts -type f | xargs chmod a-x
+make ROOT=%{buildroot} -C ppp-watch install
 
 # create log files dir
 install -d %{buildroot}%{_localstatedir}/log/ppp
@@ -86,6 +99,19 @@ install -p %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/ppp
 install -d %{buildroot}%{_tmpfilesdir}
 install -p %{SOURCE3} %{buildroot}%{_tmpfilesdir}/ppp.conf
 
+# install scripts (previously owned by initscripts package)
+install -d %{buildroot}%{_sysconfdir}/ppp
+install -p %{SOURCE4} %{buildroot}%{_sysconfdir}/ppp/ip-down
+install -p %{SOURCE5} %{buildroot}%{_sysconfdir}/ppp/ip-down.ipv6to4
+install -p %{SOURCE6} %{buildroot}%{_sysconfdir}/ppp/ip-up
+install -p %{SOURCE7} %{buildroot}%{_sysconfdir}/ppp/ip-up.ipv6to4
+install -p %{SOURCE8} %{buildroot}%{_sysconfdir}/ppp/ipv6-down
+install -p %{SOURCE9} %{buildroot}%{_sysconfdir}/ppp/ipv6-up
+
+install -d %{buildroot}%{_sysconfdir}/sysconfig/network-scripts/
+install -p %{SOURCE10} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts/ifup-ppp
+install -p %{SOURCE11} %{buildroot}%{_sysconfdir}/sysconfig/network-scripts/ifdown-ppp
+
 %pre
 /usr/bin/getent group dip >/dev/null 2>&1 || /usr/sbin/groupadd -r -g 40 dip >/dev/null 2>&1 || :
 
@@ -99,6 +125,16 @@ install -p %{SOURCE3} %{buildroot}%{_tmpfilesdir}/ppp.conf
 %{_sbindir}/pppdump
 %{_sbindir}/pppoe-discovery
 %{_sbindir}/pppstats
+%{_sbindir}/ppp-watch
+%dir %{_sysconfdir}/ppp
+%{_sysconfdir}/ppp/ip-up
+%{_sysconfdir}/ppp/ip-down
+%{_sysconfdir}/ppp/ip-up.ipv6to4
+%{_sysconfdir}/ppp/ip-down.ipv6to4
+%{_sysconfdir}/ppp/ipv6-up
+%{_sysconfdir}/ppp/ipv6-down
+%{_sysconfdir}/sysconfig/network-scripts/ifdown-ppp
+%{_sysconfdir}/sysconfig/network-scripts/ifup-ppp
 %{_mandir}/man8/chat.8*
 %{_mandir}/man8/pppd.8*
 %{_mandir}/man8/pppdump.8*
@@ -106,8 +142,8 @@ install -p %{SOURCE3} %{buildroot}%{_tmpfilesdir}/ppp.conf
 %{_mandir}/man8/pppd-radius.8*
 %{_mandir}/man8/pppstats.8*
 %{_mandir}/man8/pppoe-discovery.8*
+%{_mandir}/man8/ppp-watch.8*
 %{_libdir}/pppd
-%dir %{_sysconfdir}/ppp
 %ghost %dir /run/ppp
 %ghost %dir /run/lock/ppp
 %dir %{_sysconfdir}/logrotate.d
@@ -128,6 +164,9 @@ install -p %{SOURCE3} %{buildroot}%{_tmpfilesdir}/ppp.conf
 %doc PLUGINS
 
 %changelog
+* Wed Apr 16 2014 Michal Sekletar <msekleta at redhat.com> - 2.4.6-4
+- move ppp initscripts to ppp package (#1088220)
+
 * Mon Apr 14 2014 Michal Sekletar <msekleta at redhat.com> - 2.4.6-3
 - don't require perl and expect (#1086846)
 
@@ -550,4 +589,3 @@ install -p %{SOURCE3} %{buildroot}%{_tmpfilesdir}/ppp.conf
 * Tue Mar 25 1997 Erik Troan <ewt at redhat.com>
 - Integrated new patch from David Mosberger
 - Improved description
-
diff --git a/sources b/sources
index ef627c3..21fd763 100644
--- a/sources
+++ b/sources
@@ -1 +1,2 @@
 3434d2cc9327167a0723aaaa8670083b  ppp-2.4.6.tar.gz
+166cdfbce3391746fde60e86752c7bc7  ppp-watch.tar.xz


More information about the scm-commits mailing list