*BSDThis forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is there a disadvantage to using quick for every rule? I don't understand why PF doesn't default to going by the first matching rule, instead of the last. Wouldn't that be more efficient instead of processing through the whole list?
Maybe, but it wouldn't give you the flexibility that not stopping on the first matching rule gives you.
If you're used to other firewalls, setting quick on all your rules will be more what you're used to. Not having the first match be the final one is a really cool thing when you need it though.
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660
Rep:
Briefly, the main advantage of a "last match" vs. "first match" is that with last match, your default rule goes at the top of the list. In most cases this is going to be "block all". That allows you to very quickly confirm that your default rule is, indeed, "block". It's also the first rule you write when defining a new configuration, so there's less chance you'll forget it. I know that seems trivial, but anything that leads to better awareness is a good thing.
Instead of using "quick" on every rule, write your rules in order of least specific to most specific (top to bottom), that will achieve the desired effect. I use "quick" in a few of my block rules so that I don't have to place them at the bottom of my ruleset (and because they match a lot, so I want them to short-cut evaluation). That's really the only thing I use quick for.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.