| // SPDX-License-Identifier: GPL-2.0 |
| // Copyright (c) 2020 Cloudflare |
| #include <bpf/bpf_helpers.h> |
| __uint(type, BPF_MAP_TYPE_SOCKMAP); |
| __uint(type, BPF_MAP_TYPE_SOCKMAP); |
| } dst_sock_map SEC(".maps"); |
| __uint(type, BPF_MAP_TYPE_SOCKHASH); |
| } dst_sock_hash SEC(".maps"); |
| int copy_sock_map(void *ctx) |
| sk = bpf_map_lookup_elem(&src, &key); |
| if (bpf_map_update_elem(&dst_sock_map, &key, sk, 0)) |
| if (bpf_map_update_elem(&dst_sock_hash, &key, sk, 0)) |
| return failed ? SK_DROP : SK_PASS; |
| char _license[] SEC("license") = "GPL"; |