diff options
Diffstat (limited to 'samples/sockmap/sockmap_kern.c')
-rw-r--r-- | samples/sockmap/sockmap_kern.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/samples/sockmap/sockmap_kern.c b/samples/sockmap/sockmap_kern.c index 735226794ce1..8b6c34cd5f46 100644 --- a/samples/sockmap/sockmap_kern.c +++ b/samples/sockmap/sockmap_kern.c @@ -236,4 +236,19 @@ int bpf_prog9(struct sk_msg_md *msg) return SK_PASS; } +SEC("sk_msg7") +int bpf_prog10(struct sk_msg_md *msg) +{ + int *bytes, zero = 0; + + bytes = bpf_map_lookup_elem(&sock_apply_bytes, &zero); + if (bytes) + bpf_msg_apply_bytes(msg, *bytes); + bytes = bpf_map_lookup_elem(&sock_cork_bytes, &zero); + if (bytes) + bpf_msg_cork_bytes(msg, *bytes); + return SK_DROP; +} + + char _license[] SEC("license") = "GPL"; |