Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 34607 - net.eth0 lacks "miscellaneous" setup option
Summary: net.eth0 lacks "miscellaneous" setup option
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All All
: High enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-28 01:31 UTC by Frank Benkstein
Modified: 2004-10-05 08:35 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Benkstein 2003-11-28 01:31:04 UTC
The network startup scripts net.eth0 and its clones lack some kind
of miscellaneous setup option. For example there could be some variables in /etc/conf.d/net where one can do sth like

iface_eth0_pre_up="/sbin/ifconfig eth0 hw ether XX:XX:XX:XX:XX:XX"
or
iface_eth0_post_up="/sbin/route add net_to_default_gateway"
or even
iface_eth0_post_up="/sbin/brctl addif br0 eth0"

instead of hard coding it to the scripts.

Having this options would be nice because all network configuration options
except for ppp should stay in /etc/conf.d/net.

Thanks and bye
Frank Benkstein.
Comment 1 Frank Benkstein 2004-04-25 08:46:09 UTC
Obviously new baselayout 1.8.11 adds {pre,post}{up,down} functions to net.eth0 which is I think the best way to do it. Thank you.

It lacks documentation so I'm putting the solution to one of my problems here.

In /etc/conf.d/net:
<code>
# this function is executed for every network interface before bringing it up
function preup () {
case "$1" in
        eth1)   
                # this is not automatically created, is it?
                [ ! -d ${svcdir}/options/net.$1 ] && mkdir -p \
                                                ${svcdir}/options/net.$1
                # saving real hw address
                /sbin/ifconfig $1 | awk '/^'$1'/ {print $5}' > \
                                                ${svcdir}/options/net.$1/real-hw
                # setting new, fake hw address
                /sbin/ifconfig $1 hw ether XX:XX:XX:XX:XX:XX
                ;;
esac
}

# this function is executed for every network interface after bringing it down
function postdown() {
case "$1" in
        eth1)
                /sbin/ifconfig $1 hw ether \
                   `cat ${svcdir}/options/net.eth1/real-hw`                                      ;;                                                               
esac                                                                            
}
</code>

Should I work out the bridging example, too?

Btw.: I'm behind a firewall I don't have access to which restricts internet access by mac address checking. I still have the network card whose mac address is registered with the firewall but I'm both too lazy to find it and to tell the admin the new mac ;-).

PS: I think this bug can be marked as fixed.
Comment 2 Aron Griffis (RETIRED) gentoo-dev 2004-06-26 15:47:09 UTC
Ok, full documentation for preup/predown/postup/postdown is now in /etc/conf.d/net as of baselayout-1.10