File rp-pppoe-dont-ifconfig.patch of Package rp-pppoe

Index: rp-pppoe-3.12/doc/HOW-TO-CONNECT
===================================================================
--- rp-pppoe-3.12.orig/doc/HOW-TO-CONNECT	2015-11-11 16:10:00.000000000 +0100
+++ rp-pppoe-3.12/doc/HOW-TO-CONNECT	2022-01-20 11:38:35.900602615 +0100
@@ -21,14 +21,15 @@ visible to the Linux kernel.  Just how t
 of this document.  However, if the card is the only Ethernet card in
 the system, executing:
 
-	ifconfig eth0
+	ip link show eth0
 
 should display something like this:
 
-	eth0      Link encap:Ethernet  HWaddr 00:60:67:62:31:D4
+	2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
+    link/ether fc:aa:15:39:a7:b3 brd ff:ff:ff:ff:ff:ff
 
-plust some more lines.  Your HWaddr will be different.  As long as you see
-the HWaddr line, your card should be working.
+Your second line will most definately be different.  As long as you see
+the link/ether line, your card should be working.
 
 DO NOT assign an IP address to the Ethernet card.  DO NOT configure the
 card to come up at boot time.
@@ -119,8 +120,8 @@ hosts to the LAN, but consumes some extr
 
 If you want to manually configure the LAN hosts, here's how:
 
-In Linux, use: "ifconfig eth0 mtu 1452".  For best results, put this
-in an /etc/rc.d/rc.local script.
+In Linux, use: "ip link set eth0 mtu 1452".  For best results, put
+this in an /etc/rc.d/rc.local script.
 
 For Windows, machines, see http://lan.cns.ksu.edu/OS/WIN95/slip95.htm.
 Set the MaxMTU to 1452.
@@ -134,8 +135,8 @@ As root, bring down the link by typing:
 That's it!
 
 --
-Dianne Skoll <dfs@roaringpenguin.com> | Roaring Penguin Software Inc.
-http://www.roaringpenguin.com           |
+Dianne Skoll <dianne@skoll.ca>
+https://dianne.skoll.ca/projects/rp-pppoe/           |
 
 PROBLEMS!  DIANNE, IT DOESN'T WORK!
 ---------------------------------
@@ -145,11 +146,13 @@ Here are some problems PPPoE users have
 -----------------------------------------------------------------------------
 A) Can't see the Ethernet interface
 
-Well, I can't really help you here.  To use these instructions, you must
-have Linux working to the point where it recognizes your Ethernet card.
-If you type "ifconfig ethx" and you get back a HWAddr value, your Ethernet
-card is probably OK.  But I really can't help with hardware configuration
-issues.
+Well, I can't really help you here.  To use these instructions, you
+must have Linux working to the point where it recognizes your Ethernet
+card.  If you type "ip link show ethx" and you get back a hardware
+address value in the line that begins with link/ether, your Ethernet
+card is probably OK.  But I really can't help with hardware
+configuration issues.
+
 
 -----------------------------------------------------------------------------
 B) Connection seems to come up, but I can't browse the web or ping anything
@@ -224,9 +227,10 @@ problem, give the Ethernet card connecte
 address.  For example, if eth0 is your internal LAN card and eth1 goes to
 the DSL modem, do something like this:
 
-	ifconfig eth1 10.0.0.1 netmask 255.255.255.0
+	ip link set eth1 10.0.0.1/24
+
+(You may have to choose a different IP address and prefix; experiment.)
 
-(You may have to choose a different IP address; experiment.)
 -----------------------------------------------------------------------------
 K) How can I run a script every time I connect and get a new IP address?
 
@@ -262,7 +266,7 @@ Make sure no entries in the routing tabl
 connected to the DSL modem.  You might want to add these lines in
 pppoe-connect:
 
-	ifconfig ethx down
-	ifconfig ethx up mtu 1500
+        ip link set ethx down
+	ip link set  ethx up mtu 1500
 
 which should reset things to sane values.
