From 27bde52cb6f20f18e65800b3aebaf0676404fd69c72ab3140c66cf7c1f3b66f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Sat, 4 May 2024 00:07:31 +0200 Subject: [PATCH] Sync from SUSE:SLFO:Main rp-pppoe revision cb93892187eef2ef7d9b07ada695af7a --- .gitattributes | 23 ++ pppoe-connect | 398 ++++++++++++++++++++++++++++++ pppoe-server.service | 10 + pppoe-setup | 485 +++++++++++++++++++++++++++++++++++++ pppoe-start | 228 +++++++++++++++++ pppoe-status | 105 ++++++++ pppoe-stop | 143 +++++++++++ pppoe.service | 13 + rp-pppoe-3.14-docdir.patch | 12 + rp-pppoe-4.0.tar.gz | 3 + rp-pppoe.changes | 404 ++++++++++++++++++++++++++++++ rp-pppoe.spec | 110 +++++++++ 12 files changed, 1934 insertions(+) create mode 100644 .gitattributes create mode 100644 pppoe-connect create mode 100644 pppoe-server.service create mode 100644 pppoe-setup create mode 100644 pppoe-start create mode 100644 pppoe-status create mode 100644 pppoe-stop create mode 100644 pppoe.service create mode 100644 rp-pppoe-3.14-docdir.patch create mode 100644 rp-pppoe-4.0.tar.gz create mode 100644 rp-pppoe.changes create mode 100644 rp-pppoe.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/pppoe-connect b/pppoe-connect new file mode 100644 index 0000000..240a8ff --- /dev/null +++ b/pppoe-connect @@ -0,0 +1,398 @@ +#!/bin/bash +# Generated automatically from pppoe-connect.in by configure. +#*********************************************************************** +# +# pppoe-connect +# +# Shell script to connect to an PPPoE provider using PPPoE +# +# Copyright (C) 2000 Roaring Penguin Software Inc. +# +# $Id$ +# +# This file may be distributed under the terms of the GNU General +# Public License. +# +# Usage: pppoe-connect [config_file] +# pppoe-connect interface user [config_file] +# Second form overrides USER and ETH from config file. +# If config_file is omitted, defaults to /etc/ppp/pppoe.conf +# +#*********************************************************************** + +# From AUTOCONF +prefix=/usr +exec_prefix=/usr +localstatedir=/var + +# Paths to programs +IP=/usr/sbin/ip +PPPD=/usr/sbin/pppd +SETSID=/usr/bin/setsid +PPPOE=/usr/sbin/pppoe +BR2684CTL=/usr/sbin/br2684ctl +LOGGER="/usr/bin/logger -t `basename $0`" +NETWORKDIR=/etc/sysconfig/network +LS=/usr/bin/ls + +get_device() { + if [ ! -d $NETWORKDIR ] ; then + $ECHO "** $NETWORKDIR not found" + $ECHO "** Quitting" + exit 1 + fi + + cd $NETWORKDIR + interfaces=$($LS ifcfg-ppp* 2>/dev/null | grep -E -v '(~|\.bak)$' | \ + grep -E -v '(rpmsave|rpmorig|rpmnew)' | sed 's/^ifcfg-//g') + + for i in $interfaces ; do + test -f ifcfg-$i && . ifcfg-$i 2>/dev/null + if [ "$TYPE" = "xDSL" ] ; then + CONFIG=$NETWORKDIR/ifcfg-$i + break + fi + done +} + +# Set to "C" locale so we can parse messages from commands +LANG=C +export LANG + +# Must be root +if test "`/usr/bin/id -u`" != 0 ; then + echo "$0: You must be root to run this script" >& 2 + exit 1 +fi + +if test "$SETSID" != "" -a ! -x "$SETSID"; then + SETSID="" +fi + +USER="" +ETH="" + +# Sort out command-line arguments +case "$#" in + 1) + CONFIG="$1" + ;; + 3) + CONFIG="$3" + ;; +esac + +if [ -z "$CONFIG" ] ; then + get_device + [ -z "$CONFIG" ] && CONFIG=/etc/ppp/pppoe.conf +fi + +if test ! -f "$CONFIG" -o ! -r "$CONFIG" ; then + echo "$0: Cannot read configuration file '$CONFIG'" >& 2 + exit 1 +fi + +export CONFIG +. $CONFIG + +DEVNAME="$DEVICE" +PPPOE_PIDFILE="$PIDFILE.pppoe" +PPPD_PIDFILE="$PIDFILE.pppd" + +if [ "$CONFIG" != "/etc/ppp/pppoe.conf" ] ; then + DEVNAME=`basename $CONFIG | sed 's/^ifcfg-//g'` +fi + +if [ -n "$BR2684DEV" ]; then + [ -z "$ETH" ] && ETH="nas$BR2684DEV" + modprobe br2684 > /dev/null 2>&1 +fi + +# Check for command-line overriding of ETH and USER +case "$#" in + 2|3) + ETH="$1" + USER="$2" + ;; +esac + +# Check that config file is sane +if test "$USER" = "" ; then + echo "$0: Check '$CONFIG' -- no setting for USER" >& 2 + exit 1 +fi +if test "`basename \"$LINUX_PLUGIN\"`" = "pppoatm.so" ; then + if test "$VCI" = "" ; then + echo "$0: Check '$CONFIG' -- no setting for VCI" >& 2 + exit 1 + fi + if test "$VPI" = "" ; then + echo "$0: Check '$CONFIG' -- no setting for VPI" >& 2 + exit 1 + fi +else + if test "$ETH" = "" ; then + echo "$0: Check '$CONFIG' -- no setting for ETH" >& 2 + exit 1 + fi +fi + +PPPD_PID=0 + +# Catch common error +if test "$DEBUG" = "1" ; then + echo "*** If you want to use DEBUG, invoke pppoe-start, not pppoe-connect." + exit 1 +fi + +if test "$DEBUG" != "" ; then + if test "$LINUX_PLUGIN" != "" ; then + echo "Cannot use DEBUG mode and LINUX_PLUGIN at the same time." + echo "Kernel-mode PPPoE is experimental and unsupported." + exit 1 + fi + echo "* The following section identifies your Ethernet interface" >> $DEBUG + echo "* and user name. Some ISP's need 'username'; others" >> $DEBUG + echo "* need 'username@isp.com'. Try both" >> $DEBUG + echo "ETH=$ETH; USER=$USER" >> $DEBUG + echo "---------------------------------------------" >> $DEBUG +fi + +# MTU of Ethernet card attached to modem MUST be 1500. This apparently +# fails on some *BSD's, so we'll only do it under Linux + +if test `uname -s` = Linux ; then + $IP link set $ETH up mtu 1500 + # For 2.4 kernels. Will fail on 2.2.x, but who cares? + modprobe ppp_generic > /dev/null 2>&1 + modprobe ppp_async > /dev/null 2>&1 + modprobe ppp_synctty > /dev/null 2>&1 + if test -n "$LINUX_PLUGIN" ; then + modprobe pppox > /dev/null 2>&1 + modprobe pppoe > /dev/null 2>&1 + fi +fi + +if test "$SYNCHRONOUS" = "yes" ; then + PPPOE_SYNC=-s + PPPD_SYNC=sync + # Increase the chances of it working on Linux... + if test `uname -s` = Linux ; then + modprobe n_hdlc > /dev/null 2>&1 + fi +else + PPPOE_SYNC="" + PPPD_SYNC="" +fi + +if test -n "$ACNAME" ; then + ACNAME="-C $ACNAME" +fi + +if test -n "$SERVICENAME" ; then + SERVICENAMEOPT="-S $SERVICENAME" +else + SERVICENAMEOPT="" +fi + +if test "$CLAMPMSS" = "no" ; then + CLAMPMSS="" +else + CLAMPMSS="-m $CLAMPMSS" +fi + +# If DNSTYPE is SERVER, we must use "usepeerdns" option to pppd. +if test "$DNSTYPE" = "SERVER" ; then + PEERDNS=yes + USEPEERDNS=yes +fi + +if test "$PEERDNS" = "yes" ; then + PEERDNS="usepeerdns" +else + PEERDNS="" +fi + +# Backward config file compatibility -- PEERDNS used to be USEPEERDNS +if test "$USEPEERDNS" = "yes" ; then + PEERDNS="usepeerdns" +fi +if test "$USEPEERDNS" = "no" ; then + PEERDNS="" +fi + +if [ -z "$DEVICE" ] ; then + IPPARAM="" + LINKNAME="" +else + IPPARAM="ipparam ${DEVNAME}" + LINKNAME="linkname ${DEVICE}" +fi + +[ -z "$MTU" ] && MTU="1492" +[ -z "$MRU" ] && MRU="1492" + +# Backward config file compatibility +if test "$DEMAND" = "" ; then + DEMAND=no +fi + +if test "$DEMAND" = "no" ; then + DEMAND="" +else + [ -z "$IPADDR" ] && IPADDR=10.112.112.112 + [ -z "$REMIP" ] && REMIP=10.112.112.113 + + DEMAND="demand persist idle $CONNECT_TIMEOUT $IPADDR:$REMIP ipcp-accept-remote ipcp-accept-local noipdefault ktune" + # The plugin doesn't need (and may not _accept_) the 'connect' option + if [ -z "$LINUX_PLUGIN" ]; then + DEMAND="$DEMAND connect true" + fi +fi + +case "$FIREWALL" in + STANDALONE) + . /etc/ppp/firewall-standalone + ;; + MASQUERADE) + . /etc/ppp/firewall-masq + ;; +esac + +# If we're using kernel-mode PPPoE on Linux... +if test "`basename \"$LINUX_PLUGIN\"`" = "rp-pppoe.so" ; then + PLUGIN_OPTS="plugin $LINUX_PLUGIN nic-$ETH" + if test -n "$SERVICENAME" ; then + PLUGIN_OPTS="$PLUGIN_OPTS rp_pppoe_service $SERVICENAME" + fi + modprobe pppoe > /dev/null 2>&1 +fi +# If we're using kernel-mode PPPoATM on Linux... +if test "`basename \"$LINUX_PLUGIN\"`" = "pppoatm.so" ; then + PLUGIN_OPTS="plugin $LINUX_PLUGIN" + + # Interface name MUST BE LAST!! + PLUGIN_OPTS="$PLUGIN_OPTS $VPI.$VCI" + modprobe pppoatm > /dev/null 2>&1 +fi +if test "$DEFROUTE" != "no" ; then + DEFAULTROUTE="defaultroute" + # 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) + [ -n "${DEFRT}" ] && echo "$DEFRT" > /etc/default-routes + echo "$DEFRT" | while read spec; do + $IP route del $spec; + done +else + DEFAULTROUTE="" +fi + +# Standard PPP options we always use +PPP_STD_OPTIONS="$IPPARAM $LINKNAME $PLUGIN_OPTS noipdefault noauth default-asyncmap $DEFAULTROUTE hide-password nodetach $PEERDNS mtu $MTU mru $MRU noaccomp nodeflate nopcomp novj novjccomp user $USER lcp-echo-interval $LCP_INTERVAL lcp-echo-failure $LCP_FAILURE $PPPD_EXTRA" + +# PPPoE invocation +PPPOE_CMD="$PPPOE -p $PPPOE_PIDFILE -I $ETH -T $PPPOE_TIMEOUT -U $PPPOE_SYNC $CLAMPMSS $ACNAME $SERVICENAMEOPT $PPPOE_EXTRA" +if test "$DEBUG" != "" ; then + if test "$DEMAND" != "" ; then + echo "(Turning off DEMAND for debugging purposes)" + DEMAND="" + fi + echo "* The following section shows the pppd command we will invoke" >> $DEBUG + echo "pppd invocation" >> $DEBUG + echo "$SETSID $PPPD pty '$PPPOE_CMD' $PPP_STD_OPTIONS $PPPD_SYNC debug" >> $DEBUG + echo "---------------------------------------------" >> $DEBUG + $SETSID $PPPD pty "$PPPOE_CMD -D $DEBUG-0" \ + $PPP_STD_OPTIONS \ + $PPPD_SYNC \ + debug >> $DEBUG 2>&1 + echo "---------------------------------------------" >> $DEBUG + echo "* The following section is an extract from your log." >> $DEBUG + echo "* Look for error messages from pppd, such as" >> $DEBUG + echo "* a lack of kernel support for PPP, authentication failure" >> $DEBUG + echo "* etc." >> $DEBUG + if test -f "/var/log/messages" ; then + echo "Extract from /var/log/messages" >> $DEBUG + grep 'ppp' /var/log/messages | tail -150 >> $DEBUG + elif test -f "/var/adm/messages"; then + echo "Extract from /var/adm/messages" >> $DEBUG + grep 'ppp' /var/adm/messages | tail -150 >> $DEBUG + else + echo "Can't find messages file (looked for /var/{log,adm}/messages" >> $DEBUG + fi + date >> $DEBUG + echo "---------------------------------------------" >> $DEBUG + echo "* The following section is a dump of the packets" >> $DEBUG + echo "* sent and received by rp-pppoe. If you don't see" >> $DEBUG + echo "* any output, it's an Ethernet driver problem. If you only" >> $DEBUG + echo "* see three PADI packets and nothing else, check your cables" >> $DEBUG + echo "* and modem. Make sure the modem lights flash when you try" >> $DEBUG + echo "* to connect. Check that your Ethernet card is in" >> $DEBUG + echo "* half-duplex, 10Mb/s mode. If all else fails," >> $DEBUG + echo "* try using pppoe-sniff." >> $DEBUG + echo "rp-pppoe debugging dump" >> $DEBUG + cat $DEBUG-0 >> $DEBUG + rm -f $DEBUG-0 + for i in 1 2 3 4 5 6 7 8 9 10 ; do + echo "" + echo "" + echo "" + done + echo "*** Finished debugging run. Please review the file" + echo "*** '$DEBUG' and try to" + echo "*** figure out what is going on." + echo "***" + echo "*** Unfortunately, we can NO LONGER accept debugging" + echo "*** output for analysis. Please do not send this to" + echo "*** Roaring Penguin; it is too time-consuming for" + echo "*** us to deal with all the analyses we have been sent." + exit 0 +fi + +echo $$ > $PIDFILE + +while [ true ] ; do + if [ "${DEFROUTE}" != "no" ] ; then + DEFRT=$(ip route list match 0/0) + [ -n "${DEFRT}" ] && echo "$DEFRT" > /etc/default-routes + echo "$DEFRT" | while read spec; do + $IP route del $spec; + done + fi + + if test "$BR2684DEV" != ""; then + $BR2684CTL -b -c $BR2684DEV -a $VPI.$VCI + $IP link set $ETH up + fi + if test "$OVERRIDE_PPPD_COMMAND" != "" ; then + $SETSID $OVERRIDE_PPPD_COMMAND & + echo "$!" > $PPPD_PIDFILE + elif test "$LINUX_PLUGIN" != "" ; then + $SETSID $PPPD $PPP_STD_OPTIONS $DEMAND & + echo "$!" > $PPPD_PIDFILE + else + $SETSID $PPPD pty "$PPPOE_CMD" \ + $PPP_STD_OPTIONS \ + $DEMAND \ + $PPPD_SYNC & + echo "$!" > $PPPD_PIDFILE + fi + wait + if test "$BR2684DEV" != ""; then + kill `cat /run/nas$BR2684DEV.pid` + rm /run/nas$BR2684DEV.pid + fi + + if test "$RETRY_ON_FAILURE" = "no" ; then + exit + fi + + # Run /etc/ppp/adsl-lost if it exists + test -x /etc/ppp/adsl-lost && /etc/ppp/adsl-lost + + # Re-establish the connection + $LOGGER -p daemon.notice "PPPoE connection lost; attempting re-connection." + + # Wait a bit in case a problem causes tons of log messages :-) + sleep 5 +done diff --git a/pppoe-server.service b/pppoe-server.service new file mode 100644 index 0000000..7011fb8 --- /dev/null +++ b/pppoe-server.service @@ -0,0 +1,10 @@ +[Unit] +Description=PPPoE Server. +After=syslog.target + +[Service] +Group=dialout +ExecStart=/usr/sbin/pppoe-server + +[Install] +WantedBy=multi-user.target diff --git a/pppoe-setup b/pppoe-setup new file mode 100644 index 0000000..b8deb00 --- /dev/null +++ b/pppoe-setup @@ -0,0 +1,485 @@ +#!/bin/bash +#*********************************************************************** +# +# pppoe-setup +# +# All-purpose slicing/dicing shell script to configure rp-pppoe. +# +# Copyright (C) 2000 Roaring Penguin Software Inc. +# +# $Id$ +#*********************************************************************** + +# Paths to programs and config files +IP=/usr/sbin/ip +PPPD=/usr/sbin/pppd +PPPOE=/usr/sbin/pppoe +ECHO=/usr/bin/echo +LS=/usr/bin/ls +ID=/usr/bin/id +NETWORKDIR=/etc/sysconfig/network +PAPFILE=/etc/ppp/chap-secrets +CHAPFILE=/etc/ppp/pap-secrets +RESOLVFILE=/etc/resolv.conf + +# Set to "C" locale so we can parse messages from commands +LANG=C +export LANG + +# Protect created files +umask 077 + +copy() { + cp $1 $2 + if [ "$?" != 0 ] ; then + $ECHO "*** Error copying $1 to $2" + $ECHO "*** Quitting." + exit 1 + fi +} + +get_device() { + if [ ! -d $NETWORKDIR ] ; then + $ECHO "** $NETWORKDIR not found" + $ECHO "** Quitting" + exit 1 + fi + + cd $NETWORKDIR + interfaces=$($LS ifcfg-ppp* 2>/dev/null | grep -E -v '(~|\.bak)$' | \ + grep -E -v '(rpmsave|rpmorig|rpmnew)' | sed 's/^ifcfg-//g') + + for i in $interfaces ; do + test -f ifcfg-$i && . ifcfg-$i 2>/dev/null + if [ "$TYPE" = "xDSL" ] ; then + device_count=$[$device_count+1] + devices="$devices $DEVICE" + fi + done +} + +clear_env() { + unset USERCTL BOOTPROTO NAME DEVICE TYPE ONBOOT FIREWALL PING \ + PPPOE_TIMEOUT LCP_FAILURE LCP_INTERVAL CLAMPMSS CONNECT_POLL \ + CONNECT_TIMEOUT DEFROUTE SYNCHRONOUS ETH PROVIDER USER PEERDNS \ + DNS1 DNS2 +} + + +clear + +$ECHO "Welcome to the PPPoE client setup. First, I will run some checks on" +$ECHO "your system to make sure the PPPoE client is installed properly..." +$ECHO "" + +# Must be root +if [ "`$ID -u`" != 0 ] ; then + $ECHO "$0: Sorry, you must be root to run this script" + exit 1 +fi + +# Must have pppd +if [ ! -x $PPPD ] ; then + $ECHO "Oops, I can't execute the program '$PPPD'. You" + $ECHO "must install the PPP software suite, version 2.3.10 or later." + exit 1 +fi + +# get the DSL config files in /etc/sysconfig/network +devices="" +device_count=0 +get_device + +if [ $device_count -gt 0 ] ; then + $ECHO "The following DSL config was found on your system:" + $ECHO "" + $ECHO " Device: Name:" + + for i in $devices ; do + . $NETWORKDIR/ifcfg-$i + $ECHO " $i $NAME" + done + + $ECHO "" + + for i in $devices ; do + default_device=$i + break + done + + clear_env + + while [ true ] ; do + $ECHO "Please enter the device if you want to configure the present DSL config" + $ECHO -n "(default $default_device) or enter 'n' if you want to create a new one: " + + read dev + + if [ "$dev" = "n" ] ; then + i=0 + while true; do + found=0 + for j in $interfaces ; do + if [ "$j" = "ppp$i" ] ; then + found=1 + break + fi + done + if [ $found -eq 0 ] ; then + dsl_device="ppp$i" + break + fi + i=$[$i+1] + done + if [ -z "$dsl_device" ]; then + dev=0 + while [ -e $NETWORKDIR/ifcfg-ppp$dev ]; do + dev=`expr $dev + 1` + done + dsl_device="ppp$dev" + fi + break + else + if [ -n "$default_device" ] ; then + if [ -n "$dev" ] ; then + dsl_device="$dev" + else + dsl_device="$default_device" + fi + fi + for i in $devices ; do + [ "$dsl_device" = "$i" ] && break + done + if [ "$dsl_device" = "$i" ] ; then + break + fi + $ECHO "Device '$dsl_device' is not found in the list, please choose the correct one" + fi + done +else + dev=0 + while [ -e $NETWORKDIR/ifcfg-ppp$dev ]; do + dev=`expr $dev + 1` + done + dsl_device="ppp$dev" +fi + +CONFIG="$NETWORKDIR/ifcfg-$dsl_device" +DEVICE=$dsl_device +export CONFIG + +[ "$dev" = "n" ] || . $CONFIG 2>/dev/null +[ "$DEMAND" = "" ] && DEMAND=no + +while [ true ] ; do + $ECHO "" + $ECHO "LOGIN NAME" + $ECHO "" + if [ -z "$USER" ] ; then + $ECHO -n "Enter your Login Name: " + else + $ECHO -n "Enter your Login Name (default $USER): " + fi + + read U + + if [ -z "$U" ] ; then + if [ -z "$USER" ] ; then + continue + fi + else + USER="$U" + fi + + + # Under Linux, "fix" the default interface if eth1 is not available + [ -n "$ETH" ] || ETH=eth0 + if test `uname -s` = "Linux" ; then + $IP link show $ETH > /dev/null 2>&1 || ETH=eth0 + fi + $ECHO "" + $ECHO "INTERFACE" + $ECHO "" + $ECHO "Enter the Ethernet interface connected to the PPPoE modem" + $ECHO "For Solaris, this is likely to be something like /dev/hme0." + $ECHO "For Linux, it will be ethX, where 'X' is a number." + $ECHO -n "(default $ETH): " + read E + + if [ -n "$E" ] ; then + ETH="$E" + fi + + $ECHO "" + $ECHO "Do you want the link to come up on demand, or stay up continuously?" + $ECHO "If you want it to come up on demand, enter the idle time in seconds" + $ECHO "after which the link should be dropped. If you want the link to" + $ECHO "stay up permanently, enter 'no' (two letters, lower-case.)" + $ECHO "NOTE: Demand-activated links do not interact well with dynamic IP" + $ECHO "addresses. You may have some problems with demand-activated links." + $ECHO -n "Enter the demand value (default $DEMAND): " + read D + if [ -n "$D" ] ; then + DEMAND="$D" + fi + + $ECHO "" + $ECHO "DNS" + $ECHO "" + $ECHO "Please enter the IP address of your ISP's primary DNS server." + $ECHO "If your ISP claims that 'the server will provide dynamic DNS addresses'," + $ECHO "enter 'server' (all lower-case) here." + $ECHO "If you just press enter, I will assume you know what you are" + $ECHO "doing and not modify your DNS setup." + $ECHO -n "Enter the DNS information here: " + + read DNS1 + + + if [ -n "$DNS1" ] ; then + if [ "$DNS1" != "server" ] ; then + $ECHO "Please enter the IP address of your ISP's secondary DNS server." + $ECHO "If you just press enter, I will assume there is only one DNS server." + $ECHO -n "Enter the secondary DNS server address here: " + read DNS2 + fi + fi + + while [ true ] ; do + $ECHO "" + $ECHO "PASSWORD" + $ECHO "" + stty -echo + $ECHO -n "Please enter your Password: " + read PWD1 + $ECHO "" + $ECHO -n "Please re-enter your Password: " + read PWD2 + $ECHO "" + stty echo + if [ "$PWD1" = "$PWD2" ] ; then + break + fi + + $ECHO -n "Sorry, the passwords do not match. Try again? (y/n)" + read ANS + case "$ANS" in + N|No|NO|Non|n|no|non) + $ECHO "OK, quitting. Bye." + exit 1 + esac + done + + # Usercontrol + $ECHO "" + $ECHO "USERCTRL" + $ECHO + $ECHO "Please enter 'yes' (three letters, lower-case.) if you want to allow" + $ECHO -n "normal user to start or stop DSL connection (default yes): " + + read USERCTL + + if [ -z "$USERCTL" ] ; then + USERCTL="yes" + fi + + # Firewalling + $ECHO "" + $ECHO "FIREWALLING" + $ECHO "" + if test `uname -s` != "Linux" ; then + $ECHO "Sorry, firewalling is only supported under Linux. Consult" + $ECHO "your operating system manuals for details on setting up" + $ECHO "packet filters for your system." + FIREWALL=NONE + else + $ECHO "Please choose the firewall rules to use. Note that these rules are" + $ECHO "very basic. You are strongly encouraged to use a more sophisticated" + $ECHO "firewall setup; however, these will provide basic security. If you" + $ECHO "are running any servers on your machine, you must choose 'NONE' and" + $ECHO "set up firewalling yourself. Otherwise, the firewall rules will deny" + $ECHO "access to all standard servers like Web, e-mail, ftp, etc. If you" + $ECHO "are using SSH, the rules will block outgoing SSH connections which" + $ECHO "allocate a privileged source port." + $ECHO "" + while [ true ] ; do + $ECHO "The firewall choices are:" + $ECHO "0 - NONE: This script will not set any firewall rules. You are responsible" + $ECHO " for ensuring the security of your machine. You are STRONGLY" + $ECHO " recommended to use some kind of firewall rules." + $ECHO "1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation" + $ECHO "2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway" + $ECHO " for a LAN" + $ECHO -n "Choose a type of firewall (0-2): " + read a + if [ "$a" = 0 -o "$a" = 1 -o "$a" = 2 ] ; then + break + fi + $ECHO "Please enter a number from 0 to 2" + done + + case "$a" in + 0) + FIREWALL=NONE + ;; + 1) + FIREWALL=STANDALONE + ;; + 2) + FIREWALL=MASQUERADE + ;; + esac + fi + + $ECHO "" + $ECHO "Start this connection at boot time" + $ECHO "" + $ECHO "Do you want to start this connection at boot time?" + $ECHO -n "Please enter no or yes (default no):" + read boot + case "$boot" in + yes|YES) ONBOOT="yes";; + *) ONBOOT="no";; + esac + + $ECHO "" + $ECHO "** Summary of what you entered **" + $ECHO "" + $ECHO "Ethernet Interface: $ETH" + $ECHO "User name: $USER" + if [ "$DEMAND" = "no" ] ; then + $ECHO "Activate-on-demand: No" + else + $ECHO "Activate-on-demand: Yes; idle timeout = $DEMAND seconds" + fi + + if [ -n "$DNS1" ] ; then + if [ "$DNS1" = "server" ] ; then + $ECHO "DNS addresses: Supplied by ISP's server" + else + $ECHO "Primary DNS: $DNS1" + if [ -n "$DNS2" ] ; then + $ECHO "Secondary DNS: $DNS2" + fi + fi + else + $ECHO "DNS: Do not adjust" + fi + $ECHO "Firewalling: $FIREWALL" + $ECHO "User Control: $USERCTL" + while [ true ] ; do + $ECHO -n 'Accept these settings and adjust configuration files (y/n)? ' + read ANS + case "ANS" in + Y|y|yes|Yes|oui|Oui) + ANS=y + ;; + N|n|no|No|non|Non) + ANS=n + ;; + esac + if [ "$ANS" = "y" -o "$ANS" = "n" ] ; then + break + fi + done + if [ "$ANS" = "y" ] ; then + break + fi +done + +# Adjust configuration files. First to $CONFIG + +$ECHO "Adjusting $CONFIG" + +test -f $CONFIG && copy $CONFIG $CONFIG.bak +if [ "$DNS1" = "server" ] ; then + DNS1="" + DNS2="" + PEERDNS=yes +else + PEERDNS=no +fi + +$ECHO "USERCTL=$USERCTL" >$CONFIG +$ECHO "BOOTPROTO=dialup" >>$CONFIG +[ -z "$NAME" ] && NAME="DSL$DEVICE" +$ECHO "NAME=DSL$DEVICE" >>$CONFIG +$ECHO "DEVICE=$DEVICE" >>$CONFIG +$ECHO "TYPE=xDSL" >>$CONFIG +$ECHO "ONBOOT=$ONBOOT" >>$CONFIG +$ECHO "PIDFILE=/run/pppoe-adsl.pid" >>$CONFIG +$ECHO "FIREWALL=$FIREWALL" >>$CONFIG +[ -z "$PING" ] && PING="." +$ECHO "PING=$PING" >>$CONFIG +[ -z "$PPPOE_TIMEOUT" ] && PPPOE_TIMEOUT=80 +$ECHO "PPPOE_TIMEOUT=$PPPOE_TIMEOUT" >>$CONFIG +[ -z "$LCP_FAILURE" ] && LCP_FAILURE=3 +$ECHO "LCP_FAILURE=$LCP_FAILURE" >>$CONFIG +[ -z "$LCP_INTERVAL" ] && LCP_INTERVAL=20 +$ECHO "LCP_INTERVAL=$LCP_INTERVAL" >>$CONFIG +[ -z "$CLAMPMSS" ] && CLAMPMSS=1412 +$ECHO "CLAMPMSS=$CLAMPMSS" >>$CONFIG +[ -z "$CONNECT_POLL" ] && CONNECT_POLL=6 +$ECHO "CONNECT_POLL=$CONNECT_POLL" >>$CONFIG +[ -z "$CONNECT_TIMEOUT" ] && CONNECT_TIMEOUT=60 +$ECHO "CONNECT_TIMEOUT=$CONNECT_TIMEOUT" >>$CONFIG +[ -z "$DEFROUTE" ] && DEFROUTE=yes +$ECHO "DEFROUTE=$DEFROUTE" >>$CONFIG +[ -z "$SYNCHRONOUS" ] && SYNCHRONOUS=no +$ECHO "SYNCHRONOUS=$SYNCHRONOUS" >>$CONFIG +$ECHO "ETH=$ETH" >> $CONFIG +[ -z "$PROVIDER" ] && PROVIDER="$NAME" +$ECHO "PROVIDER=$PROVIDER" >>$CONFIG +$ECHO "USER=$USER" >>$CONFIG +$ECHO "PEERDNS=$PEERDNS" >>$CONFIG +$ECHO "DEMAND=$DEMAND" >>$CONFIG + +if [ -n "$DNS1" ] ; then + if [ "$DNS1" != "server" ] ; then + $ECHO "Adjusting $RESOLVFILE" + if [ -r $RESOLVFILE ] ; then + grep -s "MADE-BY-RP-PPPOE" $RESOLVFILE > /dev/null 2>&1 + if [ "$?" != 0 ] ; then + $ECHO " (But first backing it up to $RESOLVFILE.bak)" + test -f $$RESOLVFILE && copy $RESOLVFILE $RESOLVFILE.bak + fi + fi + $ECHO "# MADE-BY-RP-PPPOE" > $RESOLVFILE + $ECHO "nameserver $DNS1" >> $RESOLVFILE + if [ -n "$DNS2" ] ; then + $ECHO "nameserver $DNS2" >> $RESOLVFILE + fi + fi +fi + +$ECHO "Adjusting $PAPFILE and $CHAPFILE" +if [ -r $PAPFILE ] ; then + $ECHO " (But first backing it up to $PAPFILE.bak)" + test -f $PAPFILE && copy $PAPFILE $PAPFILE.bak +else + cp /dev/null $PAPFILE.bak +fi +if [ -r $CHAPFILE ] ; then + $ECHO " (But first backing it up to $CHAPFILE.bak)" + test -f $CHAPFILE && copy $CHAPFILE $CHAPFILE.bak +else + cp /dev/null $CHAPFILE.bak +fi + +grep -E -v "^$USER|^\"$USER\"" $PAPFILE.bak > $PAPFILE +$ECHO "\"$USER\" * \"$PWD1\"" >> $PAPFILE +grep -E -v "^$USER|^\"$USER\"" $CHAPFILE.bak > $CHAPFILE +$ECHO "\"$USER\" * \"$PWD1\"" >> $CHAPFILE + +$ECHO "" +$ECHO "" +$ECHO "" +$ECHO "Congratulations, it should be all set up!" +$ECHO "" +$ECHO "Type '/usr/sbin/ifup $dsl_device' to bring up your xDSL link and '/sbin/ifdown $dsl_device'" +$ECHO "to bring it down." +$ECHO "Type '/usr/sbin/pppoe-status $NETWORKDIR/ifcfg-$dsl_device'" +$ECHO "to see the link status." +$ECHO "" + +exit 0 diff --git a/pppoe-start b/pppoe-start new file mode 100644 index 0000000..349e2c6 --- /dev/null +++ b/pppoe-start @@ -0,0 +1,228 @@ +#!/bin/bash +# Generated automatically from pppoe-start.in by configure. +#*********************************************************************** +# +# pppoe-start +# +# Shell script to bring up an PPPoE connection +# +# Copyright (C) 2000 Roaring Penguin Software Inc. +# +# $Id$ +# +# This file may be distributed under the terms of the GNU General +# Public License. +# +# Usage: pppoe-start [config_file] +# pppoe-start interface user [config_file] +# Second form overrides USER and ETH from config file. +# If config_file is omitted, defaults to /etc/ppp/pppoe.conf +# +#*********************************************************************** + +# From AUTOCONF +prefix=/usr +exec_prefix=/usr + +# Paths to programs +CONNECT=/usr/sbin/pppoe-connect +STATUS=/usr/sbin/pppoe-status +ECHO=/usr/bin/echo +IP=/usr/sbin/ip +LS=/usr/bin/ls +NETWORKDIR=/etc/sysconfig/network + +get_device() { + if [ ! -d $NETWORKDIR ] ; then + $ECHO "** $NETWORKDIR not found" + $ECHO "** Quitting" + exit 1 + fi + + cd $NETWORKDIR + interfaces=$($LS ifcfg-ppp* 2>/dev/null | grep -E -v '(~|\.bak)$' | \ + grep -E -v '(rpmsave|rpmorig|rpmnew)' | sed 's/^ifcfg-//g') + + for i in $interfaces ; do + test -f ifcfg-$i && . ifcfg-$i 2>/dev/null + if [ "$TYPE" = "xDSL" ] ; then + CONFIG=$NETWORKDIR/ifcfg-$i + break + fi + done +} + +# Set to "C" locale so we can parse messages from commands +LANG=C +export LANG + +# Defaults +USER="" +ETH="" +ME=`basename $0` + +# Must be root +if [ "`/usr/bin/id -u`" != 0 ] ; then + [ "$DEBUG" = "1" ] && $ECHO "$ME: You must be root to run this script" >& 2 + exit 1 +fi + +# Debugging +if [ "$DEBUG" = "1" ] ; then + $ECHO "*** Running in debug mode... please be patient..." + DEBUG=`mktemp -d /tmp/pppoe-debug-XXXXXXXX` + if [ $? -ne 0 ] ; then + $ECHO "Could not create directory $DEBUG... exiting" + exit 1 + fi + export DEBUG + DEBUG=$DEBUG/pppoe-debug.txt + + # Initial debug output + $ECHO "---------------------------------------------" > $DEBUG + $ECHO "* The following section contains information about your system" >> $DEBUG + date >> $DEBUG + $ECHO "Output of uname -a" >> $DEBUG + uname -a >> $DEBUG + $ECHO "---------------------------------------------" >> $DEBUG + $ECHO "* The following section contains information about your network" >> $DEBUG + $ECHO "* interfaces. The one you chose for PPPoE should contain the words:" >> $DEBUG + $ECHO "* 'UP' and 'RUNNING'. If it does not, you probably have an Ethernet" >> $DEBUG + $ECHO "* driver problem." >> $DEBUG + $ECHO "Output of ip addr show" >> $DEBUG + $IP addr show >> $DEBUG + $ECHO "---------------------------------------------" >> $DEBUG + if [ "`uname -s`" = "Linux" ] ; then + $ECHO "* The following section contains information about kernel modules" >> $DEBUG + $ECHO "* If the module for your Ethernet card is 'tulip', you might" >> $DEBUG + $ECHO "* want to look for an updated version at http://www.scyld.com" >> $DEBUG + $ECHO "Output of lsmod" >> $DEBUG + lsmod >> $DEBUG + $ECHO "---------------------------------------------" >> $DEBUG + fi + $ECHO "* The following section lists your routing table." >> $DEBUG + $ECHO "* If you have an entry which starts with '0.0.0.0', you probably" >> $DEBUG + $ECHO "* have defined a default route and gateway, and pppd will" >> $DEBUG + $ECHO "* not create a default route using your ISP. Try getting" >> $DEBUG + $ECHO "* rid of this route." >> $DEBUG + $ECHO "Output of ip route" >> $DEBUG + $IP route >> $DEBUG + $ECHO "---------------------------------------------" >> $DEBUG + $ECHO "Contents of /etc/resolv.conf" >> $DEBUG + $ECHO "* The following section lists DNS setup." >> $DEBUG + $ECHO "* If you can browse by IP address, but not name, suspect" >> $DEBUG + $ECHO "* a DNS problem." >> $DEBUG + cat /etc/resolv.conf >> $DEBUG + $ECHO "---------------------------------------------" >> $DEBUG + $ECHO "* The following section lists /etc/ppp/options." >> $DEBUG + $ECHO "* You should have NOTHING in that file." >> $DEBUG + $ECHO "Contents of /etc/ppp/options" >> $DEBUG + cat /etc/ppp/options >> $DEBUG 2>/dev/null + $ECHO "---------------------------------------------" >> $DEBUG + DEBUG="1" +fi + +# Sort out command-line arguments +case "$#" in + 1) + CONFIG="$1" + ;; + 3) + CONFIG="$3" + ;; +esac + +if [ -z "$CONFIG" ] ; then + get_device + [ -z "$CONFIG" ] && CONFIG=/etc/ppp/pppoe.conf +fi + +if [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then + [ "$DEBUG" = "1" ] && $ECHO "$ME: Cannot read configuration file '$CONFIG'" >& 2 + exit 1 +fi + +export CONFIG +. $CONFIG + +# Check for command-line overriding of ETH and USER +case "$#" in + 2|3) + ETH="$1" + USER="$2" + ;; +esac + +# Check for pidfile +if [ -r "$PIDFILE" ] ; then + PID=`cat "$PIDFILE"` + # Check if still running + kill -0 $PID > /dev/null 2>&1 + if [ $? = 0 ] ; then + [ "$DEBUG" = "1" ] && $ECHO "$ME: There already seems to be an PPPoE connection up (PID $PID)" >& 2 + exit 1 + fi + # Delete bogus PIDFILE + rm -f "$PIDFILE" "$PIDFILE.pppd" "$PIDFILE.pppoe" "$PIDFILE.start" +fi + +echo $$ > $PIDFILE.start + +# Start the connection in the background unless we're debugging +if [ "$DEBUG" != "" ] ; then + $CONNECT "$@" + exit 0 +fi + +$CONNECT "$@" > /dev/null 2>&1 & +CONNECT_PID=$! + +if [ "$CONNECT_TIMEOUT" = "" -o "$CONNECT_TIMEOUT" = 0 ] ; then + exit 0 +fi + +# Don't monitor connection if dial-on-demand +if [ "$DEMAND" != "" -a "$DEMAND" != "no" ] ; then + exit 0 +fi + +# Monitor connection +TIME=0 +while [ true ] ; do + $STATUS $CONFIG > /dev/null 2>&1 + + # Looks like the interface came up + if [ $? = 0 ] ; then + # Print newline if standard input is a TTY + [ "$DEBUG" = "1" ] && tty -s && $ECHO " Connected!" + exit 0 + fi + + if test -n "$FORCEPING" ; then + [ "$DEBUG" = "1" ] && $ECHO -n "$FORCEPING" + else + [ "$DEBUG" = "1" ] && tty -s && $ECHO -n "$PING" + fi + sleep $CONNECT_POLL + TIME=`expr $TIME + $CONNECT_POLL` + if [ $TIME -gt $CONNECT_TIMEOUT ] ; then + break + fi +done + +[ "$DEBUG" = "1" ] && $ECHO "TIMED OUT" >& 2 +# Timed out! Kill the pppoe-connect process and quit +kill $CONNECT_PID > /dev/null 2>&1 + +# Clean up PIDFILE(s) +rm -f "$PIDFILE" "$PIDFILE.pppd" "$PIDFILE.pppoe" "$PIDFILE.start" + +# add old default gw back +if [ -s /etc/default-routes ] ; then + while read spec; do + $IP route add $spec + done < /etc/default-routes + rm -f /etc/default-routes +fi + +exit 1 diff --git a/pppoe-status b/pppoe-status new file mode 100644 index 0000000..f401854 --- /dev/null +++ b/pppoe-status @@ -0,0 +1,105 @@ +#!/bin/bash +#*********************************************************************** +# +# pppoe-status +# +# Shell script to report on status of PPPoE connection +# +# Copyright (C) 2000-2001 Roaring Penguin Software Inc. +# +# $Id$ +# +# This file may be distributed under the terms of the GNU General +# Public License. +# +# LIC: GPL +# +# Usage: pppoe-status [config_file] +# If config_file is omitted, defaults to /etc/ppp/pppoe.conf +# +#*********************************************************************** + +# Defaults +LS=/usr/bin/ls +IP=/usr/sbin/ip +NETWORKDIR=/etc/sysconfig/network + +get_device() { + if [ ! -d $NETWORKDIR ] ; then + $ECHO "** $NETWORKDIR not found" + $ECHO "** Quitting" + exit 1 + fi + + cd $NETWORKDIR + interfaces=$($LS ifcfg-ppp* 2>/dev/null | grep -E -v '(~|\.bak)$' | \ + grep -E -v '(rpmsave|rpmorig|rpmnew)' | sed 's/^ifcfg-//g') + + for i in $interfaces ; do + test -f ifcfg-$i && . ifcfg-$i 2>/dev/null + if [ "$TYPE" = "xDSL" ] ; then + CONFIG=$NETWORKDIR/ifcfg-$i + break + fi + done +} + +CONFIG="$1" +if [ -z "$CONFIG" ] ; then + get_device + [ -z "$CONFIG" ] && CONFIG=/etc/ppp/pppoe.conf +fi + +if [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then + echo "$0: Cannot read configuration file '$CONFIG'" >& 2 + exit 1 +fi + +. $CONFIG + +PPPOE_PIDFILE="$PIDFILE.pppoe" +PPPD_PIDFILE="$PIDFILE.pppd" + +if [ "$DEMAND" != "no" ] ; then + echo "Note: You have enabled demand-connection; pppoe-status may be inaccurate." +fi + +# If no PPPOE_PIDFILE, connection is down, unless we're using the Linux plugin +if [ "$LINUX_PLUGIN" = "" ] ; then + if [ ! -r "$PPPOE_PIDFILE" ] ; then + echo "pppoe-status: Link is down (can't read pppoe PID file $PPPOE_PIDFILE)" + exit 1 + fi +fi + +# If no PPPD_PIDFILE, something fishy! +if [ ! -r "$PPPD_PIDFILE" ] ; then + echo "pppoe-status: Link is down (can't read pppd PID file $PPPD_PIDFILE)" + exit 1 +fi + +PPPD_PID=`cat "$PPPD_PIDFILE"` + +# Sigh. Some versions of pppd put PID files in /run; others put them +# in /etc/ppp. Since it's too messy to figure out what pppd does, we +# try both locations. +for i in /etc/ppp/ppp*.pid /run/ppp*.pid ; do + if [ -r $i ] ; then + PID=`cat $i` + if [ "$PID" = "$PPPD_PID" ] ; then + IF=`basename $i .pid` + $IP route | grep "dev ${IF}\s" > /dev/null + if [ "$?" != "0" ] ; then + echo "pppoe-status: Link is attached to $IF, but $IF is down" + exit 1 + fi + echo "pppoe-status: Link is up and running on interface $IF" + $IP addr show $IF + exit 0 + fi + fi +done + +echo "ppppoe-status: Link is down -- could not find interface corresponding to" +echo "pppd pid $PPPD_PID" +exit 1 diff --git a/pppoe-stop b/pppoe-stop new file mode 100644 index 0000000..6788809 --- /dev/null +++ b/pppoe-stop @@ -0,0 +1,143 @@ +#!/bin/bash +# Generated automatically from pppoe-stop.in by configure. +#*********************************************************************** +# +# pppoe-stop +# +# Shell script to bring down an PPPoE connection +# +# Copyright (C) 2000 Roaring Penguin Software Inc. +# +# $Id$ +# +# This file may be distributed under the terms of the GNU General +# Public License. +# +# LIC: GPL +# +# Usage: pppoe-stop [config_file] +# If config_file is omitted, defaults to /etc/ppp/pppoe.conf +# +#*********************************************************************** + +export PATH=/sbin:/bin:/usr/sbin:/usr/bin + +IP=/usr/sbin/ip +LS=/usr/bin/ls +NETWORKDIR=/etc/sysconfig/network + +# Set to "C" locale so we can parse messages from commands +LANG=C +export LANG + +get_device() { + if [ ! -d $NETWORKDIR ] ; then + $ECHO "** $NETWORKDIR not found" + $ECHO "** Quitting" + exit 1 + fi + + cd $NETWORKDIR + interfaces=$($LS ifcfg-ppp* 2>/dev/null | grep -E -v '(~|\.bak)$' | \ + grep -E -v '(rpmsave|rpmorig|rpmnew)' | sed 's/^ifcfg-//g') + + for i in $interfaces ; do + test -f ifcfg-$i && . ifcfg-$i 2>/dev/null + if [ "$TYPE" = "xDSL" ] ; then + CONFIG=$NETWORKDIR/ifcfg-$i + break + fi + done +} + +ME="`basename $0`" +LOGGER="/usr/bin/logger -t $ME" +CONFIG="$1" +if [ -z "$CONFIG" ] ; then + get_device + [ -z "$CONFIG" ] && CONFIG=/etc/ppp/pppoe.conf +fi + +if [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then + [ "$DEBUG" = "1" ] && echo "$ME: Cannot read configuration file '$CONFIG'" >& 2 + exit 1 +fi + +export CONFIG +. $CONFIG + +PPPOE_PIDFILE="$PIDFILE.pppoe" +PPPD_PIDFILE="$PIDFILE.pppd" +STARTPID="$PIDFILE.start" + +# Backward config file compatibility +if test "$DEMAND" = "" ; then + DEMAND=no +fi + +# Ignore SIGTERM +trap "" 15 + +# Check for pidfile +if [ -r "$PIDFILE" ] ; then + PID=`cat $PIDFILE` + + # Check if still running + kill -0 $PID > /dev/null 2>&1 + if [ $? != 0 ] ; then + [ "$DEBUG" = "1" ] && echo "$ME: The pppoe-connect script (PID $PID) appears to have died" >& 2 + fi + + # Kill pppd, which should in turn kill pppoe + if [ -r "$PPPD_PIDFILE" ] ; then + PPPD_PID=`cat "$PPPD_PIDFILE"` + $LOGGER -p daemon.notice "Killing pppd" + [ "$DEBUG" = "1" ] && echo "Killing pppd ($PPPD_PID)" + kill $PPPD_PID > /dev/null 2>&1 + fi + + # Kill pppoe-start + PIDS=`cat $STARTPID` + kill -0 $PIDS > /dev/null 2>&1 + if [ $? = 0 ] ; then + $LOGGER -p daemon.notice "Killing pppoe-connect" + kill $PIDS > /dev/null 2>&1 + fi + + # Kill pppoe-connect + $LOGGER -p daemon.notice "Killing pppoe-connect" + [ "$DEBUG" = "1" ] && echo "Killing pppoe-connect ($PID)" + kill $PID > /dev/null 2>&1 + + # Kill pppd again, in case it's still hanging around + if [ -r "$PPPD_PIDFILE" ] ; then + PPPD_PID=`cat "$PPPD_PIDFILE"` + kill -9 $PPPD_PID > /dev/null 2>&1 || exit 1 + fi + + # Kill br2684ctl if necessary + if [ -n "$BR2684DEV" -a -r /run/nas$BR2684DEV.pid ]; then + PIDS=`cat /run/nas$BR2684DEV.pid` + kill -0 $PIDS > /dev/null 2>&1 + if [ $? = 0 ]; then + $LOGGER -p daemon.notice "Killing br2684ctl for nas$BR2684DEV" + kill $PIDS > /dev/null 2>&1 + fi + rm -f /run/nas$BR2684DEV.pid + fi + + rm -f "$PIDFILE" "$PPPD_PIDFILE" "$PPPOE_PIDFILE" "$STARTPID" +else + [ "$DEBUG" = "1" ] && echo "$ME: No PPPoE connection appears to be running" >&2 + exit 1 +fi + +# add old default gw back +if [ -s /etc/default-routes ] ; then + while read spec; do + $IP route add $spec + done < /etc/default-routes + rm -f /etc/default-routes +fi + +exit 0 diff --git a/pppoe.service b/pppoe.service new file mode 100644 index 0000000..2370b30 --- /dev/null +++ b/pppoe.service @@ -0,0 +1,13 @@ +[Unit] +Description=PPPoE +After=network.target + +[Service] +Group=dialout +Type=oneshot +RemainAfterExit=true +ExecStart=/usr/sbin/pppoe-start +ExecStop=/usr/sbin/pppoe-stop + +[Install] +WantedBy=multi-user.target diff --git a/rp-pppoe-3.14-docdir.patch b/rp-pppoe-3.14-docdir.patch new file mode 100644 index 0000000..2affa41 --- /dev/null +++ b/rp-pppoe-3.14-docdir.patch @@ -0,0 +1,12 @@ +diff -Pdpru rp-pppoe-3.14.orig/src/Makefile.in rp-pppoe-3.14/src/Makefile.in +--- rp-pppoe-3.14.orig/src/Makefile.in 2020-05-27 03:29:37.000000000 +0300 ++++ rp-pppoe-3.14/src/Makefile.in 2020-05-27 21:06:28.850733710 +0300 +@@ -23,7 +23,7 @@ DEFINES= + prefix=@prefix@ + exec_prefix=@exec_prefix@ + mandir=@mandir@ +-docdir=@prefix@/share/doc/rp-pppoe-$(RP_VERSION) ++docdir=@prefix@/share/doc/packages/rp-pppoe + install=@INSTALL@ + install_dir=@INSTALL@ -d + sbindir=@sbindir@ diff --git a/rp-pppoe-4.0.tar.gz b/rp-pppoe-4.0.tar.gz new file mode 100644 index 0000000..f8e8b74 --- /dev/null +++ b/rp-pppoe-4.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41ac34e5db4482f7a558780d3b897bdbb21fae3fef4645d2852c3c0c19d81cea +size 139539 diff --git a/rp-pppoe.changes b/rp-pppoe.changes new file mode 100644 index 0000000..51e7c6a --- /dev/null +++ b/rp-pppoe.changes @@ -0,0 +1,404 @@ +------------------------------------------------------------------- +Mon May 15 07:18:40 UTC 2023 - Frederic Crozat + +- Updated to 4.0: + * SPDX-License-Identifier: tags added to most source files + * rp-pppoe.so plugin: Modified to compile against both pppd >= 2.5.0 and + pppd < 2.5.0. + * pppoe-server: If -L or -R option is specified as 0.0.0.0, then IP allocation + is delegated to pppd. + * pppoe-server: New -g option specifies the path of the rp-pppoe.so plugin to + use with pppd in kernel-mode PPPoE. + + * pppoe-server: New -U option specifies a UNIX-domain control socket. This + lets you send control commands to the server while it is running; see the + pppoe-server man page for details. + + * All source code: Many cleanups and use of standard types like uint16_t rather + than ones we define. + + * All source code: Support for OSes other than Linux has been dropped. + + * Documentation: Updated from modern Linux systems. + + * Cleanup: The following old and obsolete files have been removed: + - Old connection scripts scripts/pppoe-connect.in, scripts/pppoe-start.in, + scripts/pppoe-init-suse.in, scripts/pppoe-setup.in, scripts/pppoe-status, + scripts/pppoe-init.in, and scripts/pppoe-stop.in + * Obsolete firewall scripts configs/firewall-standalone and + configs/firewall-masq + - Obsolete configuration files configs/pppoe.conf and configs/pap-secrets + - The Tcl/Tk gui script gui/tkpppoe.in and supporting files + - The RPM spec file rp-pppoe.spec +- Drop rp-pppoe-3.14-nonrfc-modems.patch, rp-pppoe-3.14-resolve-conf.patch, + rp-pppoe-3.14-config.patch, rp-pppoe-3.14-init.patch, + patched scripts no longer exists. +- Drop rp-pppoe-3.14-release-buildsystem.patch, rp-pppoe-3.14-pie.patch + rp-pppoe-3.14-strip.patch, no longer needed. + +------------------------------------------------------------------- +Sun Sep 4 17:53:20 UTC 2022 - Andreas Stieger + +- Converted usage of egrep to "grep -E" (boo#1203092). + +------------------------------------------------------------------- +Thu Mar 10 13:47:22 UTC 2022 - Илья Индиго + +- Removed Wants=network.target from pppoe.service (bsc#1196359). + +------------------------------------------------------------------- +Sat May 8 20:24:02 UTC 2021 - Илья Индиго + +- Refreshed spec-file via spec-cleaner and manual optimisations. + * Changed files: pppoe-connect, pppoe-setup, pppoe-status and + pppoe-stop (replaced /var/run by /run). +- Updated to 3.15 + * Don't ignore SIGTERM and SIGINT. + Send PADT and exit if one of those signals is received. + * Switch from net-tools to iproute2. + +------------------------------------------------------------------- +Thu May 28 01:11:10 UTC 2020 - Илья Индиго + +- Refresh spec-file via spec-cleaner and manual optimisations. + * Add make_build and autopatch macros. + * Remove group tag and obsoleted conditions. +- Refresh and rename patches: + * docdir.diff to rp-pppoe-3.14-docdir.patch + * nonrfc-modems.diff to rp-pppoe-3.14-nonrfc-modems.patch + * release-buildsystem.diff to rp-pppoe-3.14-release-buildsystem.patch + * resolve-conf.diff to rp-pppoe-3.14-resolve-conf.patch + * rp-pppoe-3.10-config.patch to rp-pppoe-3.14-config.patch + * rp-pppoe-3.10-init.patch to rp-pppoe-3.14-init.patch + * rp-pppoe-pie.patch to rp-pppoe-3.14-pie.patch + * strip.diff to rp-pppoe-3.14-strip.patch +- Update to 3.14 + * Add -H and -M options for sending HURL and MOTM packets respectively. + * Change VERSION macro to RP_VERSION to avoid conflict with pppd macro. + +------------------------------------------------------------------- +Mon Jun 17 07:50:57 UTC 2019 - Илья Индиго + +- Refresh spec-file via spec-cleaner and manual optimisations. + * New URL and Source project. + * Add pkgconfig for BuildRequires. +- Update rp-pppoe to version 3.13. + * Fix potential use-after-free bug. + * Properly detecte kernel-mode PPPoE. + +------------------------------------------------------------------- +Wed Jun 12 14:56:41 UTC 2019 - Dominique Leuenberger + +- BuildRequire pkgconfig(systemd) instead of systemd: allow OBS to + shortcut the build queues by allowing usage of systemd-mini + +------------------------------------------------------------------- +Sat Mar 10 02:40:34 UTC 2018 - ilya@ilya.cf + +- Refresh spec-file via spec-cleaner and manual optimisations. +- Add %license macro. + +------------------------------------------------------------------- +Thu Nov 23 14:06:28 UTC 2017 - ilya@ilya.cf + +- Add Requires/Requires(pre) group(dialout) (boo#1067511). +- Add %verify_permissions script for pppoe-wrapper. + +------------------------------------------------------------------- +Thu Nov 9 12:53:45 UTC 2017 - ilya@ilya.cf + +- Refresh pppoe.spec via spec-cleaner. + +------------------------------------------------------------------- +Sun Oct 8 12:26:27 UTC 2017 - ilya@ilya.cf + +- Add pppoe.service for run pppoe as client (boo#1060710). +- Refresh pppoe.spec. +- Drop SLE 11 support. + +------------------------------------------------------------------- +Wed Nov 16 15:51:48 UTC 2016 - ilya@ilya.cf + +- Fix patches and script for version 3.12. +- dropped logger-path.diff +- Add net-tools support. net-tools-deprecated is no longer required. + +------------------------------------------------------------------- +Tue Oct 25 22:23:41 EEST 2016 - ilya@ilya.cf + +- Update to version 3.12. +- Fix patch release-buildsystem.diff for 3.12 version. +- Add to Requires net-tools-deprecated package. +- Reordered patch positions. +- Formated all the variables in the spec-file to macro style. + +------------------------------------------------------------------- +Sat Oct 25 09:51:24 UTC 2014 - p.drouand@gmail.com + +- Use systemd instead of sysvinit; add pppoe-server.service +- Install fixed versions of rp-pppoe scripts for openSUSE > 11.4 + most of fixes are about paths, because of /usr move + Added: pppoe-setup, ,pppoe-start, pppoe-connect, pppoe-status , + pppoe-stop + +------------------------------------------------------------------- +Tue Apr 23 10:01:52 UTC 2013 - binli@opensuse.org + +- update to version 3.11 + * Make the rp-pppoe.so plugin avoid calling exit() if + the "persist" pppd option was given. + * Get rid of hard-coded nobsdcomp, nodeflate, novj and novjccomp + options in pppoe-server. + * Handle UNIT=xxx directive in pppoe-connect. + * Add "-i" flag to pppoe-server to ignore PADIs if there are + no free sessions. + * Add "-X " option to pppoe-server. + * In plugin, don't set devnam if it's already set. + * Eliminate race condition in signal handling. + * pppoe-server: Add -q and -Q options to allow specification of + path to pppd and pppoe programs respectively. + * Add a few more sanity checks to pppoe-server packet handling. + +------------------------------------------------------------------- +Tue Jan 24 00:48:39 UTC 2012 - crrodriguez@opensuse.org + +- build pppoe-wrapper with PIE and full RELRO + +------------------------------------------------------------------- +Tue Nov 3 19:09:43 UTC 2009 - coolo@novell.com + +- updated patches to apply with fuzz=0 + +------------------------------------------------------------------- +Fri May 8 02:15:32 CEST 2009 - chris@computersalat.de + +- new patch for init script + o added reload + o rework of status +- added config patch + +------------------------------------------------------------------- +Wed Apr 15 11:30:25 UTC 2009 - chris@computersalat.de + +- beautify spec + +------------------------------------------------------------------- +Fri Jul 4 11:40:26 CEST 2008 - hvogel@suse.de + +- update to version 3.10 + * some compilation fixes + * pppoe-server has new "-x" option to limit the number of sessions + per MAC address. + * Added proper timeout handling while waiting for PADO/PADS. + * Fix race condition with some access concentrators + +------------------------------------------------------------------- +Fri Feb 22 00:46:26 CET 2008 - crrodriguez@suse.de + +- add missing remote_fs dependency in the init script +- fix/add missing calls to restart_on_update and stop_on_removal macros + +------------------------------------------------------------------- +Thu Jul 13 14:52:42 CEST 2006 - mskibbe@suse.de + +- update to version 3.8 which + o Adjusted code and made it possible to disable debugging code + to shrink size of pppoe executable. + o Fixed bug in MD5 code that caused pppoe-server to segfault on + 64-bit machines. + o Made various functions and variables static that didn't need + to be visible outside their source files. + +------------------------------------------------------------------- +Fri May 26 20:14:40 CEST 2006 - schwab@suse.de + +- Use RPM_OPT_FLAGS. +- Don't strip binaries. + +------------------------------------------------------------------- +Wed Jan 25 21:41:12 CET 2006 - mls@suse.de + +- converted neededforbuild to BuildRequires + +------------------------------------------------------------------- +Thu Nov 17 11:54:52 CET 2005 - arvin@suse.de + +- updated to version 3.7 + - pppoe-server prepends "nic-" to interface name if used with + kernel-mode plugin + - added -O option to pppoe-server that specify a different + default options file for pppd + +------------------------------------------------------------------- +Wed Sep 21 16:39:17 CEST 2005 - arvin@suse.de + +- updated to version 3.6: + - Changed the names of commands from adsl-* to pppoe-* to + more logically name the scripts (incompatibility) + - Changed sample firewall scripts to use iptables instead of + the old ipchains command + +------------------------------------------------------------------- +Wed Jan 19 14:24:03 CET 2005 - arvin@suse.de + +- fixed build on s390 by compiling without -ansi + +------------------------------------------------------------------- +Sat Jan 10 18:49:07 CET 2004 - adrian@suse.de + +- build as user + +------------------------------------------------------------------- +Fri Sep 5 13:16:13 CEST 2003 - ro@suse.de + +- fix typo in specfile + +------------------------------------------------------------------- +Fri Sep 5 05:54:15 CEST 2003 - kukuk@suse.de + +- Add %attr to get filelist in sync with /etc/permissions* + +------------------------------------------------------------------- +Fri Jun 13 07:20:02 CEST 2003 - nashif@suse.de + +- Added %dir to created directories + +------------------------------------------------------------------- +Fri May 16 00:24:33 CEST 2003 - nashif@suse.de + +- Fixed init script syntax (bug #26248) +- Fixed file list + +------------------------------------------------------------------- +Mon Mar 10 16:37:39 CET 2003 - nashif@suse.de + +- dont link /etc/resolv.conf, done by ip-up ( #15707) + +------------------------------------------------------------------- +Wed Oct 2 00:33:10 CEST 2002 - nashif@suse.de + +- Don't check for release file + +------------------------------------------------------------------- +Mon Sep 30 15:43:42 CEST 2002 - nashif@suse.de + +- fixed bug #20327: wrong path to logger in scripts + +------------------------------------------------------------------- +Mon Aug 19 12:08:09 CEST 2002 - kukuk@suse.de + +- fixed compilation on UL + +------------------------------------------------------------------- +Mon Aug 19 00:23:31 CEST 2002 - nashif@suse.de + +- Fixed bug #17866: Added PreReq + +------------------------------------------------------------------- +Sat Aug 10 19:00:53 CEST 2002 - nashif@suse.de + +- Fix bug #17465: detect non-rfc modems +- Fix bug #17466: use netfilter instead of ipchains + +------------------------------------------------------------------- +Mon Jul 29 04:30:52 CEST 2002 - nashif@suse.de + +- update to 3.5 + +------------------------------------------------------------------- +Mon Jan 14 14:25:23 CET 2002 - ro@suse.de + +- removed START_ADSL + +------------------------------------------------------------------- +Sat Oct 20 05:56:44 CEST 2001 - nashif@suse.de + +- Update to 3.3 + * Client works on Solaris again. It was broken in 3.2. + * Added DEFAULTROUTE=yes|no option to configuration file. + * Server parses address pool file better. + * Server address pool allows ranges of addresses on a line: a.b.c.d-e + * Added "-d" (=debug) and "-P" (=check pool file syntax) options to + pppoe-server. + +------------------------------------------------------------------- +Fri Aug 3 03:52:25 CEST 2001 - nashif@suse.de + +- Update to version 3.2 + +------------------------------------------------------------------- +Thu Jun 28 16:27:24 CEST 2001 - nashif@suse.de + +- Fixed bug #8966 +- bzipped sources + +------------------------------------------------------------------- +Sat Apr 21 05:22:34 CEST 2001 - nashif@suse.de + +- Fixed documentation path in GUI +- Added GUI documentation + +------------------------------------------------------------------- +Thu Apr 5 17:33:57 CEST 2001 - nashif@suse.de + +- Fixed init script (Use rc_status) + +------------------------------------------------------------------- +Tue Apr 3 19:41:20 CEST 2001 - nashif@suse.de + +- Update to version 3.0 + +------------------------------------------------------------------- +Thu Mar 1 01:06:28 CET 2001 - nashif@suse.de + +- Update to version 2.8 +- Fixed headers + +------------------------------------------------------------------- +Fri Dec 22 06:53:50 MET 2000 - nashif@suse.de + +- Added obosletes and provides tags + +------------------------------------------------------------------- +Wed Dec 13 06:39:51 MET 2000 - nashif@suse.de + +- Update to 2.5 (Fixes security problem) + +------------------------------------------------------------------- +Sat Dec 9 16:29:42 MET 2000 - nashif@suse.de + +- Update to 2.4 +- Fix rcadsl link +- Changed name tp rp-pppoe + +------------------------------------------------------------------- +Wed Nov 29 12:44:50 MET 2000 - nashif@suse.de + +- Use insserv + +------------------------------------------------------------------- +Fri Sep 22 19:34:25 MEST 2000 - nashif@suse.de + +- Updated to 2.3 + +------------------------------------------------------------------- +Thu May 25 06:24:32 MEST 2000 - nashif@suse.de + +- Updated to 1.9 +- Added init script + +------------------------------------------------------------------- +Sun May 7 18:01:13 MEST 2000 - nashif@suse.de + +- Update to version 1.8 + +------------------------------------------------------------------- +Wed Mar 29 17:59:12 CEST 2000 - nashif@suse.de + +- Update to version 1.7 +- Fixed Group & Buildroot tag + +------------------------------------------------------------------- +Wed Feb 23 01:43:27 CET 2000 - nashif@suse.de + +- Initial Release (Version 1.3) diff --git a/rp-pppoe.spec b/rp-pppoe.spec new file mode 100644 index 0000000..b1ac3f5 --- /dev/null +++ b/rp-pppoe.spec @@ -0,0 +1,110 @@ +# +# spec file for package rp-pppoe +# +# Copyright (c) 2023 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define _name pppoe +%define _group dialout +Name: rp-%{_name} +Version: 4.0 +Release: 0 +Summary: A PPP Over Ethernet Redirector for PPPD +License: GPL-2.0-or-later +URL: https://dianne.skoll.ca/projects/%{name} +Source0: https://dianne.skoll.ca/projects/%{name}/download/%{name}-%{version}.tar.gz +Source1: %{_name}-connect +Source2: %{_name}-setup +Source3: %{_name}-start +Source4: %{_name}-status +Source5: %{_name}-stop +Source6: %{_name}.service +Source7: %{_name}-server.service +Patch0: %{name}-3.14-docdir.patch +BuildRequires: pkgconfig +BuildRequires: ppp +BuildRequires: pkgconfig(systemd) +Requires: group(%{_group}) +Requires: iproute2 +Requires: ppp +Requires(post): permissions +Requires(pre): group(%{_group}) + +%description +%{name} is a user-space redirector which permits the use of PPPoE +(Point-to-Point Protocol Over Ethernet) with Linux. PPPoE is used by +many ADSL service providers. + +%prep +%autosetup -p1 + +%build +cd src +%configure +%make_build + +%install +%make_install -C src +mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir} +install -p %{SOURCE1} %{buildroot}%{_sbindir} +install -p %{SOURCE2} %{buildroot}%{_sbindir} +install -p %{SOURCE3} %{buildroot}%{_sbindir} +install -p %{SOURCE4} %{buildroot}%{_sbindir} +install -p %{SOURCE5} %{buildroot}%{_sbindir} +install -pm0644 %{SOURCE6} %{buildroot}%{_unitdir}/%{_name}.service +install -pm0644 %{SOURCE7} %{buildroot}%{_unitdir}/%{_name}-server.service +ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{_name} +ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{_name}-server +ln -s %{_name}-stop %{buildroot}%{_sbindir}/adsl-stop +ln -s %{_name}-start %{buildroot}%{_sbindir}/adsl-start +install -Dpm0644 %{buildroot}%{_sysconfdir}/ppp/plugins/README %{buildroot}%{_defaultdocdir}/%{name}/README.plugins +rm -r %{buildroot}%{_sysconfdir}/ppp/plugins \ + %{buildroot}%{_defaultdocdir}/%{name}/LICENSE + +%pre +%service_add_pre %{_name}.service +%service_add_pre %{_name}-server.service + +%preun +%service_del_preun %{_name}.service +%service_del_preun %{_name}-server.service + +%post +%service_add_post %{_name}.service +%service_add_post %{_name}-server.service +%set_permissions %{_sbindir}/%{_name}-wrapper + +%postun +%service_del_postun %{_name}.service +%service_del_postun %{_name}-server.service + +%verifyscript +%verify_permissions -e %{_sbindir}/%{_name}-wrapper + +%files +%license doc/LICENSE +%dir %{_defaultdocdir}/%{name} +%doc %{_defaultdocdir}/%{name}/* +%attr(0640,root,root) %config(noreplace) %{_sysconfdir}/ppp/%{_name}-server-options +%{_sbindir}/%{_name} +%{_sbindir}/%{_name}-* +%{_mandir}/man?/*%{?ext_man} +%{_sbindir}/adsl-st* +%{_sbindir}/rc%{_name} +%{_sbindir}/rc%{_name}-server +%{_unitdir}/%{_name}.service +%{_unitdir}/%{_name}-server.service + +%changelog