vio(4): check for csum offload before using TSO
We need a double check here for this illegal behavior,
cause not all Hypervisor follow the VirtIO specification.
And Linux has this check, too.
Report and diff from Ali Raheem.
ok stsp@
pf: compute the /0 IPv4 source-limiter mask without a 32-bit shift
prefix 0 keeps the zeroed mask: every address in one bucket.
A shift by 32 is UB.
OK kn@
pf_rule_free needs to pf_tag_unref
pf_rule_copyin() may have taken tag references before the
caller bailed out; drop them like pf_rm_rule() does for rules
that made it into a ruleset.
OK henning
Limit TCP reassembly list walks.
To prevent CPU exhaustion by a remote TCP peer, limit the t_segq
queue length. The segment at rcv_nxt is still accepted, so the
missing data can drain a full queue. Large windows on a high
bandwidth connection may hit a strict 100 segment maximum in
legitimate cases, so also make the limit depend on the socket buffer
size. Introduce a specific TCP counter for a full reassembly queue.
from Acts1631; OK claudio@
rpki-client: reject rsync hosts starting with '.' as well
Not all calls to rsync_base_uri() pass through valid_uri(), so reject '.'
at the start here as well.
ok claudio job
rpki-client: validate first host character
After refactoring to normalize the uri scheme, a check that a host must
not start with a '.' was missed, which enabled path traversal on systems
that don't have unveil(). Reject zero-length hosts as well.
Pointed out by Ties de Kock
ok claudio job
Stop setting pr_protocol to PF_UNIX for unix domain sockets.
This reverts the rev 1.3 commit from 1998:
Allow PF_LOCAL as the proto arg in socketpair(2). Previously, only
PF_UNSPEC would work. Needed for general sanity as well as XPG4.2.
PF_LOCAL and AF_LOCAL is dead. So is the idea of passing any value other
than 0 to socketpair's protocol argument. Set pr_protocol explicitly to
0 to show that this is intentional.
This fixes an unexpected return value of 1 for
getsockopt(fd, SOL_SOCKET, SO_PROTOCOL, ...) calls.
Reported by robert@
OK millert@
Use the correct pr_domain->dom_family == AF_UNIX check in SO_PEERCRED.
Using pr_protocol instead of checking the pr_domain dom_family field
will stop working for AF_UNIX.
OK millert@
Rework aspath_verify error handling and expand what AS_ERR_SOFT covers
Instead of AS_ERR_SOFT as a catchall for various soft errors split
the aspath_verify error into negative and positive errors. Negative
errors are hard errors and reset the session. Positive errors are
soft errors and use treat-with-withdraw.
Introduce AS_IS_HARD_ERROR() macro to quickly check for hard errors.
Treat AS_ERR_MAX as a soft-error to prevent a reset in this specific
case. The path is valid but too large and could cause downstream issues.
Reported by Özgün Kültekin
OK tb@
rpki-client: check auth_insert() return value in proc_parser_root_cert()
Plugs a leak that should be unreachable because TALs are inserted before
anything else.
ok claudio
rpki-client: ensure hex_encode() fills the provided buffer
Since the decoded buffer is binary data, the caller must know how much of
the buffer will be valid. All the callers pass a properly sized buffer, so
enforce this in the API.
This is a second way of fixing a report of Ties de Kock and should prevent
further errors.
ok claudio
rpki-client: ensure that PP send a properly sized "hash"
Do not trust the PP and check that the hash has a chance of being a hex
encoded SHA-256. Per RFC 8182, 3.5.1.3:
o The hash attribute in snapshot and delta elements MUST be the
hexadecimal encoding of the SHA-256 [SHS] hash of the referenced
file.
Reported by Ties de Kock
ok claudio
rpki-client: reworks spl_insert_vsp()
The insertion logic here was adapted from ASPA, which is very confusing.
Rework this to be like the new ASPA code, mirroring the logic with the
obvious tweaks, also avoiding a zero-sized allocation.
Cap to the size of an SPL and overflow it so as to avoid unbounded memory
growth. Again, none of this exists in the wild right now. Improved limits
and addition of stats can be dealt with in quieter times.
ok claudio
rpki-client: fix VSP expiry
Use the same approach like in ASPAs and expire the VSP when the first part
expires, not when there is nothing left in it. None of that stuff exists,
so let us reconsider when people show interest in deploying this.
ok claudio
rpki-client: fix rsync_base_uri()
claudio noticed that the string passed to this function is not always
NUL-terminated, so be more careful by adding length checks everywhere.
This isn't pretty but unfortunately necessary. URIs are almost as bad
as X.501 distinguished names.
ok claudio
relayd: ignore foreign ICMP packets in recv_icmp() instead of warning
Only accept ICMP echo replies in recv_icmp() and log foreign packets
at debug level instead of log_warn().
Reported and diff by Kapetanakis Giannis, OK kirill@
Verify both randomized signatures in the ML-DSA regression test
The test comment says both signatures should verify. Add the missing
verification check for the first signature.
ok tb@