File: link

package info (click to toggle)
ifupdown-scripts-zg2 0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 500 kB
  • ctags: 76
  • sloc: sh: 3,606; makefile: 35
file content (30 lines) | stat: -rw-r--r-- 642 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# $Header$

# MODE       = start | stop
# IF_DEVICE  = physical interface name

. /etc/network/ifupdown-scripts-zg2.d/common-functions

case "$MODE" in
  start)
    cmd "ip link set dev \"$IF_DEVICE\" up"
    ;;
  stop)
    DEV=$(state_entry dev)
    if [ -n "$DEV" ]; then
      if has_ip_address "$DEV"; then
        # device doesn't have any more IP addresses
        if ! is_active_vlan_master "$DEV"; then
          # if we take down an interface that is an active vlan master,
	  # we take down all VLANs. Not a good idea.
          cmd "ip link set dev $DEV down"
	fi
      fi
    fi
    ;;
  *)
    ;;
esac

# end of file