esp: Consolidate esp4 and esp6
This patch merges common code of esp4.c and esp6.c into
xfrm_esp.c. This almost halves the size of the ESP
implementation for the price of three indirect calls
on UDP/TCP encapsulation. No functional changes.
Changes from the RFC version:
- Fix a typo in the commit message.
- Remove some old comments that don't make sense anymore.
- Let the ->input_encap functions return the needed offsets.
- Remove the IP_MAX_MTU check from UDP/TCP encap.
The IPv4/IPv6 local_out function will do that ceck later.
- The comment on IPv4 ESP offload with UDP encapsulation
is true for IPv4 and IPv6, so remove the IPv4 from the
comment.
Changes since v1:
- Remove some now unused code.
- Whitespace fixes.
- Cleanup the header length calculation in the input path for
UDP/TCP encapsulation.
- Move the skb_pull_rcsum() call to the generic esp_input_done2()
function.
- Move the skb_postpull_rcsum() call to the offloading codepath,
it is needed only there.
Changes since v2:
- Use CONFIG_XFRM_ESPINTCP instead of CONFIG_INET_ESPINTCP
to compile the common code for ESP4 and ESP6.
- Re-add the length check when building UDP/TCP encap
packets.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Tested-by: Tobias Brunner <tobias@strongswan.org>
8 files changed