This file is indexed.

/etc/network/ifupdown-scripts-zg2.d/eth-interfacename is in ifupdown-scripts-zg2 0.6-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# $Header$

# Environment:
#  IFACE      = Logical interface name
#  MODE       = { start | stop }
#  METHOD     = manual, otherwise exit
#  ADDRFAM    = inet, otherwise exit
#  IF_DEVICE  = physical interface name (defaults to logical)
#  IF_MAC     = MAC address of interface. If not given, use $IF_DEVICE
#  IF_MASTER  = device name of VLAN master. If not given, search for
#               master by MAC address.

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

# remove state if interface is being stopped

if [ "$MODE" = "stop" ]; then
  exec_down "mac" ""
  exec_down "dev" ""
  exit 0
fi

# only do something for ethernet interfaces

[ "$IF_TYPE" != "eth" -a -n "$IF_TYPE" ] && exit 0

# only do something if interface is being started

[ "$MODE" = "start" ] || exit 0

# save state

add_down "dev" "$IF_DEVICE"

# get MAC address of VLAN master. If that is not given, later code will
# identify the VLAN master interface by the MAC address given
if [ -n "$IF_MASTER" ]; then
  IF_MAC=$(get_if_mac "$IF_MASTER")
fi

# get MAC address of the physical device if not given. Otherwise, later
# code will search for an interface with the given MAC address and appro-
# priately rename the physical interface.

if [ -z "${IF_MAC:-}" ]; then
	IF_MAC=$(get_if_mac "$IF_DEVICE")
fi
add_down "mac" "$IF_MAC"

# find current interface name that has the MAC we want

INVALID="no:valid:interface"

# iterate through all interfaces, search for an interface with matching
# MAC address and VLAN id
for iface in $(list_ifaces) $INVALID; do
  MAC=$(get_if_mac "$iface")
  VLAN=$(get_vlan_id "$iface")
  if [ "$MAC" = "$IF_MAC" -a "$VLAN" = "$IF_VLAN_ID" ]; then
    break
  fi
done

if [ "$iface" != "$IF_DEVICE" ]; then
    abort "$IF_DEVICE does not have MAC address $IF_MAC."
fi

# check
for sfile in $(grep -l "^mac: $IF_MAC" $STATEDIR/*.state); do
  # logicalif="$(/usr/bin/basename $sfile)"
  logicalif="${sfile%.state}"
  logicalif="${logicalif##*/}"
  VLAN=$[$(dev_state_entry "$logicalif" vlan-id)+0]
  if [ "$VLAN" != "$IF_VLAN_ID" ]; then continue; fi
  DEV=$(dev_state_entry "$logicalif" dev)
  if [ "$DEV" != "$IF_DEVICE" ]; then
    abort "device with MAC address $IF_MAC${IF_VLAN_ID+ (vlan $IF_VLAN_ID)} already up as $DEV for $logicalif."
  fi
done

# vi:sw=2