Commit graph

306 commits

Author SHA1 Message Date
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 3d497e17eb Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/

Similar commit in main:
(cherry picked from commit 1d386b48a5)
2023-08-23 11:43:26 -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
Warner Losh 17da660ad5 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/

Similar commit in main:
(cherry picked from commit b3e7694832)
2023-08-23 11:43:21 -06:00
Warner Losh caa41f6417 spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix

(cherry picked from commit 4d846d260e)
2023-07-25 09:13:49 -06:00
Alan Somers f7896015fc ctlstat: add prometheus output
When invoked by inetd, ctlstat -P will now produce output suitable for
ingestion into Prometheus.

It's a drop-in replacement for https://github.com/Gandi/ctld_exporter,
except that it doesn't report the number of initiators per target, and
it does report time and dma_time.

Sponsored by:	Axcient
Relnotes:	yes
Reviewed by: 	bapt, bcr
Differential Revision: https://reviews.freebsd.org/D29901

(cherry picked from commit 1a7f22d9c2)
2022-05-12 14:43:01 -06:00
Mateusz Piotrowski 4bad5bb129 inetd: Use the synopsis from the manual page
Also, document -s in the usage message.

MFC after:	7 days

(cherry picked from commit 648b9ce80e)
2021-12-13 02:10:26 +01:00
Mateusz Piotrowski e99e7f1738 inetd.8: Lint the file
Remove Tn macros and fix other style warnings.

MFC after:	3 days

(cherry picked from commit aab6fe0c2c)
2021-12-09 10:17:55 +01:00
Mateusz Piotrowski b834c56a18 inetd.8: Sort options
While here:

- Cluster flags without arguments together.
- Simplify the synopsis of the -a flag. There is no need to distinguish
  between address and hostname there.
- Add a missing argument to the -a flag in the description section.
- Fix some typos.

MFC after:	3 days

(cherry picked from commit 593ad024e4)
2021-12-09 10:17:55 +01:00
Kyle Evans 46cccd5ceb inetd: fix unix sockaddr's length assignment
unsz was always exactly '1' here due to an unfortunate mispositioning
of closing parenthesis. While it's generally irrelevant because bind(2)
is passed the (accurate) sep->se_ctrladdr_size instead, it's not very
helpful for anything locally that wants to use it rather than assuming
that sep->se_ctrladdr_size perfectly fits the end of sun_path.

Just drop unsz entirely and use the result of SUN_LEN() for it.

(cherry picked from commit 1253835121)
2021-02-15 20:25:15 -06:00
Kyle Evans 26a4a61a28 inetd(8): Add comments to all examples
Submitted by:	debdrup (with some minor changes by kevans)
Reviewed by:	bcr (manpages)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D24818
2020-05-14 17:52:29 +00:00
Kyle Evans a58fc86151 inetd(8): Provide HTTP proxy example using netcat
One of the fortunes that are included in freebsd-tips talks about how
the superserver can be used to proxy connections with netcat, but there are
no examples provided. This commit adds an example with comment explaining
what it does.

Submitted by:	debdrup
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24800
2020-05-13 02:17:27 +00:00
Kyle Evans 525c896ba8 inetd: two more nits
Use __COPYRIGHT for copyright to simply either embed it via .ident or have
it properly marked __unused

Move an ipsec reference to IPSEC
2020-01-10 14:43:57 +00:00
Kyle Evans 36cac5570f inetd: free WITHOUT_INET6_SUPPORT build of warnings
If inetd is compiled without inet6 support, we need to error out on
rpc+inet6 services rather than attempting to call into rpc bits with an
uninitialized netid.

v4bind is only used with INET6 support, so move it under the proper #ifdefs
with v6bind.

Reported by:	Pavel Timofeev <timp87 gmail com>
MFC after:	3 days
2020-01-10 14:40:04 +00:00
Ed Maste 9a3e2f583f inetd: fix WITHOUT_TCP_WRAPPERS build after r356248
After increasing WARNS, building WITHOUT_TCP_WRAPPERS failed because of
some unused variables.

