Commit graph

100 commits

Author SHA1 Message Date
Dag-Erling Smørgrav f01e4edfc8 libipf: fix parser error message.
MFC after:	1 week
Reviewed by:	cy
Differential Revision:	https://reviews.freebsd.org/D41652

(cherry picked from commit 4cd9d804ae)
2023-09-14 16:59:52 +02:00
Warner Losh 24115b70d6 Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/

Similar commit in main:
(cherry picked from commit b2c76c41be)
2023-08-23 11:43:32 -06:00
Warner Losh 023fc80ee3 Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/

Similar commit in main:
(cherry picked from commit d0b2dbfa0e)
2023-08-23 11:43:30 -06:00
Warner Losh 8ad303d68c Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/

Similar commit in main:
(cherry picked from commit 2a63c3be15)
2023-08-23 11:43:23 -06:00
Warner Losh 34041aac83 Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/

Similar commit in main:
(cherry picked from commit 42b388439b)
2023-08-23 11:43:22 -06:00
Cy Schubert 2b087796cc ipfilter: Removed unused ioctl typedef
Defunct operating systems no longer pollute the ipfilter sources. Remove
their typedefs.

(cherry picked from commit 1fcc50004c)
2022-10-15 17:33:00 -07:00
Cy Schubert a993eeb44d ipfilter/libipf: printpool_live() consumer ignores return code
The single consumer of printpool_live() ignores the return code.
Avoid wasting resources on this.

(cherry picked from commit 00d8a28f19)
2022-10-06 06:56:27 -07:00
Cy Schubert 685159977f 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.

(cherry picked from commit 5568c8b2c5)
2022-10-06 06:55:57 -07:00
Cy Schubert 9007a64247 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.

(cherry picked from commit 7531c434a5)
2022-10-06 06:55:39 -07:00
Gordon Bergling 8f6bdf15ff ipf.4: Correct a typo in the manual page
- s/occured/occurred/

(cherry picked from commit b89592a9ef)
2022-09-07 09:32:12 +02:00
Cy Schubert 831c6b8edd 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.

(cherry picked from commit c47db49ba4)
2022-07-14 06:54:22 -07:00
Gordon Bergling 6eef2e6425 ipnat(5): Fix a double word in the manual page
- s/be be/be/

(cherry picked from commit d7958fe1bc)
2022-04-14 08:14:37 +02:00
Gordon Bergling b2f08f92a0 ipf(5): Fix a typo in the manual page
- s/accomodate/accommodate/

(cherry picked from commit 8a3568b584)
2022-04-09 08:10:37 +02:00
Cy Schubert 1fc127c5e1 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.

(cherry picked from commit 93c1048a13)
2022-03-09 16:31:40 -08:00
Cy Schubert 9b1b1dca31 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.

(cherry picked from commit ec793543fe)
2022-03-09 16:31:40 -08:00
Cy Schubert 35ddf84138 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)".

(cherry picked from commit 915395a280)
2022-03-09 16:31:40 -08:00
Cy Schubert d1f3afc4a4 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.

(cherry picked from commit 9291d079d5)
2022-03-07 05:32:58 -08:00
Cy Schubert d0695f8a40 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.

(cherry picked from commit 08ab34a06a)
2022-02-07 05:51:18 -08:00
Cy Schubert 52f62a6983 ipfilter: Fix manpage typos
Reported by:	jrtc27
Fixes:		2582ae5740

(cherry picked from commit ad07e93fe1)
2022-02-07 05:51:17 -08:00
Cy Schubert f4d126ee1f ipfilter userland: Fix typos
Reported by:	netchild
Fixes:		2582ae5740

(cherry picked from commit cc3e5b372e)
2022-02-07 05:51:17 -08:00
Cy Schubert 189b9222f9 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

(cherry picked from commit a3522837b0)
2022-02-07 05:51:17 -08:00
Cy Schubert fcb8e92558 ipfilter userland: Style(9) requires a space after return
Reported by:    jrtc27
Fixes:          2582ae5740

(cherry picked from commit 44bc301921)
2022-02-07 05:51:17 -08:00
Cy Schubert d47287c437 ipfilter: Fix typos
Reported by:	jrtc27
Fixes:		2582ae5740

(cherry picked from commit d86f022e79)
2022-02-07 05:51:16 -08:00
Cy Schubert 7d98606953 ipfilter userland: Fix whitespace errors
Replace leading spaces with a tabs on affected lines.

(cherry picked from commit 5e13b104a4)
2022-02-07 05:51:16 -08:00
Cy Schubert fa66e74d3b ipfilter userland: Remove trailing whitespace
(cherry picked from commit 27fc223414)
2022-02-07 05:51:16 -08:00
Cy Schubert 9787fb28c9 ipfilter: Adjust userland returns to conform to style(9)
Adjust ipfilter's userland return statements to conform to style(9).

