Project

General

Profile

« Previous | Next » 

Revision a3af8146

Added by Marcus Brown over 14 years ago

Add NULL check to wireless functions.

The old interface_translate_type_to_real function used previously would return OPTX
if it was passed "OPTX" and OPTX existed but was unassigned, whereas get_real_interface returns NULL, so now we
check for NULL.

View differences:

etc/inc/interfaces.inc
2912 2912

  
2913 2913
	if (empty($config['interfaces'][$interface]))
2914 2914
		return $interface;
2915

  
2915
	
2916 2916
	$tmpif = $config['interfaces'][$interface];
2917 2917
	switch ($tmpif['ipaddr']) {
2918 2918
	case "ppp":
......
3482 3482

  
3483 3483
	$wlif = get_real_interface($interface);
3484 3484

  
3485
	if(is_interface_wireless($wlif)) {
3485
	if($wlif != NULL && is_interface_wireless($wlif)) {
3486 3486
		$cloned_interface = get_real_interface($interface);
3487 3487
		$chan_list = "/sbin/ifconfig {$cloned_interface} list chan";
3488 3488
		$stack_list = "/usr/bin/awk -F\"Channel \" '{ gsub(/\\*/, \" \"); print \$2 \"\\\n\" \$3 }'";
......
3528 3528

  
3529 3529
	$wlif = get_real_interface($interface);
3530 3530

  
3531
	if(is_interface_wireless($wlif)) {
3531
	if($wlif != NULL && is_interface_wireless($wlif)) {
3532 3532
		$cloned_interface = get_real_interface($interface);
3533 3533
		$chan_list = "/sbin/ifconfig {$cloned_interface} list txpower";
3534 3534
		$stack_list = "/usr/bin/awk -F\"Channel \" '{ gsub(/\\*/, \" \"); print \$2 \"\\\n\" \$3 }'";

Also available in: Unified diff