Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 108737 - netplug script bugs
Summary: netplug script bugs
Status: VERIFIED LATER
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Roy Marples (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-10 08:44 UTC by Patrizio Bassi
Modified: 2005-10-11 09:56 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
new netplug init script (netplugd,3.61 KB, text/plain)
2005-10-10 09:42 UTC, Roy Marples (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrizio Bassi 2005-10-10 08:44:01 UTC
after installing netplug i found some problems. 
 
my config: eth0 and eth1 have 0.0.0.0 as ip. 
the 2 interfaces are bridged with "blight" bridge. all works good. 
 
bugs found: 
1) with my config eth0/1 start always returns 1. 
after line 83 in netplug module i put 
 
        start-stop-daemon --start --exec /sbin/netplugd \ 
                --pidfile "${pidfile}" \ 
                -- -i "${iface}" -P -p "${pidfile}" -c /dev/null 
        eend $? 
        return $? 
 
and this makes it return 0 correctly, skipping the rest of function 
 
after having eth0 and 1 working i tried to start my bridge 
 
2)  
/etc/init.d/net.blight start 
 * Starting eth0 
 *   Starting netplug on eth0 ...                                                                                     [ ok ] 
 *   Bringing up eth0 
 *     0.0.0.0                                                                                                        [ ok ] 
 * Starting eth1 
 *   Starting netplug on eth1 ...                                                                                     [ ok ] 
 *   Bringing up eth1 
 *     0.0.0.0                                                                                                        [ ok ] 
 * ERROR:  Problem starting needed services. 
 *         "net.blight" was not started. 
 
bridge doesn't start. 
 
 
actually i just moved the netplugd name, so netplug script exit immediatly. 
it would be interesting to say "not to monitor" the bridge interface 
that should be always up.
Comment 1 Roy Marples (RETIRED) gentoo-dev 2005-10-10 09:42:04 UTC
Created attachment 70299 [details]
new netplug init script

remove all netplug* files from /lib/rcscripts/net.modules.d and then put this
new file in.

New version checks to see if there is a valid MAC address and refuses to work
on bridge and tuntap interfaces.
Comment 2 Patrizio Bassi 2005-10-10 11:42:21 UTC
i get errors and netplugd doesn't start so  
  
  
  
/etc/init.d/net.blight start  
 * Caching service dependencies ...                                                                                   [ ok ]  
 * Starting eth0  
 *     netplug does not support the required function check_installed  
 *   Bringing up eth0  
 *     0.0.0.0                                                                                                        [ ok ]  
 * Starting eth1  
 *     netplug does not support the required function check_installed  
 *   Bringing up eth1  
 *     0.0.0.0                                                                                                        [ ok ]  
 * Starting blight  
 *     netplug does not support the required function check_installed  
 *   Creating bridge blight ...                                                                                       [ ok ]  
 *   Adding ports to blight  
 *     eth0 ...                                                                                                       [ ok ]  
 *     eth1 ...                                                                                                       [ ok ]  
 *   Bringing up blight  
 *     172.16.92.100             
Comment 3 Roy Marples (RETIRED) gentoo-dev 2005-10-10 11:54:16 UTC
cd /lib/rcscripts/net.modules.d
mv netplug netplugd

Try that
Comment 4 Patrizio Bassi 2005-10-10 14:20:54 UTC
now i get: 
 
/etc/init.d/net.blight start 
 * Starting eth0 
 *   Starting netplug on eth0 ...                                                                                     [ ok ] 
 *     Failed to configure eth0 in the background                                                                     
[ !! ] 
 * Starting eth1 
 *   Starting netplug on eth1 ...                                                                                     [ ok ] 
 *     Failed to configure eth1 in the background                                                                     
[ !! ] 
 * ERROR:  Problem starting needed services. 
 *         "net.blight" was not started. 
 
 
 
same error as before. i wrote what i need to do to bypass ip check and similar.. 
Comment 5 Roy Marples (RETIRED) gentoo-dev 2005-10-10 14:46:00 UTC
Could you attach your conf.d/net file to this bug please
Comment 6 Patrizio Bassi 2005-10-11 00:34:36 UTC
config_eth0="0.0.0.0" 
config_eth1="0.0.0.0" 
config_blight="172.16.92.100 broadcast 172.16.92.255 netmask 255.255.255.0" 
bridge_blight="eth0 eth1" 
 
depend_blight() { 
   need net.eth0 net.eth1 
} 
 