Reported by:	Cirrus-CI (against my WIP branch)
MFC with:	r356248
Sponsored by:	The FreeBSD Foundation
2020-01-03 15:29:32 +00:00
Kyle Evans 705d79b4bd inetd: final round of trivial cleanup, NFC
Highlights:
- Use MAX() for maxsock raising; small readability improvement IMO
- malloc(3) + memset(3) -> calloc(3) where appropriate
- stop casting the return value of malloc(3)
- mallloc(3) -> reallocarray(3) where appropriate

A future change may enter capability mode when forking for some of the
built-in handlers.
2020-01-01 18:49:57 +00:00
Kyle Evans c8863d0590 inetd: convert remaining bzero(3) to memset(3), NFC
This change is purely in the name of noise reduction from static analyzers
that want to complain that bzero(3) is obsolete in favor of memset(3).

With this, clang-analyze at least is now noise free. WARNS= 6 also appears
to have been OK for some time now, so drop the current setting and opt for
the default.
2020-01-01 04:29:08 +00:00
Kyle Evans c53b0f40f3 inetd: track all child pids, regardless of maxchild spec
Currently, child pids are only tracked if maxchildren is specified. As a
consequence, without a maxchild limit we do not get a notice in syslog on
children aborting abnormally. This turns out to be a great debugging aide at
times.

Children are now tracked in a LIST; the management interface is decidedly
less painful when there's no upper bound on the number of entries we may
have at the cost of one small allocation per connection.

PR:		70335
2020-01-01 04:22:04 +00:00
Kyle Evans d6272fce7c inetd: add some macros for checking child limits, NFC
The main point here is capturing the maxchild > 0 check. A future change to
inetd will start tracking all of the child pids so that it can give proper
and consistent notification of process exit/signalling.
2020-01-01 03:59:54 +00:00
Kyle Evans a1cedb80c6 inetd: prefer strlcpy to strlen(3) check + strcpy(3), NFC
This is again functionally equivalent but more concise.
2019-12-31 04:53:50 +00:00
Kyle Evans 1c3b9acf2e inetd: prefer strtonum(3) to strspn(3)+atoi(3), NFC
strtonum(3) does effectively the same validation as we had, but it's more
concise.
2019-12-31 04:36:14 +00:00
Kyle Evans f23df31975 inetd: knock out some clang analyze warnings
chargen_dg: clang-analyze is convinced that endring could be non-NULL at
entry, and thus wants to assume that rs == NULL. Just independently
initialize rs if it's NULL to appease the analyzer.

getconfigent: policy leaks on return

free_connlist: reorganize the loop to make it clear that we're not going to
access `conn` after it's been freed.

cpmip/hashval: left-shifts performed will result in UB as we take
signed 0xABC3D20F and left shift it by 5.
2019-12-31 04:00:24 +00:00
Kyle Evans f930f30f60 inetd: don't leak policy on return
sep->se_policy gets a strdup'd version of policy, so we don't need it to
stick around afterwards.

While here, remove a couple of NULL checks prior to free(policy).

CID:		1006865
MFC after:	3 days
2019-12-30 15:54:36 +00:00
Simon J. Gerraty 2c9a9dfc18 Update Makefile.depend files
Update a bunch of Makefile.depend files as
a result of adding Makefile.depend.options files

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22494
2019-12-11 17:37:53 +00:00
Simon J. Gerraty 5ab1c5846f Add Makefile.depend.options
Leaf directories that have dependencies impacted
by options need a Makefile.depend.options file
to avoid churn in Makefile.depend

DIRDEPS for cases such as OPENSSL, TCP_WRAPPERS etc
can be set in local.dirdeps-options.mk
which can add to those set in Makefile.depend.options

See share/mk/dirdeps-options.mk

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22469
2019-12-11 17:37:37 +00:00
Warner Losh 01b0122954 Remove all the RELEASE_CRUNCH instances that partially disable IPSEC
We remove IPSEC only in parts of the tree, and not others. RELEASE_CRUNCH to
disable it has not kept up with all its uses. Remove it. Should there be a real
need to disable IPSEC, one that hasn't shown up in the base system to date,
it can be re-added behind a WITHOUT_IPSEC build option.
2019-07-15 14:19:39 +00:00
Brad Davis eecd09850d Move inetd.conf to usr.sbin/inetd/
This is pkgbase related as it uses CONFS to tag the file as a config file

