Loading...
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright (c) 2023, SUSE. */
3
4#include "vmlinux.h"
5#include <bpf/bpf_tracing.h>
6#include "bpf_tracing_net.h"
7
8char _license[] SEC("license") = "GPL";
9int pid;
10
11SEC("fmod_ret/update_socket_protocol")
12int BPF_PROG(mptcpify, int family, int type, int protocol)
13{
14 if (bpf_get_current_pid_tgid() >> 32 != pid)
15 return protocol;
16
17 if ((family == AF_INET || family == AF_INET6) &&
18 type == SOCK_STREAM &&
19 (!protocol || protocol == IPPROTO_TCP)) {
20 return IPPROTO_MPTCP;
21 }
22
23 return protocol;
24}
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright (c) 2023, SUSE. */
3
4#include "vmlinux.h"
5#include <bpf/bpf_tracing.h>
6#include "bpf_tracing_net.h"
7
8char _license[] SEC("license") = "GPL";
9
10SEC("fmod_ret/update_socket_protocol")
11int BPF_PROG(mptcpify, int family, int type, int protocol)
12{
13 if ((family == AF_INET || family == AF_INET6) &&
14 type == SOCK_STREAM &&
15 (!protocol || protocol == IPPROTO_TCP)) {
16 return IPPROTO_MPTCP;
17 }
18
19 return protocol;
20}