Project

General

Profile

« Previous | Next » 

Revision 51b14faa

Added by Ermal Luçi almost 16 years ago

Do not 'spam' a new ipfw-classifyd for each save. If we hit save for an existing configuration(did changes to existing one) just tell ipfw-classifyd to reload the config.

View differences:

etc/inc/shaper.inc
3277 3277
    //Add a tuple (rule,sctructure,element) to the $rsets
3278 3278
    
3279 3279
    function add_rule($l7set) {
3280
        $this->rsets[] = $l7set;
3280
       	$this->rsets[] = $l7set;
3281 3281
    }
3282 3282
    
3283 3283
    // Build the layer7 rules
......
3302 3302
        $rsets = $q['l7rules'];
3303 3303
        //Put individual rules in the array
3304 3304
	if(is_array($rsets)) {
3305
	    $this->rsets = array(); // XXX: ugly hack
3305 3306
	    foreach($rsets as $l7r) {
3306 3307
	        $l7obj = new l7rule();
3307 3308
	        $l7obj->SetRProtocol($l7r['protocol']);
usr/local/www/firewall_shaper_layer7.php
66 66
read_layer7_config();
67 67

  
68 68
if($_GET['reset'] <> "") {
69
	/* XXX: Huh!? Why are we killing php here? */
70
	mwexec("killall -9 pfctl php");
71 69
	// kill all ipfw-classifyd processes
72 70
	mwexec("killall -9 ipfw-classifyd"); 
73 71
	exit;
......
124 122
	unset($input_errors);
125 123
	
126 124
	if($_POST['submit']) {
127
		$l7r =& new layer7();
128
		$_POST['divert_port'] = $l7r->gen_divert_port();
125
		if (isset($layer7_rules_list[$name])) {
126
			$l7r = $layer7_rules_list[$name];
127
			$_POST['divert_port'] = $l7r->GetRPort();
128
		} else {
129
			$l7r =& new layer7();
130
			$_POST['divert_port'] = $l7r->gen_divert_port();
131
		}
129 132
		for($i=0; $_POST['protocol'][$i] <> ""; $i++) {
130 133
			$_POST['l7rules'][$i]['protocol'] = $_POST['protocol'][$i];
131 134
			$_POST['l7rules'][$i]['structure'] = $_POST['structure'][$i];

Also available in: Unified diff