Project

General

Profile

« Previous | Next » 

Revision aab5f04c

Added by Ermal LUÇI almost 14 years ago

Correct behaviour of switching from console from any ppp type device to other type. This has been broken since new ppp code.

View differences:

etc/rc.initial.setlanip
37 37
	require_once("shaper.inc");
38 38
	require_once("rrd.inc");
39 39

  
40
	function console_get_interface_from_ppp($realif) {
41
		global $config;
42

  
43
		if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
44
			foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
45
				if ($realif == $ppp['if']) {
46
					$ifaces = explode(",", $ppp['ports']);
47
					return $ifaces[0];
48
				}
49
			}
50
		}
51

  
52
		return "";
53
	}
54

  
40 55
	function prompt_for_enable_dhcp_server() {
41 56
		global $config, $fp, $interface;
42 57
		if($interface == "wan") {
......
98 113
		echo "Invalid interface!\n";
99 114
		exit;
100 115
	}
101
		
116

  
117
	$ifaceassigned = "";
102 118
	do {
103
		
104 119
		if($interface == "wan") {
105 120
			$upperifname = strtoupper($interface);
106 121
			echo gettext("Configure {$upperifname} interface via DHCP?  [y|n]") . "\n> ";
107 122
			$intdhcp = chop(fgets($fp));
108 123
			if(strtolower($intdhcp) == "y" || strtolower($intdhcp) == "yes") {
124
				$ifppp = console_get_interface_from_ppp(get_real_interface("wan"));
125
				if (!empty($ifppp))
126
					$ifaceassigned = $ifppp;
109 127
				$intip = "dhcp";
110 128
				$intbits = "";
111 129
				$isintdhcp = true;
......
131 149
		  			$intbits = chop(fgets($fp));
132 150
					$restart_dhcpd = true;
133 151
		  		} while (!is_numeric($intbits) || ($intbits < 1) || ($intbits > 31));
134
		  	} 
152
		  	}
153
			$ifppp = console_get_interface_from_ppp(get_real_interface("wan"));
154
			if (!empty($ifppp))
155
				$ifaceassigned = $ifppp;
135 156
		}
136 157

  
137 158

  
138 159
	} while ($addr_blank);
139 160

  
161
	if (!empty($ifaceassigned))
162
		$config['interfaces'][$interface]['if'] = $ifaceassigned;
140 163
	$config['interfaces'][$interface]['ipaddr'] = $intip;
141 164
	$config['interfaces'][$interface]['subnet'] = $intbits;
142 165
	$config['interfaces'][$interface]['enable'] = true;

Also available in: Unified diff