This file is indexed.

/etc/pm/sleep.d/74ifplugd is in ifplugd 0.28-19ubuntu1.

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
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/sh
#
# suspend/resume ifplugd

[ -f /etc/default/ifplugd ] || exit 0
. /etc/default/ifplugd
[ "$SUSPEND_ACTION" ] || [ "$SUSPEND_ACTION" != "none" ] || exit 0

if [ "$SUSPEND_ACTION" = "suspend" ] ; then
  RESUME_ACTION="resume"
elif [ "$SUSPEND_ACTION" = "stop" ] ; then
  RESUME_ACTION="start"
else
  exit 0
fi

# Hotplug interfaces
#
# ifplugd for interfaces in HOTPLUG_INTERFACES is started by udev.
# The ifplugd init.d script doesn't touch them. We still want to 
# stop/start these interfaces on suspend/resume. Here is some
# hackery to do this.

# use pm-utils functions for state save/restore, if available
[ -f "${PM_FUNCTIONS}" ] && . "${PM_FUNCTIONS}"

# name of the save/restore state
IFPLUGD_STATE="ifplugd_ifs"

# return 0 if the first parm is an element of the remaining parms
# or they contain the special value "all"
elem_of() {
    local E=$1
    shift
    echo $@ | grep -Eq "(\\<all\\>)|(\\<${E}\\>)" 
}

# save state using pm-utils
save_state() {
    savestate ${IFPLUGD_STATE} 2>/dev/null
}

# load saved state using pm-utils
load_state() {
    restorestate ${IFPLUGD_STATE} 2>/dev/null
}

# filter only hotplug interfaces
filter_hotplug_ifs() {
    while read L; do
        for IF in $L; do
            # interface is managed statically
            elem_of "${IF}" "${INTERFACES}" && continue
            # interface is not managed by udev
            elem_of "${IF}" "${HOTPLUG_INTERFACES}" || continue
            # ignore lo
            [ "x${IF}" = "xlo" ] && continue
            echo -n "${IF} "
        done 
    done
    echo ""
}

# get interfaces of running ifplugds for hotplug IFs
get_running_ifs() {
    ps --no-headers -o args -C ifplugd | \
    sed -e 's/.*-[[:alpha:]]*i[[:space:]]*\([^[:space:]]\+\).*/\1/' | \
    filter_hotplug_ifs
}

# get all existing hotplug IFs
get_hotplug_ifs() {
    local IFACES=""
    for IF in /sys/class/net/*; do
        echo "${IF##*/} "
    done | filter_hotplug_ifs
}

# stop all ifplugd instances that where started by udev
# stop_udev_ifs <action>
stop_udev_ifs() {
    local ACTION=$1
    local IFACES
    local IF

    IFACES=`get_running_ifs`

    # save list of interfaces we stop, so we can restart them
    echo "${IFACES}" | save_state || true

    for IF in ${IFACES}; do
        if [ "x${ACTION}" = "xsuspend" ]; then
            ifplugd -i ${IF} -S
        else
            ifplugd -i ${IF} -k
        fi
        # ifplugd started by udev doesn't take down the IF
        /etc/ifplugd/ifplugd.action ${IF} down
    done
}

# start ifplugd for all interfaces that were stopped by us
# start_udev_ifs <action>
start_udev_ifs() {
    local ACTION=$1
    local IFACES
    local IF

    # try to load list of interfaces
    # if it can't be loaded, we just start all hotplug interfaces
    IFACES=`load_state || get_hotplug_ifs`

    for IF in ${IFACES}; do
        if [ "x${ACTION}" = "xresume" ] && ifplugd -i ${IF} -c; then
            ifplugd -i ${IF} -R
        else
            # start ifplugd just as udev would
            INTERFACE=${IF} ACTION=add /lib/udev/ifplugd.agent
        fi
    done
}


case "$1" in
        hibernate|suspend|suspend_hybrid)
                /etc/init.d/ifplugd ${SUSPEND_ACTION}
                stop_udev_ifs ${SUSPEND_ACTION}
                ;;
        thaw|resume)
                if [ "x$2" != "xstandby" ]; then
                    start_udev_ifs ${RESUME_ACTION}
                    /etc/init.d/ifplugd ${RESUME_ACTION}
                fi
                ;;
        *) exit 1
                ;;
esac

exit 0