Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 3.128.205.62
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : www-data ( )
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/thread-self/root/lib/resolvconf/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/thread-self/root/lib/resolvconf/net-interface-handler
#!/bin/sh
# copy dns settings from a dhcp in the initramfs into resolvconf.
# This is invoked from udev via 70-resolvconf-initramfs-copy.rules
#

DEBUG=0
OPENISCSI_MARKER=/run/initramfs/open-iscsi.interface
PROG="rconf-initrd"   # PROG, per resolvconf(8) IFACE.PROG
CR="
"

error() {
    echo "$0${INTERFACE:+[$INTERFACE]}:" "$@" 1>&2
}

debug() {
    [ "${DEBUG:-0}" != "0" ] || return 0
    error "$@" 1>&2;
}

enabled_on_kernel_cmdline() {
    # this can be enabled on the kernel command line if
    # it has either cloud-config-url= (maas will have this)
    # or it explicitly has 'rc-initrd-dns' (mostly testing)
    local cmdline=""
    if [ ! -e /proc/cmdline ]; then
       debug "/proc/cmdline does not exist."
       return 1
    fi
    read cmdline < /proc/cmdline
    case " $cmdline " in
        *cloud-config-url=*|*\ rc-initrd-dns\ *) :;;
        *\ root=http*) :;; # LP: #1735225
        *) debug "not enabled in kernel cmdline."; return 1;;
    esac

    # if the command line matched, we may be in a container
    # where a shared cmdline with the host.
    if command -v systemd-detect-virt >/dev/null 2>&1; then
        local out=""
        out=$(systemd-detect-virt --container)
        case "$out" in
            none) :;;
            *) debug "inside a container, ignoring cmdline."; return 1;;
        esac
    fi

    return 0
}

should_be_enabled() {
    if [ -f "${OPENISCSI_MARKER}" ]; then
        debug "open-iscsi in control per ${OPENISCSI_MARKER}"
        return 1
    fi

    if ! enabled_on_kernel_cmdline; then
        return 1
    fi
    return 0
}

assert_environment() {
    if [ -z "$INTERFACE" ]; then
        error "'INTERFACE' not set in environment."
        return 1
    fi
    return 0
}

netinfo_to_resolv_conf() {
    # netinfo_to_resolv_conf(output, files)
    # write resolv_conf from /run/net-<device> style files.
    # borrowed with slight modification from initramfs-tools/scripts/functions
    local output="$1" search="" ns="" f="" n=""
    shift
    for f in "$@"; do
        [ -f "$f" ] || continue
        unset IPV4DNS0 IPV4DNS1 IPV6DNS0 IPV6DNS1
        unset DOMAINSEARCH IPV6DOMAINSEARCH
        . "$f" || { error "failed '. \"$f\"'" 1>&2; return 1; }
        for n in "${IPV4DNS0}" "${IPV4DNS1}" \
            "${IPV6DNS0}" "${IPV6DNS1}"; do
            [ -n "$n" -a "$n" != "0.0.0.0" ] || continue
            # skip if 'n' already in list.
            case " ${ns} " in
                *\ $n\ *) continue;;
            esac
            ns="${ns} ${n}"
        done
        for n in "${DOMAINSEARCH}" "${IPV6DOMAINSEARCH}"; do
            [ -n "$n" ] || continue
            # skip if already in search.
            case " ${search}" in
                *\ $n\ *) continue;;
            esac
            search="$search $n"
        done
        search=${search# }
        ns=${ns# }
    done

    local rconf=""
    for n in ${ns}; do
        rconf="${rconf}nameserver $n${CR}"
    done
    if [ -n "${search}" ]; then
        rconf="${rconf}search ${search}${CR}"
    fi
    if [ -z "$rconf" ]; then
        debug "no search or nameservers found in $*"
    fi
    if [ "$output" = "-" ]; then
        echo -n "$rconf"
    else
        echo -n "$rconf" > "$output"
    fi
}

start() {
    # if open-iscsi is involved we assume it is in charge of this work.

    assert_environment || return
    should_be_enabled || return 0

    local iface="$INTERFACE" i="" rconf=""
    set --
    for i in "/run/net-$iface.conf" "/run/net6-$iface.conf"; do
        [ -f "$i" ] || continue
        set -- "$@" "$i"
    done
    if [ $# -eq 0 ]; then
        debug "no /run/net*-$iface.conf files found."
        return 0
    fi

    rconf=$(netinfo_to_resolv_conf - "$@")
    if [ -z "$rconf" ]; then
        debug "no resolv.conf related settings in $*"
        return 0
    fi

    # create the dir in case resolvconf did not start yet
    mkdir -p /run/resolvconf/interface
    debug echo "\"$rconf\"" "|" "resolvconf -a $iface.$PROG"
    echo "$rconf" | resolvconf -a "$iface.$PROG"
}

stop() {
    assert_environment || return
    should_be_enabled || return 0
    local iface="$INTERFACE"
    debug resolvconf -d "$iface.$PROG"
    resolvconf -d "$iface.$PROG"
}

case "$1" in
    start) start ;;
    stop) stop ;;
    _test) :;;
    *) echo "ERROR: must be called with 'start' or 'stop'" >&2; exit 1 ;;
esac

Anon7 - 2022
AnonSec Team