summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5569e63)
When configuring a wlan device *and* afterwards a non-wlan device
within the same netcardconfig invocation, the wireless configuration
is still around (via $IWOURLINE and its underlying writeiwline()).
This causes the wireless options to be present even if not applicable,
like for example (wlan0 was configured first, then eth0 afterwards):
| allow-hotplug eth0
| iface wlan0 inet dhcp
| wireless-mode Managed
| wireless-essid SECRET
| wpa-ssid SECRET
| wpa-psk SECRET
|
|
| iface eth0 inet static
| address 10.42.42.1
| netmask 255.255.255.0
| network 10.42.42.0
| broadcast 10.42.42.255
| gateway 10.42.42.1
| dns-nameservers 10.42.42.1
| wireless-mode Managed
| wireless-essid SECRET
| wpa-ssid SECRET
| wpa-psk SECRET
This work was funded by Grml-Forensic.
$DIALOG --inputbox "$MESSAGEW20 $DEVICENAME $MESSAGEW21" 15 50 "$IWPRIV" 2>"$TMP" || bailout 1
read -r IWPRIV <"$TMP" ; rm -f "$TMP"
$DIALOG --inputbox "$MESSAGEW20 $DEVICENAME $MESSAGEW21" 15 50 "$IWPRIV" 2>"$TMP" || bailout 1
read -r IWPRIV <"$TMP" ; rm -f "$TMP"
+ unset IWOURLINE
+ if [ "$iswireless" = "1" ] ; then
+ writeiwline
+ fi
+
fi # Setup wireless options?
# Configure VLAN on this interface?
fi # Setup wireless options?
# Configure VLAN on this interface?
{if(!(found+lastblank)){print}}
END{print "iface '"$DV"' inet dhcp";if("'"$PDV"'"!=""){print "\tvlan-raw-device '"$PDV"'"}}' \
/etc/network/interfaces >"$TMP"
{if(!(found+lastblank)){print}}
END{print "iface '"$DV"' inet dhcp";if("'"$PDV"'"!=""){print "\tvlan-raw-device '"$PDV"'"}}' \
/etc/network/interfaces >"$TMP"
- echo -e "$IWOURLINE" >> "$TMP"
+ case "$DV" in
+ "$WLAN")
+ # write wireless configuration only when we are dealing with a wireless device,
+ # it might be set from a previous configuration run of a wireless device
+ # while the currently configured network device isn't a wireless device
+ echo -e "$IWOURLINE" >> "$TMP"
+ ;;
+ esac
#echo -e "\n\n" >> $TMP
cat "$TMP" >/etc/network/interfaces
rm -f "$TMP"
#echo -e "\n\n" >> $TMP
cat "$TMP" >/etc/network/interfaces
rm -f "$TMP"
fi
if [ -w /etc/network/interfaces ]; then
fi
if [ -w /etc/network/interfaces ]; then
+ case "$DV" in
+ "$WLAN")
+ ;;
+ *)
+ # ensure we don't leak the IWOURLINE into the
+ # following awk command line, if we are configuring
+ # a device without wireless capabilities
+ unset IWOURLINE
+ ;;
+ esac
+
awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}
{if(!found){print}}
END{print "\niface '"$DV"' inet static\n\taddress '"$IP"'\n\tnetmask '"$NM"'\n\tnetwork '"${IP%.*}.0"'";if("'"$BC"'"!=""){print "\tbroadcast '"$BC"'"};if("'"$DG"'"!=""){print "\tgateway '"$DG"'"};if("'"$NS"'"!=""){print "\tdns-nameservers '"$NS"'"};if("'"$PDV"'"!=""){print "\tvlan-raw-device '"$PDV"'"};if("'"$IWOURLINE"'"!=""){print "'"$IWOURLINE"'"};print "\n"}' \
awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}
{if(!found){print}}
END{print "\niface '"$DV"' inet static\n\taddress '"$IP"'\n\tnetmask '"$NM"'\n\tnetwork '"${IP%.*}.0"'";if("'"$BC"'"!=""){print "\tbroadcast '"$BC"'"};if("'"$DG"'"!=""){print "\tgateway '"$DG"'"};if("'"$NS"'"!=""){print "\tdns-nameservers '"$NS"'"};if("'"$PDV"'"!=""){print "\tvlan-raw-device '"$PDV"'"};if("'"$IWOURLINE"'"!=""){print "'"$IWOURLINE"'"};print "\n"}' \