Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 2489

Summary: ethX alias contains incorrect netmask and broadcast address
Product: Gentoo Linux Reporter: Wim De Smet <wdesmet>
Component: [OLD] Core systemAssignee: Martin Schlemmer (RETIRED) <azarah>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Wim De Smet 2002-05-06 05:42:58 UTC
If the network paremeters as specified in the /etc/conf.d/net file 
do not contain default class A,B or C netmasks / broadcast adresses

ex. network : 10.10.10.10/29
resulting in 

iface_eth0="10.10.10.11 broadcast 10.10.10.17 netmask 255.255.255.248"

when aliases are added to the /etc/conf.d/net file the broadcast adress for the 
aliasses is set to 10.255.255.255 and the netmask is set to 255.0.0.0

ex. alias_eth0="10.10.10.12 10.10.10.13"

In order to resolve this beheaviour I added the following parameters 
to /etc/conf.d/net (quick workaround)

netmask_eth0="255.255.255.248"

broadcast_eth0="10.10.10.17"


and I altered the net.eth0 script : 


-------------------------------------------------------------
        if [ -n  "`eval echo \$\{netmask_${IFACE}\}`" ]
        then
               NM=`eval echo \$\{netmask_${IFACE}\}`
               ADD_netmask=" netmask  ${NM}"
        else
               ADD_netmask=""
        fi

        if [ -n  "`eval echo \$\{broadcast_${IFACE}\}`" ]
        then
               BC=`eval echo \$\{broadcast_${IFACE}\}`
               ADD_broadcast=" broadcast $BC"
        else
               ADD_broadcast=""
        fi

        if [ -n "`eval echo \$\{alias_${IFACE}\}`" ]
        then
                local x=""
                local num=0
                for x in `eval echo \$\{alias_${IFACE}\}`
                do
                        /sbin/ifconfig ${IFACE}:${num} $x $ADD_broadcast 
$ADD_netmask
                        num=$((num + 1))
                done
        fi
------------------------------------------------------------------------
instead of 
------------------------------------------------------------------------
        if [ -n "`eval echo \$\{alias_${IFACE}\}`" ]
        then
                local x=""
                local num=0
                for x in `eval echo \$\{alias_${IFACE}\}`
                do
                        /sbin/ifconfig ${IFACE}:${num} $x
                         num=$((num + 1))
                done
        fi
------------------------------------------------------------------------
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2002-05-10 16:52:07 UTC
Fixed on CVS.