Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] net.eth0 stop doesn't stop ADSL
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
takefive
n00b
n00b


Joined: 17 May 2011
Posts: 4

PostPosted: Tue May 17, 2011 10:49 am    Post subject: [SOLVED] net.eth0 stop doesn't stop ADSL Reply with quote

Hello.

I use the adsl module for connecting to the Internet. The problem is that "/etc/init.d/net.eth0 stop" does only this:
* Bringing down interface eth0

In the past it used to do something like:
* Bringing down interface eth0
* adsl...
* Stopping ADSL for eth0

I don't know why it isn't working anymore, but II think it might be related with openrc migration.

It's important for me to stop ADSL because I won't be able to re-connect for the next five minutes if I don't shut down the connection nicely, and this will be anoying after a restart.

Thanks


Last edited by takefive on Wed May 18, 2011 5:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
devilheart
l33t
l33t


Joined: 17 Mar 2005
Posts: 837
Location: Villach, Austria

PostPosted: Tue May 17, 2011 8:57 pm    Post subject: Reply with quote

I guess you have an ethernet adsl modem plugged to you ethernet NIC ad you use PPPoE. Is this correct?
Back to top
View user's profile Send private message
takefive
n00b
n00b


Joined: 17 May 2011
Posts: 4

PostPosted: Tue May 17, 2011 10:02 pm    Post subject: Reply with quote

No, I have just the NIC and use PPPoE.
Back to top
View user's profile Send private message
takefive
n00b
n00b


Joined: 17 May 2011
Posts: 4

PostPosted: Wed May 18, 2011 12:09 pm    Post subject: Reply with quote

Ok, after some digging I figured out the problem.
This is a fragment from /lib/rc/net/adsl.sh :

Code:

adsl_start()
{
   local exe= cfgfile= user=

   adsl_setup_vars start || return 1

   # Might or might not be set in conf.d/net
   eval user=\$adsl_user_${IFVAR}

   # Start ADSL with the cfgfile, but override ETH and PIDFILE
   einfo "Starting ADSL for ${IFACE}"
   (
   cat "${cfgfile}";
   echo "ETH=${IFACE}";
   echo "PIDFILE=/var/run/rp-pppoe-${IFACE}.pid";
   [ -n "${user}" ] && echo "USER=${user}";
   ) | ${exe} > /root/out #/dev/null
   eend $?
}

adsl_stop()
{
   local exe= cfgfile=

   [ ! -f /var/run/rp-pppoe-"${IFACE}".pid ] && return 0

   adsl_setup_vars stop || return 1

   einfo "Stopping ADSL for ${IFACE}"
   (
   cat "${cfgfile}";
   echo "ETH=${IFACE}";
   echo "PIDFILE=/var/run/rp-pppoe-${IFACE}.pid";
   ) | ${exe} >/dev/null
   eend $?

   return 0
}


I found out that adsl_stop() is called after all, but it fails at the line "[ ! -f /var/run/rp-pppoe-"${IFACE}".pid ] && return 0". So it doesn't find the pid file.
We see in adsl_start() that the entire config file (/etc/ppp/pppoe.conf) with an additional three lines (including the one that sets the pid file) is sent through a pipe to ${exe}, which is /usr/bin/pppoe-start.

Now let's take a look at /usr/bin/pppoe-start:

Code:

# Defaults
CONFIG=/etc/ppp/pppoe.conf
USER=""

...

# Sort out command-line arguments
case "$#" in
    1)
   CONFIG="$1"
   ;;
    3)
   CONFIG="$3"
   ;;
esac

# In Gentoo, CONFIG is a named pipe when pppoe is started by the
# network scripts.  Testing -r is allowed; testing -f is not.
if [ ! -r "$CONFIG" ] ; then
    $ECHO "$ME: Cannot read configuration file '$CONFIG'" >& 2
    exit 1
fi

# Read the named pipe (/dev/fd/foo) into a variable so we can use it
# again later (since reading once from the pipe will exhaust it)
CONFREAD=$(<$CONFIG)
eval "$CONFREAD"


We see that this file doesn't read anything from any pipe. It doesn't receive any command line arguments either. So it just uses the default CONFIG, which is /etc/ppp/pppoe.conf.
Although the comment says that CONFIG is a named pipe it turns out it isn't.
So I changed the PIDFILE defined there to "/var/run/rp-pppoe-eth0.pid" and now it works.
Back to top
View user's profile Send private message
devilheart
l33t
l33t


Joined: 17 Mar 2005
Posts: 837
Location: Villach, Austria

PostPosted: Wed May 18, 2011 5:50 pm    Post subject: Reply with quote

Glad it works. If it is all ok remember to add [solved] tag to thread title
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum