Project

General

Profile

« Previous | Next » 

Revision ef8fca71

Added by Ermal LUÇI over 14 years ago

Do not put the queue config on the rules if there is no default queue, just log it. This prevents errors in rules loading which is worse than having no shaper.

View differences:

etc/inc/shaper.inc
515 515
	 *      foreach ($queues as $qkey => $queue)
516 516
	 *              this->queues[$qkey]->build_rule();
517 517
	 */
518
	function build_rules() {
518
	function build_rules($default = false) {
519 519
		if (count($this->queues) > 0 && $this->GetEnabled() == "on") {
520
			$default = false;
520 521
			$rules = " altq on  " . get_real_interface($this->GetInterface());
521 522
			if ($this->GetScheduler())
522 523
				$rules .= " ".strtolower($this->GetScheduler());
......
539 540
				}
540 541
				$rules .= " } \n";
541 542
				foreach ($this->queues as $q) {
542
					$rules .= $q->build_rules();
543
					$rules .= $q->build_rules(&$default);
543 544
				}
544 545
			}
546
			if ($default == false) {
547
				log_error("SHAPER: no default queue specified for interface ". $this->GetInterface() . ". The interface queue will be enforced as default.");
548
				return "\n";
549
			} 
550
			$frule .= $rules;
545 551
		}
546 552
		$rules .= " \n";
547 553
		return $rules;
......
1025 1031
	/* Should return something like:
1026 1032
	 * queue $qname on $qinterface bandwidth ....
1027 1033
	 */
1028
	function build_rules() {
1034
	function build_rules($default = false) {
1029 1035
		$pfq_rule = " queue ". $this->qname;
1030 1036
		if ($this->GetInterface())
1031 1037
			$pfq_rule .= " on ".get_real_interface($this->GetInterface());
......
1061 1067
				if ($comma)
1062 1068
					$pfq_rule .= " ,";
1063 1069
				$pfq_rule .= " default ";
1070
				$default = true;
1064 1071
			}
1065 1072
			$pfq_rule .= " ) ";
1066 1073
		}
......
1674 1681
	}
1675 1682

  
1676 1683
	/* Even this should take children into consideration */
1677
	function build_rules() {
1684
	function build_rules($default = false) {
1678 1685

  
1679 1686
		$pfq_rule = " queue ". $this->qname;
1680 1687
		if ($this->GetInterface())
......
1713 1720
					$pfq_rule .= " ,";
1714 1721
				$comma = 1;
1715 1722
				$pfq_rule .= " default ";
1723
				$default = true;
1716 1724
			}
1717 1725

  
1718 1726
			if ($this->GetRealtime() <> "")  {
......
2215 2223
	}
2216 2224
		
2217 2225
	/* Even this should take children into consideration */
2218
	function build_rules() {
2226
	function build_rules($default = false) {
2219 2227
		$pfq_rule = "queue ". $this->qname;
2220 2228
		if ($this->GetInterface())
2221 2229
			$pfq_rule .= " on ".get_real_interface($this->GetInterface());
......
2254 2262
					$pfq_rule .= " ,";
2255 2263
				$comma = 1;
2256 2264
				$pfq_rule .= " default ";
2265
				$default = true;
2257 2266
			}
2258 2267
			$tmpvalue = trim($this->GetBorrow());
2259 2268
			if (!empty($tmpvalue)) {
......
2275 2284
			}
2276 2285
			$pfq_rule .= " } \n";
2277 2286
			foreach ($this->subqueues as $q)
2278
				$pfq_rule .= $q->build_rules();
2287
				$pfq_rule .= $q->build_rules(&$default);
2279 2288
		}
2280 2289

  
2281 2290
		$pfq_rule .= " \n";
......
2489 2498
	}
2490 2499
		
2491 2500
	/* Even this should take children into consideration */
2492
	function build_rules() {
2501
	function build_rules($default = false) {
2493 2502
		$pfq_rule = "queue ". $this->qname;
2494 2503
		if ($this->GetInterface())
2495 2504
			$pfq_rule .= " on ".get_real_interface($this->GetInterface());
......
2529 2538
					$pfq_rule .= " ,";
2530 2539
				$comma = 1;
2531 2540
				$pfq_rule .= " default ";
2541
				$default = true;
2532 2542
			}
2533 2543
			$tmpvalue = trim($this->GetBuckets());
2534 2544
			if (!empty($tmpvalue)) {

Also available in: Unified diff