* Help with udev dev.d and net script
@ 2004-12-30 16:28 Walt H
2004-12-30 18:14 ` Kay Sievers
2004-12-30 21:17 ` Walt H
0 siblings, 2 replies; 3+ messages in thread
From: Walt H @ 2004-12-30 16:28 UTC (permalink / raw)
To: linux-hotplug
Hello,
I've been struggling to try to get a shell script executed when my
system starts it network interfaces. I'm running kernel 2.6.10 with
udev-050 and the 20040923 hotplug scripts on a Gentoo based system. I've
got 2 Intel e100 network interfaces (using kernel modules), one of which
connects to my DSL modem and gets its IP address dynamically via DHCP.
My ISP can be very slow in giving an IP address (30-45 seconds), which
causes a problem with my firewall script, which is automatically
generated by fwbuilder. What I've been trying to do, is execute a script
under /etc/dev.d/ for my eth1 interface, which sleeps until the
interface gets an IP address, and then runs the firewall script.
Unfortunately, the firewall script needs an IP address for the interface
to operate correctly, and without one, no traffic in or out will pass
through this box.
I've tried putting the script in /etc/dev.d/eth1/ /etc/dev.d/net/eth1
etc... but it never gets executed. I could brute force the issue by
modifying a hotplug script or init script, but don't want to have to do
this after each upgrade and the udev /etc/dev.d stuff seemed
appropriate. What am I doing wrong?
My init scripts can be executed in parallel, which is what contributes
to this problem I believe, as additional startup scripts may be executed
before the interface is fully brought up. I could stop that I suppose,
but I want to know why the dev.d stuff isn't working first I guess :)
Thanks in advance,
-Walt
### /etc/dev.d/eth1/startfirewall.dev script follows:
#!/bin/bash
LOGFILE=/tmp/eth1-udev.log
echo `date` ": Starting fwbuilder firewall script...." >> $LOGFILE
NETUP=0
while [ $NETUP -eq 0 ]; do
IP=`/sbin/ip -4 addr show dev eth1 | tail -n1` &> /dev/null
if ! test -z "$IP"; then
NETUP=1
echo `date` ": eth1 up with IP: $IP" >> $LOGFILE
else
echo `date` ": eth1 not up yet. Will retry in 10s..." >>
$LOGFILE
sleep 10
fi
done
echo `date` ": Activating firewall script now..." >> $LOGFILE
/etc/fwbuilder/Holman\ Network.fw &> /dev/null
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Help with udev dev.d and net script
2004-12-30 16:28 Help with udev dev.d and net script Walt H
@ 2004-12-30 18:14 ` Kay Sievers
2004-12-30 21:17 ` Walt H
1 sibling, 0 replies; 3+ messages in thread
From: Kay Sievers @ 2004-12-30 18:14 UTC (permalink / raw)
To: linux-hotplug
On Thu, 2004-12-30 at 10:28 -0600, Walt H wrote:
> What I've been trying to do, is execute a script
> under /etc/dev.d/ for my eth1 interface,
udev will not execute dev.d/ scripts for network interfaces if you don't
use udev to rename the interface. You need to hook into the hotplug call
not the udev notifier.
Kay
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Help with udev dev.d and net script
2004-12-30 16:28 Help with udev dev.d and net script Walt H
2004-12-30 18:14 ` Kay Sievers
@ 2004-12-30 21:17 ` Walt H
1 sibling, 0 replies; 3+ messages in thread
From: Walt H @ 2004-12-30 21:17 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers wrote:
>On Thu, 2004-12-30 at 10:28 -0600, Walt H wrote:
>
>
>>What I've been trying to do, is execute a script
>>under /etc/dev.d/ for my eth1 interface,
>>
>>
>
>udev will not execute dev.d/ scripts for network interfaces if you don't
>use udev to rename the interface. You need to hook into the hotplug call
>not the udev notifier.
>
>Kay
>
>
>
>
Thanks for the quick reply Kay. I could've sworn I read at one point
that I could do it with udev :) Oh well, I guess I'll look into the
hotplug interface instead. Thanks,
-Walt
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-12-30 21:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-30 16:28 Help with udev dev.d and net script Walt H
2004-12-30 18:14 ` Kay Sievers
2004-12-30 21:17 ` Walt H
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).