Index: rp-pppoe-3.12/gui/tkpppoe.in
===================================================================
--- rp-pppoe-3.12.orig/gui/tkpppoe.in	2015-11-11 16:09:58.000000000 +0100
+++ rp-pppoe-3.12/gui/tkpppoe.in	2022-01-20 11:37:25.936150975 +0100
@@ -1573,9 +1573,9 @@ proc SetButtonStates {} {
 #***********************************************************************
 proc GetEthernetInterfaces {} {
     set ifs {}
-    set fp [open "|/sbin/ifconfig" "r"]
+    set fp [open "|@IP@ -o link show" "r"]
     while {[gets $fp line] >= 0} {
-	if {[regexp {^eth[0-9]+} $line eth]} {
+	if {[regexp {eth[0-9]+} $line eth]} {
 	    lappend ifs $eth
 	}
     }
Index: rp-pppoe-3.12/man/pppoe-sniff.8
===================================================================
--- rp-pppoe-3.12.orig/man/pppoe-sniff.8	2015-11-11 16:10:01.000000000 +0100
+++ rp-pppoe-3.12/man/pppoe-sniff.8	2022-01-20 11:37:25.936150975 +0100
@@ -31,7 +31,7 @@ and start \fBpppoe-sniff\fR.  If the eth
 for example, type these commands:
 
 .nf
-	ifconfig eth0 promisc
+	ip link set eth0 promisc on
 	pppoe-sniff -I eth0
 .fi
 
@@ -48,7 +48,7 @@ After \fBpppoe-sniff\fR finishes (or you
 remember to turn off promiscuous mode:
 
 .nf
-	ifconfig eth0 -promisc
+	ip link set eth0 promisc on
 .fi
 
 .SH OPTIONS
Index: rp-pppoe-3.12/scripts/pppoe-connect.in
===================================================================
--- rp-pppoe-3.12.orig/scripts/pppoe-connect.in	2022-01-20 11:37:25.904150768 +0100
+++ rp-pppoe-3.12/scripts/pppoe-connect.in	2022-01-20 11:37:25.936150975 +0100
@@ -28,6 +28,7 @@ exec_prefix=@exec_prefix@
 localstatedir=/var
 
 # Paths to programs
+IP=@IP@
 IFCONFIG=/sbin/ifconfig
 PPPD=@PPPD@
 SETSID=@SETSID@
@@ -115,11 +116,7 @@ fi
 # fails on some *BSD's, so we'll only do it under Linux
 
 if test `uname -s` = Linux ; then
-    $IFCONFIG $ETH up
-    EXISTING_MTU=`$IFCONFIG $ETH 2> /dev/null | grep MTU: | sed -e 's/.*MTU://' | sed -e 's/[^0-9].*//'`
-    if test "$EXISTING_MTU" = "" -o "$EXISTING_MTU" -lt 1500 ; then
-	$IFCONFIG $ETH mtu 1500
-    fi
+    $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
@@ -129,12 +126,14 @@ if test `uname -s` = Linux ; then
 	modprobe pppox > /dev/null 2>&1
 	modprobe pppoe > /dev/null 2>&1
     fi
+else
+    $IFCONFIG $ETH up
 fi
 
 if test "$SYNCHRONOUS" = "yes" ; then
     PPPOE_SYNC=-s
     PPPD_SYNC=sync
-	# Increase the chances of it working on Linux...
+    # Increase the chances of it working on Linux...
     if test `uname -s` = Linux ; then
 	modprobe n_hdlc > /dev/null 2>&1
     fi
Index: rp-pppoe-3.12/scripts/pppoe-setup.in
===================================================================
--- rp-pppoe-3.12.orig/scripts/pppoe-setup.in	2022-01-20 11:37:25.884150639 +0100
+++ rp-pppoe-3.12/scripts/pppoe-setup.in	2022-01-20 11:37:25.936150975 +0100
@@ -18,6 +18,7 @@ exec_prefix=@exec_prefix@
 
 # Paths to programs
 IFCONFIG=/sbin/ifconfig
+IP=@IP@
 PPPD=@PPPD@
 PPPOE=@sbindir@/pppoe
 ECHO=@ECHO@
@@ -94,6 +95,8 @@ while [ true ] ; do
 
     # Under Linux, "fix" the default interface if eth1 is not available
     if test `uname -s` = "Linux" ; then
+        $IP link show $ETH > /dev/null 2>&1 || ETH=eth0
+    else
 	$IFCONFIG $ETH > /dev/null 2>&1 || ETH=eth0
     fi
     $ECHO ""
Index: rp-pppoe-3.12/scripts/pppoe-start.in
===================================================================
--- rp-pppoe-3.12.orig/scripts/pppoe-start.in	2022-01-20 11:37:25.936150975 +0100
+++ rp-pppoe-3.12/scripts/pppoe-start.in	2022-01-20 11:43:52.006643088 +0100
@@ -29,7 +29,7 @@ exec_prefix=@exec_prefix@
 # Paths to programs
 CONNECT=@sbindir@/pppoe-connect
 ECHO=@ECHO@
-IFCONFIG=/sbin/ifconfig
+IP=@IP@
 
 # Set to "C" locale so we can parse messages from commands
 LANG=C
@@ -69,8 +69,8 @@ if [ "$DEBUG" = "1" ] ; then
     $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 ifconfig -a" >> $DEBUG
-    $IFCONFIG -a >> $DEBUG
+    $ECHO "Output of ip link show" >> $DEBUG
+    $IP link show >> $DEBUG
     $ECHO "---------------------------------------------" >> $DEBUG
     if [ "`uname -s`" = "Linux" ] ; then
         $ECHO "* The following section contains information about kernel modules" >> $DEBUG
@@ -85,8 +85,8 @@ if [ "$DEBUG" = "1" ] ; then
     $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 netstat -n -r" >> $DEBUG
-    netstat -n -r >> $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
Index: rp-pppoe-3.12/scripts/pppoe-status
===================================================================
--- rp-pppoe-3.12.orig/scripts/pppoe-status	2015-11-11 16:10:02.000000000 +0100
+++ rp-pppoe-3.12/scripts/pppoe-status	2022-01-20 11:37:25.936150975 +0100
@@ -21,6 +21,7 @@
 
 # Defaults
 CONFIG=/etc/ppp/pppoe.conf
+PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH IP=`which ip`
 
 case "$#" in
     1)
@@ -66,14 +67,13 @@ for i in /etc/ppp/ppp*.pid /var/run/ppp*
 	PID=`cat $i`
 	if [ "$PID" = "$PPPD_PID" ] ; then
 	    IF=`basename $i .pid`
-	    netstat -rn | grep " ${IF}\$" > /dev/null
-	    # /sbin/ifconfig $IF | grep "UP.*POINTOPOINT" > /dev/null
+	    $IP route | grep "dev ${IF}" > /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"
-	    /sbin/ifconfig $IF
+	    $IP link show $IF
 	    exit 0
 	fi
     fi
Index: rp-pppoe-3.12/src/configure
===================================================================
--- rp-pppoe-3.12.orig/src/configure	2015-11-11 16:10:03.000000000 +0100
+++ rp-pppoe-3.12/src/configure	2022-01-20 11:37:25.936150975 +0100
@@ -636,6 +636,7 @@ ID
 SETSID
 ECHO
 PPPD
+IP
 INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
@@ -3966,7 +3967,7 @@ if test "$ac_cv_pluginpath" = "yes" ; th
 fi
 
 if test "$ac_cv_pluginpath" = "yes" ; then
-    echo "*** Could not fined pppd/pppd.h anywhere... not building plugin"
+    echo "*** Could not find pppd/pppd.h anywhere... not building plugin"
     ac_cv_pluginpath=no
 fi
 
@@ -4364,6 +4365,49 @@ _ACEOF
 
 
 
+# Extract the first word of "ip", so it can be a program name with args.
+set dummy ip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_IP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $IP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_IP="$IP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
+for as_dir in $as_dummy
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_IP="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_IP" && ac_cv_path_IP="NOTFOUND"
+  ;;
+esac
+fi
+IP=$ac_cv_path_IP
+if test -n "$IP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IP" >&5
+$as_echo "$IP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
 # Extract the first word of "pppd", so it can be a program name with args.
 set dummy pppd; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
Index: rp-pppoe-3.12/src/configure.in
===================================================================
--- rp-pppoe-3.12.orig/src/configure.in	2015-11-11 16:10:03.000000000 +0100
+++ rp-pppoe-3.12/src/configure.in	2022-01-20 11:37:25.936150975 +0100
@@ -142,6 +142,9 @@ AC_CHECK_SIZEOF(unsigned short)
 AC_CHECK_SIZEOF(unsigned int)
 AC_CHECK_SIZEOF(unsigned long)
 
+dnl Check for location of ip
+AC_PATH_PROG(IP, ip, NOTFOUND, $PATH:/bin:/sbin:/usr/bin:/usr/sbin)
+
 dnl Check for location of pppd
 AC_PATH_PROG(PPPD, pppd, NOTFOUND, $PATH:/sbin:/usr/sbin:/usr/local/sbin)
 AC_PATH_PROG(ECHO, echo, echo)
Index: rp-pppoe-3.12/src/pppoe.c
===================================================================
--- rp-pppoe-3.12.orig/src/pppoe.c	2015-11-11 16:10:04.000000000 +0100
+++ rp-pppoe-3.12/src/pppoe.c	2022-01-20 11:37:25.936150975 +0100
@@ -669,10 +669,10 @@ main(int argc, char *argv[])
 	exit(EXIT_SUCCESS);
     }
 
-    /* Set signal handlers: send PADT on HUP; ignore TERM and INT */
-    signal(SIGTERM, SIG_IGN);
-    signal(SIGINT, SIG_IGN);
-    signal(SIGHUP, sigPADT);
+    /* Set signal handlers: send PADT on HUP, TERM and INT */
+    signal(SIGTERM, sigPADT);
+    signal(SIGINT,  sigPADT);
+    signal(SIGHUP,  sigPADT);
     session(&conn);
     return 0;
 }
openSUSE Build Service is sponsored by