Commit Graph

6 Commits

Author SHA1 Message Date
Jesper Dangaard Brouer
88b05144a2 nat64-bpf: rename bpf_map__resize() to bpf_map__set_max_entries()
Libbpf API change:
 
 Discourage bpf_map__resize(), which is an alias to more clearly
 named bpf_map__set_max_entries()

See: https://github.com/libbpf/libbpf/issues/304

And API migration guide:
 https://github.com/libbpf/libbpf/wiki/Libbpf:-the-road-to-v1.0#libbpfh-high-level-apis

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2022-09-02 14:34:11 +02:00
Toke Høiland-Jørgensen
24cea38474 nat64-bpf: Use logging helpers and add verbose option
Use the newly-added logging helpers from logging.h and add a -v option to
increase the effective log level.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2022-04-20 13:25:27 +02:00
Toke Høiland-Jørgensen
742924a076 nat64: Insert route and neighbour entry on setup/teardown
We insert a v4-via-v6 route on the interface to direct packets to the v4
subnet to the right interface, where it will be rewritten by the BPF
program. We also create a fake neighbour entry so the kernel won't do
neighbour resolution when sending the pre-rewrite packet. The egress BPF
program will use bpf_redirect_neigh() to do proper neighbour resolution for
the actual destination after rewriting the packet.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-10-04 17:13:00 +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
c6ee3bf574 Fix default NAT64 address
Typoed the RFC prefix.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2021-09-30 16:59:32 +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