Page MenuHomeFreeBSD

syslogd: Open forwarding socket descriptors
AcceptedPublic

Authored by jfree on Mon, Oct 14, 1:56 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 21, 4:05 AM
Unknown Object (File)
Mon, Oct 21, 4:04 AM
Unknown Object (File)
Mon, Oct 21, 4:04 AM
Unknown Object (File)
Mon, Oct 21, 3:32 AM
Unknown Object (File)
Sun, Oct 20, 1:17 AM
Unknown Object (File)
Tue, Oct 15, 12:11 AM
Unknown Object (File)
Mon, Oct 14, 6:07 AM
Subscribers

Details

Reviewers
markj
Summary

Previously, when forwarding a message to a remote address, the target's
addrinfo was saved at config-parse-time. When message-deliver-time came,
the message's addrinfo was passed into sendmsg(2) and delivered by the
first available inet socket.

The use of sendmsg(2) is prohibited in Capsicum capability mode, so
sockets are now opened and connected to their remote peers at
config-parse-time when executing outside of the capability sandbox.

These sockets are then used with send(2), allowing forwarding to be
performed inside of the capability sandbox.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 60099
Build 56983: arc lint + arc unit

Event Timeline

jfree requested review of this revision.Mon, Oct 14, 1:56 AM

This looks good to me, thanks. A couple of minor nits.

usr.sbin/syslogd/syslogd.c
367–372

Hopefully f->f_addr_fds == NULL implies f->f_num_addr_fds == 0, in which case there's no need to check this condition explicitly.

3051

It'd be nicer to use calloc() here IMO.

This revision is now accepted and ready to land.Mon, Oct 14, 12:45 PM
jfree marked 2 inline comments as done.

Address Mark's comments: use calloc() instead of malloc() for
memory allocations. This is done to avoid potential integer overflow
in total allocation size.

This revision now requires review to proceed.Sat, Oct 19, 6:29 PM
usr.sbin/syslogd/syslogd.c
367–372

Yes. f->f_addr_fds == NULL does imply f->f_num_addr_fds == 0

markj added inline comments.
usr.sbin/syslogd/syslogd_cap_config.c
218

Same here, it'd be nice to use calloc().

This revision is now accepted and ready to land.Mon, Oct 21, 2:27 PM