[WIP] net/ip: Consolidate RECVERR-vs-sk_err handling

Linux's current userspace semantics for setting sk_err on datagram
sockets is complex, and it's implemented separately, in different ways,
in several files.

Consolidate the logic into a new helper and use it for all IP datagram
socket types.

This is IMO an improvement to the comprehensibility of the code, and
it also makes implementing IP_RECVERR_QUIET much more straightforward.

Ideally the ip_icmp_error()/ipv6_icmp_error() call would move to the
helper as well, but it would get messy due to the ability to compile
IPv6 as a module.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
5 files changed