Project

General

Profile

Bug #2758 » patch-partial-bug-2758.diff

Partial implementation of the fix - Renato Botelho, 01/31/2013 01:53 PM

View differences:

etc/inc/interfaces.inc
1133 1133
	if ($g['debug'])
1134 1134
		log_error("Calling interface down for interface {$interface}, destroy is " . (($destroy) ? 'true' : 'false'));
1135 1135

  
1136
	if ($ifacecfg === false)
1136
	if ($ifacecfg === false) {
1137 1137
		$ifcfg = $config['interfaces'][$interface];
1138
	else if (!is_array($ifacecfg))
1138
		$ppps = $config['ppps']['ppp'];
1139
		$realif = get_real_interface($interface);
1140
	} elseif (!is_array($ifacecfg)) {
1139 1141
		log_error(gettext("Wrong parameters used during interface_bring_down"));
1140
	else
1141
		$ifcfg = $ifacecfg;
1142
		
1142
	} else {
1143
		$ifcfg = $ifacecfg['ifcfg'];
1144
		$ppps = $ifacecfg['ppps'];
1143 1145

  
1144
	$realif = get_real_interface($interface);
1146
		/* Detect the old realif */
1147
	}
1145 1148

  
1146 1149
	switch ($ifcfg['ipaddr']) {
1147 1150
	case "ppp":
1148 1151
	case "pppoe":
1149 1152
	case "pptp":
1150 1153
	case "l2tp":
1151
		if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
1152
			foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
1154
		if (is_array($ppps) && count($ppps)) {
1155
			foreach ($ppps as $pppid => $ppp) {
1153 1156
				if ($realif == $ppp['if']) {
1154 1157
					if (isset($ppp['ondemand']) && !$destroy){
1155 1158
						send_event("interface reconfigure {$interface}");
usr/local/www/interfaces.php
86 86

  
87 87
$wancfg = &$config['interfaces'][$if];
88 88
$old_wancfg = $wancfg;
89
$old_ppps = $a_ppps;
89 90
// Populate page descr if it does not exist.
90 91
if ($if == "wan" && !$wancfg['descr'])
91 92
	$wancfg['descr'] = "WAN";
......
388 389
	} else {
389 390
		$toapplylist = array();
390 391
	}
391
	$toapplylist[$if] = $wancfg;
392
	$toapplylist[$if]['ifcfg'] = $wancfg;
393
	$toapplylist[$if]['ppps'] = $a_ppps;
392 394
	/* we need to be able remove IP aliases for IPv6 */
393 395
	file_put_contents("{$g['tmp_path']}/.interfaces.apply", serialize($toapplylist));
394 396
	header("Location: interfaces.php?if={$if}");
......
887 889
		} else {
888 890
			$toapplylist = array();
889 891
		}
890
		$toapplylist[$if] = $old_wancfg;
892
		$toapplylist[$if]['ifcfg'] = $old_wancfg;
893
		$toapplylist[$if]['ppps'] = $old_ppps;
891 894
		file_put_contents("{$g['tmp_path']}/.interfaces.apply", serialize($toapplylist));
892 895

  
893 896
		mark_subsystem_dirty('interfaces');
(1-1/2)