On 5/18/11 12:28 AM, Bryan Kadzban wrote:
> Anybody know how other distros do it?  I can't figure out what Debian's
> ifdown binary is supposed to do (its source is *extremely* obfuscated,
> being built from a texinfo file, and containing a file parser)...

Fedora does a much more elaborate version of what I included in my 
adjusted scripts. First it checks to see what type of a network device 
it is and then process a specific down script for that device type.

In the Ethernet type, which is default, they check to see if dhcp is 
running and if the device has a lease and if so release it. Then they have:

# we can't just delete the configured address because that address
# may have been changed in the config file since the device was
# brought up.  Flush all addresses associated with this
# instance instead.
if [ -d "/sys/class/net/${REALDEVICE}" ]; then
         if [ "${REALDEVICE}" = "${DEVICE}" ]; then
                 ip addr flush dev ${REALDEVICE} 2>/dev/null
         else
                 ip addr flush dev ${REALDEVICE} label ${DEVICE} 2>/dev/null
         fi

         if [ "${SLAVE}" = "yes" -a -n "${MASTER}" ]; then
                 echo "-${DEVICE}" > 
/sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
         fi

         if [ "${REALDEVICE}" = "${DEVICE}" ]; then
                 ip link set dev ${DEVICE} down 2>/dev/null
         fi
fi

After that they also check for any specific bridging rules and handle 
that as well.

JH
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to