consider another problem, if the netplug stuff will be fixed. 
this way eth0/1 down will make bridge go down. and this should never happen... 
Comment 7 Roy Marples (RETIRED) gentoo-dev 2005-10-11 01:49:19 UTC
OK, the issue is that 0.0.0.0 is mistakenly being reported as being used on the
lan interfaces. This will be fixed in the next release.

There is a workaround though, like so

config_eth0=( "null" )
config_eth1=( "null" )

If you don't want netplug or ifplugd to control your interfaces (ie bring them
up or down) then you can add this
modules=( "!netplugd" "!ifplugd" )

This stops the bridge being taken down if an interface cable is pulled.
Comment 8 Roy Marples (RETIRED) gentoo-dev 2005-10-11 01:51:24 UTC
You can always change the dep from need to after (or try use as well) instead of
disabling netplugd/ifplugd as that should keep the bridge up.
Comment 9 Patrizio Bassi 2005-10-11 02:07:50 UTC
even with null address i have  
 
/etc/init.d/net.eth0 start 
 * Starting eth0 
 *   Starting netplug on eth0 ...                                                                                     [ ok ] 
 *     Failed to configure eth0 in the background     
 
and the scripts lasts a lot of time. (yes is see that's a timer..) 
 
the nice thing it that eth0 and netplug are started. script is still bugged 
Comment 10 Roy Marples (RETIRED) gentoo-dev 2005-10-11 02:20:15 UTC
Is netplug bringing up the interface at all?

Check by doing this

grep netplug /var/log/messages | tail -n 10

(/var/log/messages may or may not be your default log file)
Attach the results here.
Comment 11 Patrizio Bassi 2005-10-11 02:39:41 UTC
syslog:Oct 11 11:05:44 blight netplugd[19263]: /etc/netplug.d/netplug eth0 in -> pid 
19263 
syslog:Oct 11 11:05:46 blight netplugd[19262]: eth0: state INNING flags 0x00001043 
UP,BROADCAST,RUNNING,MULTICAST -> 0x00001003 
UP,BROADCAST,MULTICAST 
syslog:Oct 11 11:05:55 blight netplugd[19262]: eth0: state WAIT_IN pid 19263 exited 
status 0 
syslog:Oct 11 11:05:55 blight netplugd[19828]: /etc/netplug.d/netplug eth0 out -> pid 
19828 
syslog:Oct 11 11:06:21 blight netplugd[19262]: eth0: state OUTING pid 19828 exited 
status 0 
 
eth0 and netplugd are up...it's a script problem ihmo 
Comment 12 Roy Marples (RETIRED) gentoo-dev 2005-10-11 02:55:37 UTC
OK, that shows that netplug is bringing eth0 down - which it should not be

I do not get this issue with my natsemi adapter, so it may also be a nic driver
issue (I'm not ruling out that it maybe a script issue).
Comment 13 Patrizio Bassi 2005-10-11 03:25:20 UTC
no it's not a driver problem.  
  
i had no cable plugged, so it starts, polls and stops...  
  
the strange thing is: why eth0 keeps on? 
Comment 14 Roy Marples (RETIRED) gentoo-dev 2005-10-11 03:45:05 UTC
OK, it's working fine then :)

As I said, if you don't want this behaviour then unmerge netplug or disable it
on the bridge interfaces using the modules=( "!netplugd" ) statement
Comment 15 Roy Marples (RETIRED) gentoo-dev 2005-10-11 03:50:56 UTC
Why it keeps on? It's marked as "inactive"

This is so the netplug can start and stop the script depending on cable being
in/out. It also sets a special variable so it does not re-spawn netplug when
starting it, and it does not kill it or bring down the interface when stopping it.

ifplugd and wpa_supplicant also work like this
Comment 16 Patrizio Bassi 2005-10-11 03:58:55 UTC
no wait....if netplug shutdown the eth0...it's ok...it's its job.  
  
the problem is that the rc-script doesn't work, returns 1.  
and eth0 is still up.  
  
this is the problem.  
  
should be:  
1)eth0 starts, and it's up  
2) netplug starts, checks and shutdown eth0  
3) net.eth0 script finishes with status 0 and make net.eth0 service as started, so other 
services can be started. 
  
this doesn't happen  
Comment 17 Roy Marples (RETIRED) gentoo-dev 2005-10-11 04:16:56 UTC
And that won't happen. Netplug is doing it's job as designed. It's marking eth0
as "inactive" so that scripts that depend on it will fail.

This is behaviour by design.

Maybe we can solve this another way?
Try this config - remove any existing


