Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 24 lines 558 B view raw
1// SPDX-License-Identifier: GPL-2.0 2/* Copyright (c) 2024 Google LLC */ 3 4#include "vmlinux.h" 5 6#include <string.h> 7#include <bpf/bpf_helpers.h> 8#include <bpf/bpf_endian.h> 9#include <bpf/bpf_core_read.h> 10#include "bpf_kfuncs.h" 11 12#define REWRITE_ADDRESS_IP4 0xc0a801fe // 192.168.1.254 13#define REWRITE_ADDRESS_PORT4 4040 14 15SEC("cgroup/getpeername4") 16int getpeername_v4_prog(struct bpf_sock_addr *ctx) 17{ 18 ctx->user_ip4 = bpf_htonl(REWRITE_ADDRESS_IP4); 19 ctx->user_port = bpf_htons(REWRITE_ADDRESS_PORT4); 20 21 return 1; 22} 23 24char _license[] SEC("license") = "GPL";