PageRenderTime 28ms CodeModel.GetById 25ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/network/if-up.d/ifupdown-scripts-zg2-30link

http://github.com/brinkman83/bashrc
#! | 36 lines | 32 code | 4 blank | 0 comment | 0 complexity | db950cb82f3f61eed43e6a121975e05c MD5 | raw file
 1#!/bin/bash
 2# $Header$
 3
 4# IFACE      = Logical interface name
 5# MODE       = start | stop
 6# METHOD     = manual, otherwise exit!
 7# IF_ADDRESS = address/prefix
 8# IF_DEVICE  = physical interface name
 9# IF_SCOPE   = scope of address
10# IF_BRD     = broadcast address (all1 default, all0/none allowed)
11# IF_FLAGS   = "secondary"
12
13. /etc/network/ifupdown-scripts-zg2.d/common-functions
14
15case "$MODE" in
16  start)
17    cmd "ip link set dev \"$IF_DEVICE\" up"
18    ;;
19  stop)
20    DEV=$(state_entry dev)
21    if [ -n "$DEV" ]; then
22      if has_ip_address "$DEV"; then
23        # device doesn't have any more IP addresses
24        if ! is_active_vlan_master "$DEV"; then
25          # if we take down an interface that is an active vlan master,
26	  # we take down all VLANs. Not a good idea.
27          cmd "ip link set dev $DEV down"
28	fi
29      fi
30    fi
31    ;;
32  *)
33    ;;
34esac
35
36# end of file