linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Walt H <walt_h@lorettotel.net>
To: linux-hotplug@vger.kernel.org
Subject: Help with udev dev.d and net script
Date: Thu, 30 Dec 2004 16:28:05 +0000	[thread overview]
Message-ID: <41D42C95.20206@lorettotel.net> (raw)

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

             reply	other threads:[~2004-12-30 16:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-30 16:28 Walt H [this message]
2004-12-30 18:14 ` Help with udev dev.d and net script Kay Sievers
2004-12-30 21:17 ` Walt H

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41D42C95.20206@lorettotel.net \
    --to=walt_h@lorettotel.net \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).