Summary: | /etc/init.d/net.eth0 alias handling | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Take Vos <Take.Vos> |
Component: | [OLD] Games | Assignee: | Martin Schlemmer (RETIRED) <azarah> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bangert, bugs.gentoo.org, clone, naanyaar2000 |
Priority: | High | ||
Version: | 1.0 | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Take Vos
2002-09-03 03:53:59 UTC
I see ipv6 numbers can be handled the same way Maybe iface_eth0 should be renamed inet4_eth0 or inet_eth0 for consistancy. Without trying to be offensive, net.eth0 is already too complex for my taste. It should be a generic scipt that works for *most* people. If you need more, it is CONFIG_PROTECTed, and thus wont get overwritten. As for the inet4* stuff .. it will be considered, but changing it at this stage of the game could result in confusion, and breakage. I agree with you about the complexity of the net.eth0 script When writing net.sit1 (ipv6 tunneling) I came to the conclusion that I was duplicating things from net.eth0. I don't think changing the way aliasing works would cause much of a problem, you could add my piece of code to the original one, as it uses different settings from /etc/conf.d/net. The put warning marks when it enters the original settings. And add comments to /etc/conf.d/net. I would like to take a shot at refactoring the net scripts, so that we can get a consistant and easy configuration for the different protocols, keep a temporary compatibility with the old configuration, and make the scripts simple. To be honest, I thought about it again after posting last message. There is a better solution than the current. ---------------------------new alias code----------------------------------- if [ -n "$(eval echo \$\{alias_${IFACE}\})" ] then local x="" local num=0 local aliasbcast="" local aliasnmask="" ebegin " Adding aliases" for x in $(eval echo \$\{alias_${IFACE}\}) do aliasbcast="$(eval echo \$\{broadcast_${IFACE}\} \| awk \'\{ print \$${num} \}\')" if [ -n "${aliasbcast}" ] then aliasbcast="broadcast ${aliasbcast}" fi aliasnmask="$(eval echo \$\{netmask_${IFACE}\} \| awk \'\{ print \$${num} \}\')" if [ -n "${aliasnmask}" ] then aliasnmask="netmask ${aliasnmask}" fi ebegin " ${IFACE}:${num}" /sbin/ifconfig ${IFACE}:${num} ${x} \ ${aliasbcast} ${aliasnmask} >/dev/null num=$((num + 1)) eend 0 done save_options "alias" "$(eval echo \$\{alias_${IFACE}\})" fi ------------------------------------------------------------------------------ thus you alias config could look like follow: ------------------------------------------------------- alias_eth0="10.0.0.23 192.168.0.33" broadcast_eth0="10.0.0.255 192.168.0.255" netmask_eth0="255.0.0.0 255.255.255.0" ------------------------------------------------------- If broadcast_eth? or netmask_eth? is null, $aliasbcast $aliasnmask will be null as well, and it should work as without giving them as args. Comments welcome. *** Bug 8030 has been marked as a duplicate of this bug. *** The awk bits above: awk \'\{ print \$${num} \}\' should actually be: awk \'\{ print \$$((num+1)) \}\' Otherwise, it will not work for multiple aliases bound to the same interface ($0 == full record). True, thanks. The above bug ($num) is a show stopper ! It appeared on one of my production server and some daemons didn't start anymore (bind address didn't exist)... Please correct this ASAP ! It is on CVS. Ill do a new baselayout still this weekend. Edit it by hand for now, thanks. *** Bug 9128 has been marked as a duplicate of this bug. *** *** Bug 11893 has been marked as a duplicate of this bug. *** ... still having problems with this on baselayout 1.8.5.8 Explain ? Attach your net.eth0 please. *** Bug 14636 has been marked as a duplicate of this bug. *** I dont see a problem. Reopen if you actually want to explain your problem, and needed info. |