config_blight=( "172.16.92.100 broadcast 172.16.92.255 netmask 255.255.255.0" )
# Set at least one option to ensure that a bridge is created as we are not
specifying and ports
brctl_blight=( "setfd 0" "sethello 0" "stp off" )

config_eth0=( "null" )
bridge_add_eth0="blight"

config_eth1=( "null" )
bridge_add_eth1="blight"


You could also do this if you wanted to
depend_eth0() {
   after net.blight
}
depend_eth1() {
   after net.blight
}


What we've done is created a bridge without any ports. When eth0 comes up, we've
added it to the bridge - this is controlled by netplug

HTH
Comment 18 Roy Marples (RETIRED) gentoo-dev 2005-10-11 04:17:50 UTC
change

specifying and ports

to

# specifying and ports
Comment 19 Patrizio Bassi 2005-10-11 05:37:10 UTC
i continue to repeat that it's not the way netplug should work. 
 
service should be started return 0, THEN netplug should put it on/off. 
 
but service should be started, because it is! 
Comment 20 Roy Marples (RETIRED) gentoo-dev 2005-10-11 05:47:56 UTC
I you really want that behaviour, you can do this

plug_timeout_eth0="-1"
plug_timeout_eth1="-1"
Comment 21 Patrizio Bassi 2005-10-11 06:00:47 UTC
/etc/init.d/net.eth0 start 
 * Starting eth0 
 *   Starting netplug on eth0 ...                                                                                     [ ok ] 
 *     WARNING: negative timeout set for eth0 
root@blight conf.d # echo $? 
1 
 
we are near solution :) 
Comment 22 Patrizio Bassi 2005-10-11 06:03:39 UTC
oops no... 
 
/etc/init.d/net.blight start 
 * Starting blight 
 *   Creating bridge blight ...                                                                                       [ ok ] 
 *   Bringing up blight 
 *     172.16.92.100         
 
 
root@blight conf.d # /etc/init.d/net.eth0 start 
 * Starting eth0 
 *   Starting netplug on eth0 ...                                                                                     [ ok ] 
 *     WARNING: negative timeout set for eth0 
root@blight conf.d # /etc/init.d/net.eth1 start 
 * Starting eth1 
 *   Starting netplug on eth1 ...                                                                                     [ ok ] 
 *     WARNING: negative timeout set for eth1 
root@blight conf.d # brctl show 
bridge name     bridge id               STP enabled     interfaces 
blight          8000.000000000000       no 
 
no device plugged to bridge... 
Comment 23 Roy Marples (RETIRED) gentoo-dev 2005-10-11 06:11:33 UTC
I'm guessing that's because the cable is unplugged still.

Try plugging cables in (ensure other end is active) and then you'll see them
magically added to the bridge.

BTW, with a negative timeout OR netplug failing (ie no cable) will always return
1 - this will not change and is not open to discussion for baselayout-1.12.x
series as changing it would break too many things.
Comment 24 Patrizio Bassi 2005-10-11 08:48:03 UTC
i'll try, i understand that baselayout must go stable, but "it breaks too many things" is not 
a valid excuse :) 
 
i think we can close, but that should be fixed in next baselayout versions. 
 
please notice and consider that. 
 
Thanks for help 
Comment 25 Roy Marples (RETIRED) gentoo-dev 2005-10-11 09:22:38 UTC
Let me put it another way.

If a daemon controls an interface then when it's not operatinal (not associated
to an access point, cable not plugged in, dhcp lost lease, etc) then it's marked
as "inactive" and marked as "started" when it is operational (associated to an
access point, cable plugged in, lease obtained).

We also know this by our return codes - "started" == 0 and anything else == 1.

Now, internally to baselayout-1.12.0 we no longer care about the return code -
we just check to see if service is marked as started or not - however other
scripts rely on the fact that if it returns 0 then it should be working.

Obviously it won't work if a cable is not plugged in, hence returning 1.

So I'm now going to mark this bug as CLOSED.
If you still have issue with this, then either debate with the rest of the
baselayout developers on #gentoo-base irc.freenode.net or email the gentoo-dev
list or open a new bug.

Here's a good title "rc script return codes for inactive interfaces" and make
your argument generic as wpa_supplicant, ifplugd and netplugd have to work the
same way.

If you want, you can edit /sbin/runscript.sh and change the return code on line
378 which should return the 0 you so desperately crave .... but you're going to
have to put forward a very good argument to get us to change it.
Comment 26 Patrizio Bassi 2005-10-11 09:56:10 UTC
ok i do agree. 
 
i'll be in chan, thanks for your support and patience, bee so kind :)