Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Maintainer of `/etc/init.d/net.* ` scripts
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
HogRider
Apprentice
Apprentice


Joined: 29 May 2002
Posts: 160

PostPosted: Tue Jun 15, 2004 9:03 pm    Post subject: Maintainer of `/etc/init.d/net.* ` scripts Reply with quote

I haven't worked out which package updates/creates the `/etc/init.d/net.* ` scripts, but I've made a workable (for me) modifications and thought I'd pass it along.

I'm predominantly attached(?) to wireless networks, and I needed a convienent way to inject the essid during the boot process. In keeping with the rest of the Gentoo design, I store the essid in the `/etc/conf.d/net`, and reference the variable from the init script.

Variable added to `/etc/conf.d/net` - essid_$IFACE

Modification to init script -
Code:
#!/sbin/runscript

<snip>>>>>>>>>>>>>>>>>>>>>>>
iface_start() {
        local retval=0

        setup_env ${1}
        checkconfig || return 1

        local IFACE="${1}"
        ebegin "Bringing ${IFACE} up"
###########################################
         if [ -n "${essid_IFACE}" ]
                then
                local x=""
                ebegin "  Adding ESSID "
                for x in ${essid_IFACE}
                do
                /usr/sbin/iwconfig ${IFACE}  essid ${essid_IFACE} > /dev/null
                eend 0
                done
        fi
##########################################
        if [ "${iface_IFACE}" != "dhcp" ]
        then
                /sbin/ifconfig ${IFACE} ${iface_IFACE} >/dev/null || {
                        retval=$?
                        eend ${retval} "Failed to bring ${IFACE} up"
                        return ${retval}
                }
                # ifconfig do not always return failure ..
                /sbin/ifconfig ${IFACE} &> /dev/null || {
                        retval=$?
                        eend ${retval} "Failed to bring ${IFACE} up"
                        return ${retval}
                }
        else
                # Check that eth0 was not brough up by the kernel ...
                if [ "${status_IFACE}" != "up" ]
                then
                        /sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE} >/dev/null || {
                                retval=$?
                                eend ${retval} "Failed to bring ${IFACE} up"
                                return ${retval}
                        }
                fi
        fi
        eend 0
<snip>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


One key item, set the essid before dhcpcd and the interface will work perfectly (provided you have the correct essid, gotta work on that).

I realize it's a simple plug, but that's why I'm amazed it hasn't already been done. Now, if we could only select/override the network interface during the boot......
_________________
Mike

"Computers are like air conditioners, they stop working properly if you open Windows"
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'


Last edited by HogRider on Tue Jun 15, 2004 9:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
Deathwing00
Bodhisattva
Bodhisattva


Joined: 13 Jun 2003
Posts: 4087
Location: Dresden, Germany

PostPosted: Tue Jun 15, 2004 9:12 pm    Post subject: Reply with quote

I would advise you open a bug report at https://bugs.gentoo.org
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6765
Location: Blighty

PostPosted: Wed Jun 16, 2004 12:00 am    Post subject: Re: Maintainer of `/etc/init.d/net.* ` scripts Reply with quote

HogRider wrote:
I haven't worked out which package updates/creates the `/etc/init.d/net.* ` scripts


It's in baselayout

Quote:

I realize it's a simple plug, but that's why I'm amazed it hasn't already been done. Now, if we could only select/override the network interface during the boot......


It already has - it's just not in portage yet.

My ebuild puts provides an overlay for wireless networking that plugs into Gentoo's net.eth0 script via preup() and predown() functions that net.eth0 provides.

It scans for AP's and then configures wep and networking accordingly

Example

AP Home - static IP, no WEP key
AP Work - dhcp + WEP key
AP Friend - static IP + WEP key + gateway + nameserver + routing

All possible with my ebuild - linked in my .sig :)
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
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