diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2016-06-28 13:18:27 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-06-30 12:54:40 +0300 |
commit | 6578171a7ff0c31dc73258f93da7407510abf085 (patch) | |
tree | 9bd1cbf0fa5de109e750dd482472beaa188951a5 /net/unix/diag.c | |
parent | 80b48c445797a634d869c7e5a53e182ba2688931 (diff) | |
download | linux-6578171a7ff0c31dc73258f93da7407510abf085.tar.xz |
bpf: add bpf_skb_change_proto helper
This patch adds a minimal helper for doing the groundwork of changing
the skb->protocol in a controlled way. Currently supported is v4 to
v6 and vice versa transitions, which allows f.e. for a minimal, static
nat64 implementation where applications in containers that still
require IPv4 can be transparently operated in an IPv6-only environment.
For example, host facing veth of the container can transparently do
the transitions in a programmatic way with the help of clsact qdisc
and cls_bpf.
Idea is to separate concerns for keeping complexity of the helper
lower, which means that the programs utilize bpf_skb_change_proto(),
bpf_skb_store_bytes() and bpf_lX_csum_replace() to get the job done,
instead of doing everything in a single helper (and thus partially
duplicating helper functionality). Also, bpf_skb_change_proto()
shouldn't need to deal with raw packet data as this is done by other
helpers.
bpf_skb_proto_6_to_4() and bpf_skb_proto_4_to_6() unclone the skb to
operate on a private one, push or pop additionally required header
space and migrate the gso/gro meta data from the shared info. We do
mark the gso type as dodgy so that headers are checked and segs
recalculated by the gso/gro engine. The gso_size target is adapted
as well. The flags argument added is currently reserved and can be
used for future extensions.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/unix/diag.c')
0 files changed, 0 insertions, 0 deletions