mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Fix ebpf tcp ipv6
This commit is contained in:
parent
f622f6c995
commit
18f884b757
3 changed files with 14 additions and 13 deletions
Binary file not shown.
Binary file not shown.
|
@ -76,24 +76,25 @@ int socket_operations(struct bpf_sock_ops *skops) {
|
||||||
bpf_map_update_elem(&pm_bandwidth_map, &key, &newInfo, BPF_ANY);
|
bpf_map_update_elem(&pm_bandwidth_map, &key, &newInfo, BPF_ANY);
|
||||||
} else if(sk->family == AF_INET6){
|
} else if(sk->family == AF_INET6){
|
||||||
// Generate key for IPv6
|
// Generate key for IPv6
|
||||||
for(int i = 0; i < 4; i++) {
|
key.src_ip[0] = sk->src_ip6[0];
|
||||||
key.src_ip[i] = sk->src_ip6[i];
|
key.src_ip[1] = sk->src_ip6[1];
|
||||||
}
|
key.src_ip[2] = sk->src_ip6[2];
|
||||||
|
key.src_ip[3] = sk->src_ip6[3];
|
||||||
key.src_port = sk->src_port;
|
key.src_port = sk->src_port;
|
||||||
for(int i = 0; i < 4; i++) {
|
|
||||||
key.dst_ip[i] = sk->dst_ip6[i];
|
key.dst_ip[0] = sk->dst_ip6[0];
|
||||||
}
|
key.dst_ip[1] = sk->dst_ip6[1];
|
||||||
|
key.dst_ip[2] = sk->dst_ip6[2];
|
||||||
|
key.dst_ip[3] = sk->dst_ip6[3];
|
||||||
key.dst_port = __builtin_bswap16(sk->dst_port);
|
key.dst_port = __builtin_bswap16(sk->dst_port);
|
||||||
|
|
||||||
key.ipv6 = 1;
|
key.ipv6 = 1;
|
||||||
|
|
||||||
// FIXME: This should be added here too, but loading the ebpf module fails if we add it.
|
struct sk_info newInfo = {0};
|
||||||
// This 100% the same thing as above. No clue, man.
|
newInfo.rx = skops->bytes_received;
|
||||||
|
newInfo.tx = skops->bytes_acked;
|
||||||
|
|
||||||
// struct sk_info newInfo = {0};
|
bpf_map_update_elem(&pm_bandwidth_map, &key, &newInfo, BPF_ANY);
|
||||||
// newInfo.rx = skops->bytes_received;
|
|
||||||
// newInfo.tx = skops->bytes_acked;
|
|
||||||
|
|
||||||
// bpf_map_update_elem(&pm_bandwidth_map, &key, &newInfo, BPF_ANY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue