¿Cómo hace /etc/init.d/networking restart que wpa_supplicant se ejecute usando las configuraciones anteriores?

¿Cómo hace /etc/init.d/networking restart que wpa_supplicant se ejecute usando las configuraciones anteriores?

Fondo:

Yo uso Debian Lenny y tengo dos interfaces WiFi. Utilizo configuraciones genéricas en/etc/network/interfaces

iface wlan0 inet static
        address 10.0.0.1
        network 10.0.0.0
        netmask 255.255.255.0
        broadcast 10.0.0.255

auto wlan1
iface wlan1 inet static
        address 192.168.5.1
        network 192.168.5.1
        netmask 255.255.255.0
        broadcast 192.168.0.25

Entonces no tiene ninguna señal sobre el wpa_supplicant.

Utilizo wpa_supplicant (v2.0) manualmente para conectarlos a una WLAN mediante /etc/wpa_supplicant.conf(para wlan0) y /etc/wpa_supplicant2.conf(para wlan1).

Problema:

Mientras las interfaces wifi están conectadas a WLAN, hago

ip link set wlan0 down
ip link set wlan1 up
rm /var/run/wpa_supplicant/wlan0
rm /var/run/wpa_supplicant/wlan1

Entonces lo hago ip link set wlan0 (and 1) up. En ese caso, iwconfig muestra que las interfaces wifi no están conectadas a ninguna red.

Después de eso, corro /etc/init.d/networking restart. Cuando se completa el proceso, iwconfig muestra que las interfaces wifi están conectadas a las WLAN a las que estaban conectadas previamente.

Pregunta:

¿Cómo es /etc/init.d/networking restartposible que wpa_supplicant se ejecute utilizando el archivo .config para la interfaz que se usó antes (wpa_suppliant.conf para wlan0 y wpa_supplicant2.conf para wlan1)? Repetí este procedimiento muchas veces y cada vez las interfaces wifi se conectan a la misma red que está definida en los archivos .config.

Que he hecho:

1)Sospeché que /etc/init.d/networkingel script usa wpa_supplicant de alguna manera. Por eso, eché un vistazo al guión:

     #!/bin/sh -e
    ### BEGIN INIT INFO
    # Provides:          networking
    # Required-Start:    mountkernfs ifupdown $local_fs
    # Required-Stop:     ifupdown $local_fs
    # Default-Start:     S
    # Default-Stop:      0 6
    # Short-Description: Raise network interfaces.
    ### END INIT INFO
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"

[ -x /sbin/ifup ] || exit 0

. /lib/lsb/init-functions

process_options() {
    [ -e /etc/network/options ] || return 0
    log_warning_msg "/etc/network/options still exists and it will be IGNORED! R
ead README.Debian of netbase."
}

check_network_file_systems() {
    [ -e /proc/mounts ] || return 0

    exec 9<&0 < /proc/mounts
    while read DEV MTPT FSTYPE REST; do
        case $DEV in
        /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
            log_warning_msg "not deconfiguring network interfaces: network devic
es still mounted."
            exit 0
            ;;
        esac
        case $FSTYPE in
        nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse
.curlftpfs)
            log_warning_msg "not deconfiguring network interfaces: network file 
systems still mounted."
            exit 0
            ;;
        esac
    done
    exec 0<&9 9<&-
}

case "$1" in
start)

        process_options

        log_action_begin_msg "Configuring network interfaces"
        if ifup -a; then
            log_action_end_msg $?
        else
            log_action_end_msg $?
        fi
        ;;

stop)
        check_network_file_systems

        log_action_begin_msg "Deconfiguring network interfaces"
        if ifdown -a --exclude=lo; then
            log_action_end_msg $?
        else
            log_action_end_msg $?
        fi
        ;;

force-reload|restart)
        process_options

        log_action_begin_msg "Reconfiguring network interfaces"
        ifdown -a --exclude=lo || true
        if ifup -a --exclude=lo; then
            log_action_end_msg $?
        else
            log_action_end_msg $?
        fi
        ;;

*)
        echo "Usage: /etc/init.d/networking {start|stop|restart|force-reload}"
        exit 1
        ;;
esac

exit 0

ifupdownes un script que elimina wpa_supplicant antes de que se ejecute ifdown (como lo explica ese script). No sé programación de shell o bash, pero según tengo entendido, reiniciar solo desactiva y activa las interfaces.

2)Lee los ifuppágina de manualque dice:

Los comandos ifup e ifdown se pueden usar para configurar (o, respectivamente, desconfigurar) interfaces de red según las definiciones de interfaz en el archivo /etc/network/interfaces.

my /etc/network/interfacesno incluye ninguna configuración sobre wpa_supplicant.

información relacionada