Commit graph

120 commits

Author SHA1 Message Date
Elyes Haouas 70fad8acae ipf: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-04-28 22:21:09 -06:00
Elyes Haouas f7cee4fa57 sbin: Remove repeated words
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/887
2024-04-11 11:53:37 -06:00
Shin-Yi Zheng 94d9c5f3be
ipf(8): Fix typo
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1002
2024-02-13 15:14:27 +08:00
Elyes Haouas c1f6704bf8 ipf: Fix some typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2024-02-02 21:36:27 -07:00
Jens Schweikhardt 359fc7eb32 Typos corrected; dependant, addres. 2024-01-04 19:17:24 +01:00
Elyes Haouas 540be39b0b tree: Use 1 semicolon at the end of a statement
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/889
2023-12-27 21:05:47 -07:00
Warner Losh 5b31cc94b1 sccs: Manual changes
For the uncommon items: Go through the tree and remove sccs tags that
didn't fit any nice pattern. If in the neighborhood, other SCM tags were
removed when they were detritis of long-ago CVS somehow in the early
mists of the project. Some adjacent copyrights stringswere removed (they
duplicated the copyright notices in the file). This also removed
non-standard formations of omission of SCCS tags (usually by adding an
extra #if 0 somewhere.

After this commit, a number of strings tagged with the 'what' @(#)
prefix remain, but they are primarily copyright notices.

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh 51e16cb8fc sbin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:29 -07:00
Dag-Erling Smørgrav 4cd9d804ae libipf: fix parser error message.
MFC after:	1 week
Reviewed by:	cy
Differential Revision:	https://reviews.freebsd.org/D41652
2023-08-31 22:15:54 +02:00
Warner Losh b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh 2a63c3be15 Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:29 -06:00
Warner Losh 42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Mateusz Guzik e01f9fe10c ipf: low-effort fix to make it compilable without inet6 2023-07-05 10:02:32 +00:00
John Baldwin 90f2fee0e0 ipf: Remove set but unused variables.
Reported by:	clang
Differential Revision:	https://reviews.freebsd.org/D40667
2023-06-27 10:19:32 -07:00
John Baldwin a7f25f141a libipf: Remove set but unused variable from printfraginfo().
Reported by:	GCC
Differential Revision:	https://reviews.freebsd.org/D40652
2023-06-27 10:19:31 -07:00
John Baldwin 553022aba5 ipf: Remove no-longer-needed NO_WARRAY_BOUNDS. 2023-06-09 15:35:32 -07:00
Elyes Haouas 843fe4892e ipf: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653
2023-06-01 20:33:40 -06:00
Elyes Haouas e095cbab2f ipf/ipfstat: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653
2023-06-01 20:33:39 -06:00
Elyes Haouas 0939cf32c0 ipf/libipf: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653
2023-06-01 20:33:38 -06:00
Simon J. Gerraty d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
John Baldwin 2ac057dd33 ipf: Use C89 function definitions.
Reviewed by:	zlei
Differential Revision:	https://reviews.freebsd.org/D39523
2023-04-18 11:22:28 -07:00
Ed Maste 714f6f9c14 ipfilter: replace defunct home page link with FAQ URL
ipfilter.org disappeared in mid 2004.  There is still a FAQ at
https://www.phildev.net/ipf so point to that.
2022-11-15 17:11:59 -05:00
Cy Schubert 1fcc50004c ipfilter: Removed unused ioctl typedef
Defunct operating systems no longer pollute the ipfilter sources. Remove
their typedefs.

MFC after:	1 week
2022-10-08 17:28:04 -07:00
Cy Schubert 00d8a28f19 ipfilter/libipf: printpool_live() consumer ignores return code
The single consumer of printpool_live() ignores the return code.
Avoid wasting resources on this.

MFC after:	2 weeks
2022-09-22 15:38:12 -07:00
Cy Schubert 5568c8b2c5 ipfilter/ippool: Return error code when listing a pool fails
When an internal or other error occurs during the listing of a pool,
return an error code when extiting ippool(8). Printing an error to
stderr without returning an error code is useless in shell scripts.

MFC after:	2 weeks
2022-09-22 15:38:11 -07:00
Cy Schubert 7531c434a5 ipfilter/ippool: Dump a copy of ippool in ippool.conf format
Add an ippool(8) option to dump a copy of the inm-memory ippool tables
in an ippool(5) format so that it can be reloaded using ippool -f.

MFC after:	2 weeks
2022-09-22 15:38:11 -07:00
Gordon Bergling b89592a9ef ipf.4: Correct a typo in the manual page
- s/occured/occurred/

MFC after:	3 days
2022-09-04 12:55:42 +02:00
Cy Schubert c47db49ba4 ipfilter: Support only jails in VNET
Jails without VNET have complete access to the ipfilter rules, NAT,
pools and logs. This is insecure. Only allow jails to manipulate
ipfilter rules, NAT tables and ippools if the jail has its own VNET.
Otherwise a jail can affect the global system.

This patch brings ipfilter in line with ipfw's support of VNET jails and
non-support of non-VNET jails.

MFC after:	1 week
2022-07-07 07:53:45 -07:00
Gordon Bergling d7958fe1bc ipnat(5): Fix a double word in the manual page
- s/be be/be/

MFC after:	3 days
2022-04-09 09:28:43 +02:00
Gordon Bergling 8a3568b584 ipf(5): Fix a typo in the manual page
- s/accomodate/accommodate/

MFC after:	3 days
2022-04-02 14:50:45 +02:00
Cy Schubert 93c1048a13 ipfilter: Reliably print the interface name
When printing the interface name from the ipstate_t struct the interface
name in is_ifp may not always be avaiable when reading it from kmem
(tested on FreeBSD and NetBSD). However the is_ifname (the interface
name character string) is almost always available -- it is not available
when the source of the packet is a process running on the firewall
itself. Rather than print both interface name strings, print only the
one.

MFC after:	1 week
2022-03-03 06:43:12 -08:00
Cy Schubert ec793543fe ipfilter: Obtain the interface name more efficiently
Rather than use a kmem read to determine the interface name used by a
nat_t structure through a pointer, nat_ipfs->netif->if_xname, obtain it
directly from nat_ifnames in the nat_t structure itself using the new
FORMAT_IF macro.

MFC after:	1 week
2022-03-03 06:43:11 -08:00
Cy Schubert 915395a280 ipfilter: Introduce the new FORMAT_IF macro
Interface names stored in the ipstate_t and ipnat_t structures can be
NULL. This occurs when an application, such as named, is running on the
firewall machine itself. For example an application, i.e. named, running
on the firewall itself will cause a state table display and NAT mapping
display to show a null ingress interface and its egress interface. This
is perfectly valid but confusing to human eyes. Rather than print
nothing, print "(null)".

MFC after:	1 week
2022-03-03 06:43:11 -08:00
Cy Schubert 9291d079d5 ipfilter: Print protocol when listing NAT table mappings
NAT table mappings list only the source and destination IP, the source
and destinaion port numbers, and their mappings. But the protocol is not
listed. Now that Facebook and Google use QUIC, seeing port 443 in in a
list of active NAT sessions could mean 443/tcp or 443/udp. This patch
adds the protocol to the listing to aid in determining whether HTTPS is
TCP or QUIC in a NAT mapping listing. This also helps differentiatinete
between other protocols such as ICMP, ESP, and AH in ipnat list of active
sessions.

MFC after:	1 week
2022-02-28 12:11:39 -08:00
Cy Schubert 08ab34a06a ipfilter: Restore ipfsync
ipfsync is a WIP sync daemon designed to be used in a failover scenario.
It was removed by 5ee61c7daa. This commit
restores its three files. ipfsync is in my work queue.

MFC after:	10 days
X-MFC with:	5ee61c7daa
2022-01-07 21:46:53 -08:00
Cy Schubert ad07e93fe1 ipfilter: Fix manpage typos
Reported by:	jrtc27
Fixes:		2582ae5740
MFC after:	1 month
2022-01-04 07:11:00 -08:00
Cy Schubert cc3e5b372e ipfilter userland: Fix typos
Reported by:	netchild
Fixes:		2582ae5740
MFC after:	1 month
2022-01-04 03:08:51 -08:00
Cy Schubert a3522837b0 ipfilter userland: Fix branch mismerge
The work to ANSIfy and adjust returns to style(9) resulted in a mismerge
of a stash when ipfilter was moved from contrib to sbin. An older file
replaced WIP at the time, resulting in a regression.

The majority of this work was done in 2018 saved as git stashes within
a git-svn tree and migrated to the git tree. The regression occurred
when the various stashes were sequentially merged to create individual
commits, following the ipfilter move to netpfil and sbin.

Reported by:	jrtc27
Fixes:		2582ae5740
Pointy hat to:	cy
MFC after:	1 month
2022-01-03 19:39:24 -08:00
Cy Schubert 44bc301921 ipfilter userland: Style(9) requires a space after return
Reported by:    jrtc27
Fixes:          2582ae5740
MFC after:      1 month
2022-01-03 19:37:25 -08:00
Cy Schubert d86f022e79 ipfilter: Fix typos
Reported by:	jrtc27
Fixes:		2582ae5740
MFC after:	1 month
2022-01-03 18:45:10 -08:00
Cy Schubert 5e13b104a4 ipfilter userland: Fix whitespace errors
Replace leading spaces with a tabs on affected lines.

MFC after:	1 month
2022-01-03 18:06:44 -08:00
Cy Schubert 27fc223414 ipfilter userland: Remove trailing whitespace
MFC after:	1 month
2022-01-03 18:06:44 -08:00
Cy Schubert 2582ae5740 ipfilter: Adjust userland returns to conform to style(9)
Adjust ipfilter's userland return statements to conform to style(9).

MFC after:	1 month
2022-01-03 18:06:43 -08:00
Cy Schubert 9be9c1c084 ipfilter: INLINE --> inline
Replace the INLINE macro with inline. Some ancient compilers supported
__inline__ instead of inline. The INLINE hack compensated for it.
Ancient compilers are history.

Reported by:	glebius
MFC after:	1 month
2022-01-03 18:06:42 -08:00
Cy Schubert efeb8bffe3 ipflter: ANSIfy userland function declarations
Convert ipfilter userland function declarations from K&R to ANSI. This
syncs our function declarations with NetBSD hg commit 75edcd7552a0
(apply our changes). Though not copied from NetBSD, this change was
partially inspired by NetBSD's work and inspired by style(9).

Reviewed by:		glebius (for #network)
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D33595
2022-01-03 18:06:42 -08:00
Cy Schubert d740faa30a ipfilter userland: Revert the ipmon part of a6fb9bbea7
a6fb9bbea7 caused incorrect formatting of ipmon log output.

Fixes:		a6fb9bbea7
MFC after:	immediately
2021-12-27 01:10:52 -08:00
Cy Schubert 7cb2d7c413 ipfilter userland: Path fixup no longer required
Since the move of ipfilter from contrib to sbin adjusting the source path
is no longer required.

Fixes:		41edb306f0
MFC after:	1 month
2021-12-27 00:40:18 -08:00
Cy Schubert 41edb306f0 ipfilter: Move userland bits to sbin
Through fixes and improvements our ipfilter sources have diverged
enough to warrant move from contrib into sbin/ipf. Now that I'm
planning on implementing MSS clamping as in iptables it makes more
sense to move ipfilter to sbin.

This is the second of three commits of the ipfilter move.

Suggested by glebius on two occaions.

Suggested by and discussed with:	glebius
Reviewed by:				glebius, kp (for #network)
MFC after:				1 month
Differential Revision:		https://reviews.freebsd.org/D33510
2021-12-20 06:16:33 -08:00
Cy Schubert 3b9b51fe46 ipfilter: Move kernel bits to netpfil
Through fixes and improvements our ipfilter sources have diverged
enough to warrant move from contrib into sys/netpil. Now that I'm
planning on implementing MSS clamping as in iptables it makes more
sense to move ipfilter to netpfil.

This is the first of three commits the ipfilter move.

Suggested by glebius on two occaions.

Suggested by and discussed with:	glebius
Reviewed by:				glebius, kp (for #network)
MFC after:				1 month
Differential Revision:		https://reviews.freebsd.org/D33510
2021-12-20 06:16:33 -08:00