(cherry picked from commit 2582ae5740)
2022-02-07 05:51:15 -08:00
Cy Schubert c95ef272f1 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

(cherry picked from commit 9be9c1c084)
2022-02-07 05:51:15 -08:00
Cy Schubert 9ff592d868 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)
Differential Revision:	https://reviews.freebsd.org/D33595

(cherry picked from commit efeb8bffe3)
2022-02-07 05:51:15 -08:00
Cy Schubert dd68201611 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

(cherry picked from commit 7cb2d7c413)
2022-02-07 05:51:14 -08:00
Cy Schubert 95daf09d07 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)
Differential Revision:		https://reviews.freebsd.org/D33510

(cherry picked from commit 41edb306f0)
2022-02-07 05:51:14 -08:00
Cy Schubert 5729ebba33 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)
Differential Revision:		https://reviews.freebsd.org/D33510

(cherry picked from commit 3b9b51fe46)
2022-02-07 05:51:14 -08:00
Cy Schubert 015cb6cde4 Create a link to the ipmon.conf.5 man page as documented in ipmon.5.
Add its corresponding optional removal entry.

PR:		238816
MFC after:	1 week
2019-06-27 12:37:44 +00:00
Cy Schubert 74bc7fc0b4 Add the ipmon.5 man page.
PR/238816 initially addressed updates to usage() however the PR has
morphed into a shopping list of updates to usage() and man pages.

PR:		238816 (I added to the list during discussion)
MFC after:	1 week
2019-06-27 02:43:26 +00:00
Bryan Drewery ae9f7248f9 rescue ipf: Remove hacks and link in libipf directly.
Sponsored by:	Dell EMC Isilon
2017-11-10 07:52:58 +00:00
Bryan Drewery ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Cy Schubert 48fa9d448d Disconnect ipftest and ipresend from the build until it can be verified
that they still work. These utilities have become out of sync with the
code in the kernel and need work to bring them back into shape.
Most people test on real systems or VMs on real networks.

Suggested by:	glebius
2017-03-14 02:10:37 +00:00
Cy Schubert 92044f3e36 Revert r315218 so that it may be committed together with r315219. 2017-03-14 02:06:12 +00:00
Cy Schubert f0a7513344 Disconnect ipftest and ipresend from the build until it can be verified
that they still work. These utilities have become out of sync with the
code in the kernel and need work to bring them back into shape.
Most people test on real systems or VMs on real networks.

Sugested by:	glebius
2017-03-14 01:00:09 +00:00
Enji Cooper 22289a8c3d sbin: normalize paths using SRCTOP-relative paths or :H when possible
This simplifies make logic/output

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-04 11:33:01 +00:00
Glen Barber 52259a98ad MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 16:14:46 +00:00
Bryan Drewery bd18fd57db DIRDEPS_BUILD: Regenerate without local dependencies.
These are no longer needed after the recent 'beforebuild: depend' changes
and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports
skipping 'make depend'.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:20:11 +00:00
Glen Barber 7de1daeb93 Create packages for atm, ccdconfig, devd, ipf, ipfw,
iscsi, natd, nandfs, pf, quotacheck, and routed.

Add ping6 and rtsol to the runtime package.

Sponsored by:	The FreeBSD Foundation
2016-02-09 19:30:31 +00:00
Bryan Drewery 7aab86d59d For INTERNALLIB always add in the corresponding _DP_ and use LIBADD in
the real build file.

This lessens the need to define DPADD_<lib> and LDADD_<lib> to just very
special cases.

Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:17 +00:00
Bryan Drewery b748535cc4 Don't add LIBADD=ipf to libipf itself.
This had no real impact since libipf is a static INTERNALLIB.  It does conflict
with an assertion I am adding for LIBADD though.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 22:39:19 +00:00
Bryan Drewery cf990407e1 Update dependencies after r291406 added libelf to libkvm.
Unfortunately filemon/meta mode tracks all indirect dependencies here
since ld(1) is reading libelf when linking in libkvm.  Churn would be
reduced if this was able to be limited to direct dependencies.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:18:48 +00:00
Bryan Drewery 277fbb92d5 Remove redundant DPSRCS which were already in SRCS.
DPSRCS already contains all of SRCS.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-11-25 20:38:07 +00:00
Bryan Drewery 10b83bb0e9 META_MODE: For some reason meta mode cannot generate the intermediate tab.c
files.  Split up all of the targets to be more clear on how they are generated
to fix the problem.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-02 07:00:43 +00:00
Bryan Drewery 6a8077f3d5 Add SUBDIR_PARALLEL.
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-09-26 01:28:50 +00:00
Bryan Drewery a98533d3e8 Remove disconnected directories.
These were added disconnected in 2005 in r145524.

Sponsored by:	EMC / Isilon Storage Division
2015-09-26 01:24:35 +00:00
Bryan Drewery 42c4cf86d4 Update META_MODE dependencies. 2015-09-17 05:06:34 +00:00