Approved by:	AllanJude (mentor)
Sponsored by:	Essen Hackathon
Differential Revision:	https://reviews.freebsd.org/D16693
2018-08-12 13:29:40 +00:00
Pedro F. Giffuni 1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Xin LI 483825ed9a Don't assign rs as we will assign it later.
MFC after:	2 weeks
2017-11-27 04:15:03 +00:00
Pedro F. Giffuni 8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Bryan Drewery ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Hiroki Sato d31d87b0a7 Simplify a pipe for signal handling. 2017-03-20 17:57:24 +00:00
Warner Losh fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Enji Cooper 484b700751 Fix up r312105
- Only #include tcpd.h when LIBWRAP is true to avoid header include errors
- Only define whichaf when LIBWRAP is true to avoid -Wunused warning and
  to avoid issues with structs being defined that should only be defined
  when tcpd.h is included.

MFC after:	2 weeks
X-MFC with:	r312105
Pointyhat to:	ngie
Reported by:	gcc tinderbox
Sponsored by:	Dell EMC Isilon
2017-01-14 10:20:38 +00:00
Enji Cooper 63eca8f1dd Conditionalize libwrap support into inetd based on MK_TCP_WRAPPERS
This will allow inetd to stand by itself without libwrap.

MFC after:	2 weeks
Relnotes:	yes
Reviewed by:	hrs (earlier version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D9056
2017-01-14 01:37:03 +00:00
Hiroki Sato 1232b86014 Fix build when WITHOUT_INET6 is defined. 2017-01-05 03:25:16 +00:00
Hiroki Sato 4909085f84 - Add static for symbols which need not to be exported.
- Clean up warnings to the WARNS=6 level.
2016-12-31 11:03:34 +00:00
Baptiste Daroussin f03ef8405b Rename getline with get_line to avoid collision with getline(3)
When getline(3) in 2009 was added a _WITH_GETLINE guard has also been added.
This rename is made in preparation for the removal of this guard
2016-05-10 11:12:31 +00:00
Marcelo Araujo a1b422f4d6 Use MAX macro from sys/param.h.
MFC after:	2 weeks.
2016-05-02 01:43:22 +00:00
Baptiste Daroussin 02277afdb1 Use the SOCK_CLOEXEC flags in the socket(2) 'type' attribute instead of
calling fcntl(2)

MFC after:	1 week
2016-04-16 13:10:31 +00:00
Baptiste Daroussin 29808109ea Use pipe2(2) to directly set the close-on-exec flags directly
MFC after:	1 week
2016-04-16 12:42:01 +00:00
Hiroki Sato fb0e28f0e1 - Remove unused union p_un.
- Use NI_MAXHOST-long buffer for getnameinfo().
  Although INET6_ADDRSTRLEN was designed to hold the longest
  IPv6 address in IPv4-mapped address format a long time ago,
  getnameinfo() can return scope identifier in addition to it.

MFC after:	1 day
2015-09-19 23:48:06 +00:00
Hiroki Sato 157d2c3355 - Fix a crash on a rpc entry when an IPv6 address is explicitly specified
in -a flag.

- Fix a bug that sockaddr_in was used where sockaddr_in6 should have
  been used.  This was not actually harmful because offsetof(struct
  sockaddr_in, sin_port) is equal to offsetof(struct sockaddr_in6,
  sin6_port).

MFC after:	1 day
2015-09-19 23:27:22 +00:00
Simon J. Gerraty ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty 44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty 98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Eitan Adler d5792866b0 identd: restore memcpy
I should not be committing at 2:30am....

Reported by:	pluknet
2015-04-19 09:35:46 +00:00
Eitan Adler 7ebd5ed4d4 identd: also zero se_rpc_highvers
Reported by:	pluknet
2015-04-19 09:27:47 +00:00
Eitan Adler af5f5a398f identd: remove redundant zeroing
se_rpc_lowvers was set to 0 twice, so remove one of them
	I can not find any other variable which they may have been a typo of.

Reported by:	gcc5.1
2015-04-19 09:07:57 +00:00