Project

General

Profile

« Previous | Next » 

Revision 0dad12d8

Added by Ermal LUÇI almost 14 years ago

Do not try to add mac passthrough to a not loaded ipfw since the macs might be added to the wrong zone.

View differences:

usr/local/www/services_captiveportal_mac_edit.php
142 142
		
143 143
		write_config();
144 144

  
145
		$ruleno = captiveportal_get_ipfw_passthru_ruleno($oldmac);
146
		if ($ruleno) {
147
			captiveportal_free_ipfw_ruleno($ruleno);
148
			$rules = "delete {$ruleno}\n";
149
			$rules .= "delete " . ++$ruleno . "\n";
145
		if (isset($config['captiveportal'][$cpzone]['enable'])) {
146
			$ruleno = captiveportal_get_ipfw_passthru_ruleno($oldmac);
147
			if ($ruleno) {
148
				captiveportal_free_ipfw_ruleno($ruleno);
149
				$rules = "delete {$ruleno}\n";
150
				$rules .= "delete " . ++$ruleno . "\n";
151
			}
152
			
153
			$rules .= captiveportal_passthrumac_configure_entry($mac);
154
			file_put_contents("{$g['tmp_path']}/{$cpzone}_tmpmacedit{$id}", $rules);
155
			captiveportal_ipfw_set_context($cpzone);
156
			mwexec("/sbin/ipfw -q {$g['tmp_path']}/{$cpzone}_tmpmacedit{$id}");
157
			@unlink("{$g['tmp_path']}/{$cpzone}_tmpmacedit{$id}");
150 158
		}
151
		
152
		$rules .= captiveportal_passthrumac_configure_entry($mac);
153
		file_put_contents("{$g['tmp_path']}/{$cpzone}_tmpmacedit{$id}", $rules);
154
		captiveportal_ipfw_set_context($cpzone);
155
		mwexec("/sbin/ipfw -q {$g['tmp_path']}/{$cpzone}_tmpmacedit{$id}");
156
		@unlink("{$g['tmp_path']}/{$cpzone}_tmpmacedit{$id}");
157 159

  
158 160
		header("Location: services_captiveportal_mac.php?zone={$cpzone}");
159 161
		exit;

Also available in: Unified diff