• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Increase performance of filter_configure_sync

Scheduled Pinned Locked Moved Development
5 Posts 2 Posters 3.1k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    thekod
    last edited by Sep 29, 2008, 8:48 AM

    For systems with a lot of firewall rules, filter_configure_sync() in /etc/inc/filter.inc could be sped up by adding break; after line 102, so that you end up with:

        100                         foreach($config['filter']['rule'] as $rule) {
        101                                 if($rule['sched'])
        102                                         $time_based_rules = true;
        103                                         break;
        104                         }
    

    This way, once it finds a match and sets $time_based_rules, it doesn't keep searching through the rules…of which there might be many...just a suggestion...

    1 Reply Last reply Reply Quote 0
    • T
      thekod
      last edited by Sep 30, 2008, 11:10 PM

      It was early in the morning…I didn't notice that since the if statement only had one action, there were no brackets...the way I wrote it, it'll completely screw up.  Below is a corrected version.

          100                         foreach($config['filter']['rule'] as $rule) {
          101                                 if($rule['sched']) {
          102                                         $time_based_rules = true;
          103                                         break;
          104                                 }
          104                         }
      
      1 Reply Last reply Reply Quote 0
      • E
        eri--
        last edited by Oct 1, 2008, 6:14 PM

        thx for reminding this i forgot and that is not the best fix ;)

        1 Reply Last reply Reply Quote 0
        • T
          thekod
          last edited by Oct 1, 2008, 6:34 PM

          What is?  I'm always interested in learning.  :)

          1 Reply Last reply Reply Quote 0
          • E
            eri--
            last edited by Oct 1, 2008, 9:16 PM

            Short answer, no need to do the loop at all :D ::)

            1 Reply Last reply Reply Quote 0
            5 out of 5
            • First post
              5/5
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
              This community forum collects and processes your personal information.
              consent.not_received