Commit Graph

11 Commits

Author SHA1 Message Date
Toke Høiland-Jørgensen
a5313d2f1b nat64: Handle ICMP rewriting
Add rewriting of ICMP headers to nat64. This is specified in RFC6145, and
the implementation here follows that. The support is only partial, in
particular, in that the payload of ICMP error messages is not rewritten,
even though the RFC specifies that they should be.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-10-05 00:19:28 +02:00
Toke Høiland-Jørgensen
ced3d8c4bc nat64: Set Don't Fragment bit in IPv4 packets
IPv6 doesn't support fragmentation, so make sure IPv4 packets are not
fragmented in-flight either.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-10-04 17:51:32 +02:00
Toke Høiland-Jørgensen
4648814d26 nat64: Also translate DSCP and ECN fields
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-10-01 00:26:01 +02:00
Toke Høiland-Jørgensen
fc76452e1f nat64: Drop invalid v4 destinations
These include 0.0.0.0, loopback and multicast addresses.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-10-01 00:25:44 +02:00
Toke Høiland-Jørgensen
7ec0aabbb0 nat64: Drop fragmented v4 packets as well as those with options
In the other direction we also drop packets with options, which covers
fragmented packets.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-10-01 00:24:35 +02:00
Toke Høiland-Jørgensen
0c2dd5e5cf nat64: Add some debug output
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-09-30 23:40:16 +02:00
Toke Høiland-Jørgensen
3b200d0153 nat64: reinstate atomic operations
Turns out the atomics just needed to operate on a 64-bit variable, we
didn't actually need a newer compiler.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-09-30 23:11:15 +02:00
Toke Høiland-Jørgensen
b6a3775b6a nat64: Fix header rewrites
Endianness fixes for IP header length, need to also rewrite Ethernet
protocol. Also use direct packet access instead of skb_store_bytes().

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-09-30 22:35:59 +02:00
Toke Høiland-Jørgensen
666219515f nat64: Add license declaration to BPF file
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-09-30 22:35:59 +02:00
Toke Høiland-Jørgensen
cff5001225 nat64: Fix LPM lookup from kernel side
Needs the same struct for lookup as the userspace side does, so share the
struct definition.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-09-30 22:35:59 +02:00
Toke Høiland-Jørgensen
ede4270320 nat64-bpf: Initial version
This adds an initial version of a NAT64 translator in BPF. It compiles and
loads, but doesn't actually appear to work yet.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-09-29 01:46:09 +02:00