#!/bin/sh # ifdown DEVICE=${1} BRCTL=/usr/sbin/brctl # Source functions library source /etc/rc.d/init.d/functions log_script_name "$0 $*" # Load network interface card parameters source /etc/sysconfig/network/ifconfig.${DEVICE} # Load DHCP client parameters source /etc/sysconfig/network/dhcp-client # Make sure DHCP client is available. if [ ! -x ${DHCP_PROG} ]; then echo "Program \"${DHCP_PROG}\" is not executable." exit ${EXIT_CODE_FAILURE} fi # Check that the brctl program is present and executable. check_brctl() { if [ ! -x ${BRCTL} ]; then msg_log "*** ERROR: /usr/sbin/brctl not found." exit ${EXIT_CODE_FAILURE} fi } # First make sure interface is available if ! ip link show ${DEVICE} 1> /dev/null 2>&1 ; then echo "Interface ${DEVICE} not available" exit ${EXIT_CODE_WARNING} fi case ${BOOTPROTO} in dhcp) cmd_run_log ${DHCP_PROG} ${DHCP_STOP} ${DEVICE} || \ exit ${EXIT_CODE_FAILURE} ;; wifi) cmd_run_log ${DHCP_PROG} ${DHCP_STOP} ${DEVICE} || \ exit ${EXIT_CODE_FAILURE} echo "Stopping wpa_supplicant" killall wpa_supplicant ;; static) ;; pppoe) cmd_run_log pppoe-stop ;; *) echo "Invalid BOOTPROTO value: ${BOOTPROTO}" exit ${EXIT_CODE_FAILURE} esac cmd_run_log ip addr flush ${DEVICE} || exit ${EXIT_CODE_FAILURE} cmd_run_log ip link set ${DEVICE} down || exit ${EXIT_CODE_FAILURE} # Determining if the interface is part of a bridge: if [ -n "${BRIDGE_TO}" ]; then check_brctl cmd_run_log ${BRCTL} delif ${BRIDGE_TO} ${1} || exit 1 fi # Determining if the interface is a bridge: if [ "x${BRIDGE}" = "xyes" ]; then # Check that the brctl program is present and executable. if [ ! -x ${BRCTL} ]; then msg_log "*** ERROR: /usr/sbin/brctl not found." exit ${EXIT_CODE_FAILURE} fi cmd_run_log ${BRCTL} delbr ${1} fi exit $?