OSDN Git Service

udp: Support for error handlers of tunnels with arbitrary destination port
authorStefano Brivio <sbrivio@redhat.com>
Thu, 8 Nov 2018 11:19:22 +0000 (12:19 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Nov 2018 01:13:08 +0000 (17:13 -0800)
commite7cc082455cb49ea937a3ec4ab3d001b0b5f137b
tree61b2e601305c88642df9eb07caf2bc3837f1ba53
parent32bbd8793f24b0d5beb1cdb33c45c75ad1140e4b
udp: Support for error handlers of tunnels with arbitrary destination port

ICMP error handling is currently not possible for UDP tunnels not
employing a receiving socket with local destination port matching the
remote one, because we have no way to look them up.

Add an err_handler tunnel encapsulation operation that can be exported by
tunnels in order to pass the error to the protocol implementing the
encapsulation. We can't easily use a lookup function as we did for VXLAN
and GENEVE, as protocol error handlers, which would be in turn called by
implementations of this new operation, handle the errors themselves,
together with the tunnel lookup.

Without a socket, we can't be sure which encapsulation error handler is
the appropriate one: encapsulation handlers (the ones for FoU and GUE
introduced in the next patch, e.g.) will need to check the new error codes
returned by protocol handlers to figure out if errors match the given
encapsulation, and, in turn, report this error back, so that we can try
all of them in __udp{4,6}_lib_err_encap_no_sk() until we have a match.

v2:
- Name all arguments in err_handler prototypes (David Miller)

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip6_tunnel.h
include/net/ip_tunnels.h
net/ipv4/udp.c
net/ipv6/udp.c