summaryrefslogtreecommitdiffstats
path: root/sbin/ipfw
Commit message (Collapse)AuthorAgeFilesLines
* Kill EOL whitespaces, style(9) fix.maxim2002-11-061-13/+12
|
* Fix UID/GID options parsing.maxim2002-11-061-2/+2
| | | | | | | PR: bin/42579 Submitted by: Belousov Oleg <oleg@belousov.com> Approved by: luigi MFC after: 2 weeks
* Misc fixes from Chris Pepper, plus additional explainations onluigi2002-10-281-186/+183
| | | | | | dummynet operation. MFC after: 3 days
* Fix ipfw2 panics on 64-bit platforms.mux2002-10-241-5/+5
| | | | | | | | | | Quoting luigi: In order to make the userland code fully 64-bit clean it may be necessary to commit other changes that may or may not cause a minor change in the ABI. Reviewed by: luigi
* Increase the max dummynet hash size from 1024 to 65536. Default is stillseanc2002-10-121-1/+1
| | | | | | | | | 1024. Silence on: -net, -ipfw 4weeks+ Reviewed by: dd Approved by: knu (mentor) MFC after: 3 weeks
* Do not dump core on 'ipfw add unreach': handling null strings inmaxim2002-09-251-0/+2
| | | | | | | | fill_reject_code(). Please note ipfw/ipfw2.c is not affected. PR: bin/42304 Submitted by: Andy@wantpackets.com MFC after: 1 day
* o Fix a typo.maxim2002-09-221-3/+3
| | | | | | | | o Remove EOL spaces. Submitted by: Harold Gutch <logix@foobar.franken.de> (typo patch) Approved by: luigi MFC after: 3 days
* Store the port number in "fwd" rules in host format, same as ipfw1luigi2002-09-121-2/+2
| | | | | | | | | | | has always done. Technically, this is the wrong format, but it reduces the diffs in -stable. Someday, when we get rid of ipfw1, I will put the port number in the proper format both in kernel and userland. MFC after: 3 days (with re@ permission)
* Typo: s/o packet/on packet/blackend2002-09-081-1/+1
| | | | | PR: docs/42543 Submitted by: Michael Lyngbøl <lyngbol@bifrost.lyngbol.dk>
* s/filesystem/file system/g as discussed on -developerstrhodes2002-08-211-1/+1
|
* Whoops, the manpage lied... ipfw2 has always accepted addr:maskluigi2002-08-211-11/+14
| | | | specifications.
* One more (hopefully the last one) step in cleaning up the syntax,luigi2002-08-192-61/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | following Julian's good suggestion: since you can specify any match pattern as an option, rules now have the following format: [<proto> from <src> to <dst>] [options] i.e. the first part is now entirely optional (and left there just for compatibility with ipfw1 rulesets). Add a "-c" flag to show/list rules in the compact form (i.e. without the "ip from any to any" part) when possible. The default is to include it so that scripts processing ipfw's canonical output will still work. Note that as part of this cleanup (and to remove ambiguity), MAC fields now can only be specified in the options part. Update the manpage to reflect the syntax. Clarify the behaviour when a match is attempted on fields which are not present in the packet, e.g. port numbers on non TCP/UDP packets, and the "not" operator is specified. E.g. ipfw add allow not src-port 80 will match also ICMP packets because they do not have port numbers, so "src-port 80" will fail and "not src-port 80" will succeed. For such cases it is advised to insert further options to prevent undesired results (e.g. in the case above, "ipfw add allow proto tcp not src-port 80"). We definitely need to rewrite the parser using lex and yacc!
* Major cleanup of the parser and printing routines in an attempt toluigi2002-08-192-209/+375
| | | | | | | | | | | | | | | | | | | render the syntax less ambiguous. Now rules can be in one of these two forms <action> <protocol> from <src> to <dst> [options] <action> MAC dst-mac src-mac mac-type [options] however you can now specify MAC and IP header fields as options e.g. ipfw add allow all from any to any mac-type arp ipfw add allow all from any to any { dst-ip me or src-ip me } which makes complex expressions a lot easier to write and parse. The "all from any to any" part is there just for backward compatibility. Manpage updated accordingly.
* Complete list of differences between ipfw1 and ipfw2.luigi2002-08-161-10/+93
|
* sys/netinet/ip_fw2.c:luigi2002-08-162-116/+526
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement the M_SKIP_FIREWALL bit in m_flags to avoid loops for firewall-generated packets (the constant has to go in sys/mbuf.h). Better comments on keepalive generation, and enforce dyn_rst_lifetime and dyn_fin_lifetime to be less than dyn_keepalive_period. Enforce limits (up to 64k) on the number of dynamic buckets, and retry allocation with smaller sizes. Raise default number of dynamic rules to 4096. Improved handling of set of rules -- now you can atomically enable/disable multiple sets, move rules from one set to another, and swap sets. sbin/ipfw/ipfw2.c: userland support for "noerror" pipe attribute. userland support for sets of rules. minor improvements on rule parsing and printing. sbin/ipfw/ipfw.8: more documentation on ipfw2 extensions, differences from ipfw1 (so we can use the same manpage for both), stateful rules, and some additional examples. Feedback and more examples needed here.
* Fix one parsing bug introduced by last commit, and correct parsingluigi2002-08-101-18/+63
| | | | and printing of or-blocks in address, ports and options lists.
* Major revision of the ipfw manpage, trying to make it up-to-dateluigi2002-08-101-518/+682
| | | | | | | | | | | | | | | | | | | | with ipfw2 extensions and give examples of use of the new features. This is just a preliminary commit, where i simply added the basic syntax for the extensions, and clean up the page (e.g. by listing things in alphabetical rather than random order). I would appreciate feedback and possible corrections/extensions by interested parties. Still missing are a more detailed description of stateful rules (with keepalives), interaction with of stateful rules and natd (don't do that!), examples of use with the recently introduced rule sets. There is an issue related to the MFC: RELENG_4 still has ipfw as a default, and ipfw2 is optional. We have two options here: MFC this page as ipfw(8) adding a large number of "SORRY NOT IN IPFW" notes, or create a new ipfw2(8) manpage just for -stable users. I am all for the first approach, but of course am listening to your comments.
* One bugfix and one new feature.luigi2002-08-101-22/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bugfix (ipfw2.c) makes the handling of port numbers with a dash in the name, e.g. ftp-data, consistent with old ipfw: use \\ before the - to consider it as part of the name and not a range separator. The new feature (all this description will go in the manpage): each rule now belongs to one of 32 different sets, which can be optionally specified in the following form: ipfw add 100 set 23 allow ip from any to any If "set N" is not specified, the rule belongs to set 0. Individual sets can be disabled, enabled, and deleted with the commands: ipfw disable set N ipfw enable set N ipfw delete set N Enabling/disabling of a set is atomic. Rules belonging to a disabled set are skipped during packet matching, and they are not listed unless you use the '-S' flag in the show/list commands. Note that dynamic rules, once created, are always active until they expire or their parent rule is deleted. Set 31 is reserved for the default rule and cannot be disabled. All sets are enabled by default. The enable/disable status of the sets can be shown with the command ipfw show sets Hopefully, this feature will make life easier to those who want to have atomic ruleset addition/deletion/tests. Examples: To add a set of rules atomically: ipfw disable set 18 ipfw add ... set 18 ... # repeat as needed ipfw enable set 18 To delete a set of rules atomically ipfw disable set 18 ipfw delete set 18 ipfw enable set 18 To test a ruleset and disable it and regain control if something goes wrong: ipfw disable set 18 ipfw add ... set 18 ... # repeat as needed ipfw enable set 18 ; echo "done "; sleep 30 && ipfw disable set 18 here if everything goes well, you press control-C before the "sleep" terminates, and your ruleset will be left active. Otherwise, e.g. if you cannot access your box, the ruleset will be disabled after the sleep terminates. I think there is only one more thing that one might want, namely a command to assign all rules in set X to set Y, so one can test a ruleset using the above mechanisms, and once it is considered acceptable, make it part of an existing ruleset.
* Fix generation of check-state rules, which i broke in last commit.luigi2002-08-041-1/+1
|
* Forgot this one: properly initialize an address set when the setluigi2002-07-311-3/+1
| | | | | size is less than 32 bits (/28 mask or more). Also remove a debugging fprintf().
* Two bugfixes:luigi2002-07-311-15/+26
| | | | | | | | | + the header file contains two different opcodes (O_IPOPTS and O_IPOPT) for what is the same thing, and sure enough i used one in the kernel and the other one in userland. Be consistent! + "keep-state" and "limit" must be the last match pattern in a rule, so no matter how you enter them move them to the end of the rule.
* Add SEE ALSO references to papers handling RED.sheldonh2002-07-251-0/+26
|
* A bunch of minor fixes:luigi2002-07-131-8/+11
| | | | | | | | | | | | * accept "icmptype" as an alias for "icmptypes"; * remove an extra whitespace after "log" rules; * print correctly the "limit" masks; * correct a typo in parsing dummynet arguments (this caused a coredump); * do not allow specifying both "check-state" and "limit", they are (and have always been) mutually exclusive; * remove an extra print of the rule before installing it; * make stdout buffered -- otherwise, if you log its output with syslog, you will see one entry for each printf(). Rather unpleasant.
* Uncommented WARNS=0. ipfw2.c is full of printf format errors that arebde2002-07-111-1/+1
| | | | | | | | fatal on alphas. Fixed setting of WARNS. WARNS should never be set unconditionally, since this breaks testing of different WARNS values by setting it at a higher level (e.g., on the command line).
* Fixed some world breakage caused by not updating clients when <timeconv.h>bde2002-07-081-0/+1
| | | | | was split off from <time.h>. This became fatal here when -Werror was reenabled.
* The .Nm utilitycharnier2002-07-061-1/+2
|
* Implement the last 2-3 missing instructions for ipfw,luigi2002-07-051-124/+108
| | | | | | | | | | | | | | | | now it should support all the instructions of the old ipfw. Fix some bugs in the user interface, /sbin/ipfw. Please check this code against your rulesets, so i can fix the remaining bugs (if any, i think they will be mostly in /sbin/ipfw). Once we have done a bit of testing, this code is ready to be MFC'ed, together with a bunch of other changes (glue to ipfw, and also the removal of some global variables) which have been in -current for a couple of weeks now. MFC after: 7 days
* The new ipfw code.luigi2002-06-272-1/+3180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code makes use of variable-size kernel representation of rules (exactly the same concept of BPF instructions, as used in the BSDI's firewall), which makes firewall operation a lot faster, and the code more readable and easier to extend and debug. The interface with the rest of the system is unchanged, as witnessed by this commit. The only extra kernel files that I am touching are if_fw.h and ip_dummynet.c, which is quite tied to ipfw. In userland I only had to touch those programs which manipulate the internal representation of firewall rules). The code is almost entirely new (and I believe I have written the vast majority of those sections which were taken from the former ip_fw.c), so rather than modifying the old ip_fw.c I decided to create a new file, sys/netinet/ip_fw2.c . Same for the user interface, which is in sbin/ipfw/ipfw2.c (it still compiles to /sbin/ipfw). The old files are still there, and will be removed in due time. I have not renamed the header file because it would have required touching a one-line change to a number of kernel files. In terms of user interface, the new "ipfw" is supposed to accepts the old syntax for ipfw rules (and produce the same output with "ipfw show". Only a couple of the old options (out of some 30 of them) has not been implemented, but they will be soon. On the other hand, the new code has some very powerful extensions. First, you can put "or" connectives between match fields (and soon also between options), and write things like ipfw add allow ip from { 1.2.3.4/27 or 5.6.7.8/30 } 10-23,25,1024-3000 to any This should make rulesets slightly more compact (and lines longer!), by condensing 2 or more of the old rules into single ones. Also, as an example of how easy the rules can be extended, I have implemented an 'address set' match pattern, where you can specify an IP address in a format like this: 10.20.30.0/26{18,44,33,22,9} which will match the set of hosts listed in braces belonging to the subnet 10.20.30.0/26 . The match is done using a bitmap, so it is essentially a constant time operation requiring a handful of CPU instructions (and a very small amount of memmory -- for a full /24 subnet, the instruction only consumes 40 bytes). Again, in this commit I have focused on functionality and tried to minimize changes to the other parts of the system. Some performance improvement can be achieved with minor changes to the interface of ip_fw_chk_t. This will be done later when this code is settled. The code is meant to compile unmodified on RELENG_4 (once the PACKET_TAG_* changes have been merged), for this reason you will see #ifdef __FreeBSD_version in a couple of places. This should minimize errors when (hopefully soon) it will be time to do the MFC.
* Handle symbolic names for common ethernet types (ip, arp etc.)luigi2002-05-131-19/+85
| | | | | Remove custom definitions (IP_FW_TCPF_SYN etc.) of TCP header flags which are the same as the original ones (TH_SYN etc.)
* Main functional change is the implementation of matching of MAC headerluigi2002-05-121-745/+706
| | | | | | | | | | | | | | | | | | | fields as discussed in the commit to ip_fw.c:1.186 On top of this, a ton of non functional changes to clean up the code, write functions to replace sections of code that were replicated multiple times (e.g. the printing or matching of flags and options), splitting long sections of inlined code into separate functions, and the like. I have tested the code quite a bit, but some typos (using one variable in place of another) might have escaped. The "embedded manpage" is a bit inconsistent, but i am leaving fixing it for later. The current format makes no sense, it is over 40 lines long and practically unreadable. We can either split it into sections ( ipfw -h options , ipfw -h pipe , ipfw -h queue ...) or remove it altogether and refer to the manpage.
* Fix a couple of problems which could cause panics at runtime:luigi2002-05-051-51/+56
| | | | | | | | | | | | | | | | + setting a bandwidth too large for a pipe (above 2Gbit/s) could cause the internal representation (which is int) to wrap to a negative number, causing an infinite loop in the kernel; + (see PR bin/35628): when configuring RED parameters for a queue, the values are not passed to the kernel resulting in panics at runtime (part of the problem here is also that the kernel does not check for valid parameters being passed, but this will be fixed in a separate commit). These are both critical fixes which need to be merged into 4.6-RELEASE. MFC after: 1 day
* Enlighten those who read the FINE POINTS of the documentation a bitcjc2002-05-011-3/+14
| | | | | | | | | more on how ipfw(8) deals with tiny fragments. While we're at it, add a quick log message to even let people know we dropped a packet. (Note that the second FINE POINT is somewhat redundant given the first, but since the code is there, leave the docs for it.) MFC after: 1 day
* I've been meaning to do this for a while. Add an underscore to thedillon2002-01-191-1/+1
| | | | | | | | time_to_xxx() and xxx_to_time() functions. e.g. _time_to_xxx() instead of time_to_xxx(), to make it more obvious that these are stopgap functions & placemarkers and not meant to create a defacto standard. They will eventually be replaced when a real standard comes out of committee.
* mdoc(7) police: tidy up the markup in revision 1.96.ru2002-01-101-5/+12
|
* o Note that packets diverted using a 'divert' socket, and thenrwatson2002-01-031-0/+9
| | | | | | | | reinserted by a userland process, will lose a number of packet attributes, including their source interface. This may affect the behavior of later rules, and while not strictly a BUG, may cause unexpected behavior if not clearly documented. A similar note for natd(8) might be desirable.
* Move the discussion of how many times a packet will pass throughyar2002-01-021-20/+18
| | | | | | | | ipfirewall(4) to the IMPLEMENTATION NOTES section because it considers kernel internals and may confuse newbies if placed at the very beginning of the manpage (where it used to be previously.) Not objected by: luigi
* Clarify the "show" ipfw(8) command.yar2002-01-021-2/+6
| | | | | PR: docs/31263 Permitted by: luigi
* Fix a typo: wierd -> weirdyar2002-01-021-1/+1
|
* Fix documentation to match realityjulian2001-12-281-7/+15
|
* Implement matching IP precedence in ipfw(4).yar2001-12-212-0/+24
| | | | Submitted by: Igor Timkin <ivt@gamma.ru>
* At least once mention the long names of WF2Q+ (Worst-case Fair Weightedrse2001-12-141-2/+2
| | | | | | Fair Queueing) and RED (Random Early Detection) to both give the reader a hint what they are and to make it easier to find out more information about them.
* Default to WARNS=2.obrien2001-12-041-1/+1
| | | | | | Binary builds that cannot handle this must explicitly set WARNS=0. Reviewed by: mike
* sync the code with the one in stable (mostly formatting changes).luigi2001-11-041-26/+27
|
* Fix a typo in a format string, and fix error checking for missingluigi2001-11-011-6/+5
| | | | masks in "limit" rules.
* More white space changes.joe2001-10-291-3/+3
|
* More stylistic tidying.joe2001-10-291-20/+21
|
* Remove training white spaces, and some other style violations.joe2001-10-291-90/+90
|
* Properly convert long to time_tdillon2001-10-281-1/+2
|
* Remove some extraneous spaces from the usage message.joe2001-10-281-1/+1
|
* Repair typo.dd2001-10-141-1/+1
| | | | | PR: 31262 Submitted by: <swear@blarg.net>
OpenPOWER on IntegriCloud