From 3074848b3ee1037ea20d122aae471127e286e24e Mon Sep 17 00:00:00 2001 From: Rhys Rustad-Elliott Date: Mon, 4 Apr 2022 18:00:03 +0000 Subject: [PATCH 1/4] Change eBPF code license to GPLv2/BSD As per request from @pchang7092. --- GPL/EventProbe/BPFEventsTests.cpp | 16 +++------------ GPL/EventProbe/CMakeLists.txt | 16 +++------------ GPL/EventProbe/EbpfEventProto.h | 9 ++++----- GPL/EventProbe/EventProbe.bpf.c | 18 ++++------------- GPL/EventProbe/File/Probe.bpf.c | 16 +++------------ GPL/EventProbe/Helpers.h | 16 +++------------ GPL/EventProbe/Network/Network.h | 16 +++------------ GPL/EventProbe/Network/Probe.bpf.c | 16 +++------------ GPL/EventProbe/PathResolver.h | 16 +++------------ GPL/EventProbe/Process/Probe.bpf.c | 16 +++------------ GPL/EventProbe/State.h | 16 +++------------ .../KprobeConnectHook/CMakeLists.txt | 17 +++------------- .../KprobeConnectHook/Kerneldefs.h | 16 +++------------ .../KprobeConnectHook/KprobeConnectHook.bpf.c | 17 ++++------------ .../TcFilter/BPFTcFilterTests.cpp | 16 +++------------ GPL/HostIsolation/TcFilter/CMakeLists.txt | 19 ++++-------------- GPL/HostIsolation/TcFilter/Kerneldefs.h | 17 ++++------------ GPL/HostIsolation/TcFilter/TcFilter.bpf.c | 16 +++------------ GPL/HostIsolation/TcFilter/TcFilterdefs.h | 16 +++------------ LICENSE.txt | 20 +++++++++++++------ 20 files changed, 76 insertions(+), 249 deletions(-) diff --git a/GPL/EventProbe/BPFEventsTests.cpp b/GPL/EventProbe/BPFEventsTests.cpp index f54657d7..b5f5cfd2 100644 --- a/GPL/EventProbe/BPFEventsTests.cpp +++ b/GPL/EventProbe/BPFEventsTests.cpp @@ -1,20 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ #include diff --git a/GPL/EventProbe/CMakeLists.txt b/GPL/EventProbe/CMakeLists.txt index 40e2b971..8c6a592c 100644 --- a/GPL/EventProbe/CMakeLists.txt +++ b/GPL/EventProbe/CMakeLists.txt @@ -1,19 +1,9 @@ -# SPDX-License-Identifier: GPL-2.0-only +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause # Copyright (C) 2021 Elasticsearch BV # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses, you +# may choose either one of them if you use this software. # BPF program diff --git a/GPL/EventProbe/EbpfEventProto.h b/GPL/EventProbe/EbpfEventProto.h index bbda048b..5965bedc 100644 --- a/GPL/EventProbe/EbpfEventProto.h +++ b/GPL/EventProbe/EbpfEventProto.h @@ -1,11 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only OR Elastic-2.0 +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* - * Copyright 2021 Elasticsearch BV + * Copyright (C) 2021 Elasticsearch BV * - * This file is dual-licensed under the GNU General Public License version 2 - * and the Elastic License 2.0. You may choose either one of them if you use - * this file. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ #ifndef EBPF_EVENTPROBE_EBPFEVENTPROTO_H diff --git a/GPL/EventProbe/EventProbe.bpf.c b/GPL/EventProbe/EventProbe.bpf.c index b911ce24..7be7c65c 100644 --- a/GPL/EventProbe/EventProbe.bpf.c +++ b/GPL/EventProbe/EventProbe.bpf.c @@ -1,27 +1,17 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ #include "vmlinux.h" #include -char LICENSE[] SEC("license") = "GPL"; +char LICENSE[] SEC("license") = "Dual BSD/GPL"; // todo(fntlnz): another buffer will probably need // to be used instead of this one as the common parts evolve diff --git a/GPL/EventProbe/File/Probe.bpf.c b/GPL/EventProbe/File/Probe.bpf.c index 198d2387..2439d7b4 100644 --- a/GPL/EventProbe/File/Probe.bpf.c +++ b/GPL/EventProbe/File/Probe.bpf.c @@ -1,20 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ #include "vmlinux.h" diff --git a/GPL/EventProbe/Helpers.h b/GPL/EventProbe/Helpers.h index 2879c9ef..115f1a39 100644 --- a/GPL/EventProbe/Helpers.h +++ b/GPL/EventProbe/Helpers.h @@ -1,20 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ #ifndef EBPF_EVENTPROBE_HELPERS_H diff --git a/GPL/EventProbe/Network/Network.h b/GPL/EventProbe/Network/Network.h index ff92d5ba..bcb69f28 100644 --- a/GPL/EventProbe/Network/Network.h +++ b/GPL/EventProbe/Network/Network.h @@ -1,20 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ #ifndef EBPF_EVENTPROBE_NETWORK_H diff --git a/GPL/EventProbe/Network/Probe.bpf.c b/GPL/EventProbe/Network/Probe.bpf.c index b3c3840c..2917cc28 100644 --- a/GPL/EventProbe/Network/Probe.bpf.c +++ b/GPL/EventProbe/Network/Probe.bpf.c @@ -1,20 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ #include "vmlinux.h" diff --git a/GPL/EventProbe/PathResolver.h b/GPL/EventProbe/PathResolver.h index 1c9e8f93..7e13d120 100644 --- a/GPL/EventProbe/PathResolver.h +++ b/GPL/EventProbe/PathResolver.h @@ -1,20 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ /* diff --git a/GPL/EventProbe/Process/Probe.bpf.c b/GPL/EventProbe/Process/Probe.bpf.c index cb9181bc..522dee7b 100644 --- a/GPL/EventProbe/Process/Probe.bpf.c +++ b/GPL/EventProbe/Process/Probe.bpf.c @@ -1,20 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ #include "vmlinux.h" diff --git a/GPL/EventProbe/State.h b/GPL/EventProbe/State.h index 5e638912..aa208b57 100644 --- a/GPL/EventProbe/State.h +++ b/GPL/EventProbe/State.h @@ -1,20 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ #ifndef EBPF_EVENTPROBE_EVENTS_STATE_H diff --git a/GPL/HostIsolation/KprobeConnectHook/CMakeLists.txt b/GPL/HostIsolation/KprobeConnectHook/CMakeLists.txt index 63e50d93..57997839 100644 --- a/GPL/HostIsolation/KprobeConnectHook/CMakeLists.txt +++ b/GPL/HostIsolation/KprobeConnectHook/CMakeLists.txt @@ -1,20 +1,9 @@ -# SPDX-License-Identifier: GPL-2.0-only +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause # Copyright (C) 2021 Elasticsearch BV # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - +# This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses, you +# may choose either one of them if you use this software. # BPF program set(KPROBECONNECTHOOK_CFLAGS diff --git a/GPL/HostIsolation/KprobeConnectHook/Kerneldefs.h b/GPL/HostIsolation/KprobeConnectHook/Kerneldefs.h index bba7c283..91d439d7 100644 --- a/GPL/HostIsolation/KprobeConnectHook/Kerneldefs.h +++ b/GPL/HostIsolation/KprobeConnectHook/Kerneldefs.h @@ -1,20 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ typedef signed char __s8; diff --git a/GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c b/GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c index 47714bef..648be95d 100644 --- a/GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c +++ b/GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c @@ -1,22 +1,13 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ + // Host Isolation - this eBPF program hooks into tcp_v4_connect kprobe and adds // entries to the IP allowlist if an allowed process tries to initiate a // connection. diff --git a/GPL/HostIsolation/TcFilter/BPFTcFilterTests.cpp b/GPL/HostIsolation/TcFilter/BPFTcFilterTests.cpp index f7d4ea1b..242f7458 100644 --- a/GPL/HostIsolation/TcFilter/BPFTcFilterTests.cpp +++ b/GPL/HostIsolation/TcFilter/BPFTcFilterTests.cpp @@ -1,20 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ #include "Kerneldefs.h" diff --git a/GPL/HostIsolation/TcFilter/CMakeLists.txt b/GPL/HostIsolation/TcFilter/CMakeLists.txt index 5ad7c3fb..418da98b 100644 --- a/GPL/HostIsolation/TcFilter/CMakeLists.txt +++ b/GPL/HostIsolation/TcFilter/CMakeLists.txt @@ -1,20 +1,9 @@ -# SPDX-License-Identifier: GPL-2.0-only +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause # Copyright (C) 2021 Elasticsearch BV # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - +# This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses, you +# may choose either one of them if you use this software. # BPF program set(TCFILTER_CFLAGS @@ -44,7 +33,7 @@ add_custom_target(BPFTcFilter ALL DEPENDS ${TCFILTER_BPF_OUTPUT}) # BPF_PROG_TEST_RUN gtests add_executable(BPFTcFilterTests BPFTcFilterTests.cpp ${GTEST_MAIN}) set_target_properties(BPFTcFilterTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TARGET_TEST_DIR}) -target_include_directories(BPFTcFilterTests PRIVATE +target_include_directories(BPFTcFilterTests PRIVATE "${LIBBPF_TARGET_INCLUDE_DIR}" "${LIBBPF_UAPI_INCLUDE_DIR}" "${LIBBPF_INCLUDE_DIR}" diff --git a/GPL/HostIsolation/TcFilter/Kerneldefs.h b/GPL/HostIsolation/TcFilter/Kerneldefs.h index bc8da137..90e3bad0 100644 --- a/GPL/HostIsolation/TcFilter/Kerneldefs.h +++ b/GPL/HostIsolation/TcFilter/Kerneldefs.h @@ -1,22 +1,13 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ + typedef signed char __s8; typedef unsigned char __u8; diff --git a/GPL/HostIsolation/TcFilter/TcFilter.bpf.c b/GPL/HostIsolation/TcFilter/TcFilter.bpf.c index b6257177..37760fd0 100644 --- a/GPL/HostIsolation/TcFilter/TcFilter.bpf.c +++ b/GPL/HostIsolation/TcFilter/TcFilter.bpf.c @@ -1,20 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ #include "Kerneldefs.h" diff --git a/GPL/HostIsolation/TcFilter/TcFilterdefs.h b/GPL/HostIsolation/TcFilter/TcFilterdefs.h index 2433f389..45b71af6 100644 --- a/GPL/HostIsolation/TcFilter/TcFilterdefs.h +++ b/GPL/HostIsolation/TcFilter/TcFilterdefs.h @@ -1,20 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause /* * Copyright (C) 2021 Elasticsearch BV * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This software is dual-licensed under the BSD 2-Clause and GPL v2 licenses. + * You may choose either one of them if you use this software. */ #ifndef TC_FILTERDEFS_H diff --git a/LICENSE.txt b/LICENSE.txt index 75df7e92..09ad0b5e 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,8 +1,16 @@ -The https://github.com/elastic/ebpf repository contains source code under various licenses: +The https://github.com/elastic/ebpf repository contains source code under +various licenses: -- Source code in the 'GPL' directory, other than the code in GPL/Events/EbpfEventProto.h, is licensed under the GNU General Public License version 2 (licenses/GPL-LICENSE.txt). -- Source code in GPL/Events/EbpfEventProto.h is dual-licensed under the GNU General Public License version 2 (licenses/GPL-LICENSE.txt) and Elastic License 2.0 (licenses/ELASTIC-LICENSE-2.0.txt) -- Source code in the 'non-GPL' and 'testing' directories is licensed under the Elastic License 2.0 (licenses/ELASTIC-LICENSE-2.0.txt). -- Source code in the 'contrib' directory is third-party code licensed under the BSD 2-Clause license (licenses/BSD-2-CLAUSE-LICENSE.txt). +- Source code in the 'GPL' directory, is dual-licensed under the GNU General + Public License version 2 (licenses/GPL-LICENSE.txt) and BSD 2-Clause license + (licenses/BSD-2-CLAUSE-LICENSE.txt) -The binary files `KprobeConnectHook.bpf.o` and `TcFilter.bpf.o` are compiled from exclusively GPLv2-licensed code, and are distributed along with the GPLv2 License (GPL-LICENSE.txt). +- Source code in the 'non-GPL' and 'testing' directories is licensed under the + Elastic License 2.0 (licenses/ELASTIC-LICENSE-2.0.txt). + +- Source code in the 'contrib' directory is third-party code licensed under the + BSD 2-Clause license (licenses/BSD-2-CLAUSE-LICENSE.txt). + +The binary files `KprobeConnectHook.bpf.o` and `TcFilter.bpf.o` are compiled +from exclusively dual-licensed GPLv2/BSD 2-Clause licensed code, and are +distributed along with the GPLv2 License (licenses/GPL-LICENSE.txt). From fea2e9a69bc3e682d403866d8585de09b6c37121 Mon Sep 17 00:00:00 2001 From: Rhys Rustad-Elliott Date: Tue, 5 Apr 2022 21:17:43 +0000 Subject: [PATCH 2/4] Update license section for HostIsolation --- GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c | 2 +- GPL/HostIsolation/TcFilter/TcFilter.bpf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c b/GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c index 648be95d..929dd49a 100644 --- a/GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c +++ b/GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c @@ -82,4 +82,4 @@ int BPF_KPROBE(tcp_v4_connect, void *sk, struct sockaddr *uaddr) return enter_tcp_connect(uaddr); } -char LICENSE[] SEC("license") = "GPL"; +char LICENSE[] SEC("license") = "Dual BSD/GPL"; diff --git a/GPL/HostIsolation/TcFilter/TcFilter.bpf.c b/GPL/HostIsolation/TcFilter/TcFilter.bpf.c index 37760fd0..07c1c3fa 100644 --- a/GPL/HostIsolation/TcFilter/TcFilter.bpf.c +++ b/GPL/HostIsolation/TcFilter/TcFilter.bpf.c @@ -209,4 +209,4 @@ int classifier(struct __sk_buff *skb) return rv; } -char __license[] __section("license") = "GPL"; +char __license[] __section("license") = "Dual BSD/GPL"; From 9e90759b6b35e38f82e39b4e8ae0cb92f6222d16 Mon Sep 17 00:00:00 2001 From: Rhys Rustad-Elliott Date: Thu, 7 Apr 2022 20:51:19 +0000 Subject: [PATCH 3/4] Run code formatter --- GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c | 1 - GPL/HostIsolation/TcFilter/Kerneldefs.h | 1 - 2 files changed, 2 deletions(-) diff --git a/GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c b/GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c index 929dd49a..dbc1025e 100644 --- a/GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c +++ b/GPL/HostIsolation/KprobeConnectHook/KprobeConnectHook.bpf.c @@ -7,7 +7,6 @@ * You may choose either one of them if you use this software. */ - // Host Isolation - this eBPF program hooks into tcp_v4_connect kprobe and adds // entries to the IP allowlist if an allowed process tries to initiate a // connection. diff --git a/GPL/HostIsolation/TcFilter/Kerneldefs.h b/GPL/HostIsolation/TcFilter/Kerneldefs.h index 90e3bad0..65e12764 100644 --- a/GPL/HostIsolation/TcFilter/Kerneldefs.h +++ b/GPL/HostIsolation/TcFilter/Kerneldefs.h @@ -7,7 +7,6 @@ * You may choose either one of them if you use this software. */ - typedef signed char __s8; typedef unsigned char __u8; From a6eb701ee22a47a0ecbf5675b420c379f18d1e74 Mon Sep 17 00:00:00 2001 From: Rhys Rustad-Elliott Date: Mon, 9 May 2022 17:16:08 +0000 Subject: [PATCH 4/4] Run code formatter --- GPL/EventProbe/BPFEventsTests.cpp | 24 +- .../TcFilter/BPFTcFilterTests.cpp | 245 +++++++----------- non-GPL/LibEbpfEvents/LibEbpfEvents.c | 4 +- 3 files changed, 102 insertions(+), 171 deletions(-) diff --git a/GPL/EventProbe/BPFEventsTests.cpp b/GPL/EventProbe/BPFEventsTests.cpp index b5f5cfd2..409a9b38 100644 --- a/GPL/EventProbe/BPFEventsTests.cpp +++ b/GPL/EventProbe/BPFEventsTests.cpp @@ -7,43 +7,39 @@ * You may choose either one of them if you use this software. */ -#include #include +#include -#include #include +#include #include "EventProbe.skel.h" class BPFFileEventsTests : public ::testing::Test { -protected: + protected: struct EventProbe_bpf *m_skel; - virtual void - SetUp() override + virtual void SetUp() override { m_skel = EventProbe_bpf__open_and_load(); - if (!m_skel) - { + if (!m_skel) { FAIL() << "Failed to open and load BPF program"; } } - virtual void - TearDown() override + virtual void TearDown() override { EventProbe_bpf__destroy(m_skel); } - static void - SetUpTestSuite() + static void SetUpTestSuite() { struct rlimit rinf; rinf = {RLIM_INFINITY, RLIM_INFINITY}; - if (setrlimit(RLIMIT_MEMLOCK, &rinf) == -EPERM) - { - FAIL() << "setrlimit failed, running the BPFFileEventsTests suite requires root permissions"; + if (setrlimit(RLIMIT_MEMLOCK, &rinf) == -EPERM) { + FAIL() << "setrlimit failed, running the BPFFileEventsTests suite requires root " + "permissions"; } } }; diff --git a/GPL/HostIsolation/TcFilter/BPFTcFilterTests.cpp b/GPL/HostIsolation/TcFilter/BPFTcFilterTests.cpp index 242f7458..129cac7e 100644 --- a/GPL/HostIsolation/TcFilter/BPFTcFilterTests.cpp +++ b/GPL/HostIsolation/TcFilter/BPFTcFilterTests.cpp @@ -26,22 +26,19 @@ #define MAGIC_BYTES 123 #define __packed __attribute__((__packed__)) -struct packet_v4 -{ +struct packet_v4 { struct ethhdr eth; struct iphdr iph; struct tcphdr tcp; } __packed; -struct packet_v4_udp -{ +struct packet_v4_udp { struct ethhdr eth; struct iphdr iph; struct udphdr udp; } __packed; -struct packet_v6 -{ +struct packet_v6 { struct ethhdr eth; struct ipv6hdr iph; struct tcphdr tcp; @@ -49,22 +46,20 @@ struct packet_v6 class BPFTcFilterTests : public ::testing::Test { -protected: + protected: struct bpf_object *m_obj = nullptr; int m_prog_fd = -1; - virtual void - SetUp() override + virtual void SetUp() override { struct bpf_object_load_attr load_attr = {}; struct bpf_program *prog = nullptr; char *object_path_env = getenv(OBJECT_PATH_ENV_VAR); int err = 0; - m_obj = object_path_env == NULL ? bpf_object__open(DEFAULT_OBJECT_PATH) : - bpf_object__open(object_path_env); + m_obj = object_path_env == NULL ? bpf_object__open(DEFAULT_OBJECT_PATH) + : bpf_object__open(object_path_env); - if (libbpf_get_error(m_obj)) - { + if (libbpf_get_error(m_obj)) { FAIL() << "Cannot open ELF object to test, you can pass a custom one with the " << OBJECT_PATH_ENV_VAR << " environment variable"; } @@ -72,12 +67,11 @@ class BPFTcFilterTests : public ::testing::Test prog = bpf_object__find_program_by_name(m_obj, CLASSIFIER_SECTION_NAME); ASSERT_FALSE(prog == NULL); - + bpf_program__set_type(prog, BPF_PROG_TYPE_SCHED_CLS); err = bpf_object__load_xattr(&load_attr); - if (err) - { + if (err) { FAIL() << "Could not load the bpf program, please check your permissions"; return; } @@ -85,13 +79,11 @@ class BPFTcFilterTests : public ::testing::Test m_prog_fd = bpf_program__fd(prog); } - virtual void - TearDown() override + virtual void TearDown() override { - int err = 0; + int err = 0; struct bpf_map *allowed_ips_map = bpf_object__find_map_by_name(m_obj, "allowed_IPs"); - if(!allowed_ips_map) - { + if (!allowed_ips_map) { FAIL() << "Could not find the allowed_IPs map"; return; } @@ -101,9 +93,9 @@ class BPFTcFilterTests : public ::testing::Test return; } - struct bpf_map *allowed_subnets_map = bpf_object__find_map_by_name(m_obj, "allowed_subnets"); - if (!allowed_subnets_map) - { + struct bpf_map *allowed_subnets_map = + bpf_object__find_map_by_name(m_obj, "allowed_subnets"); + if (!allowed_subnets_map) { FAIL() << "Could not find the allowed_subnets map"; return; } @@ -117,14 +109,13 @@ class BPFTcFilterTests : public ::testing::Test m_prog_fd = -1; } - static void - SetUpTestSuite() + static void SetUpTestSuite() { struct rlimit rinf; rinf = {RLIM_INFINITY, RLIM_INFINITY}; - if (setrlimit(RLIMIT_MEMLOCK, &rinf) == -EPERM) - { - FAIL() << "setrlimit failed, running the BPFTcFilterTests suite requires root permissions"; + if (setrlimit(RLIMIT_MEMLOCK, &rinf) == -EPERM) { + FAIL() + << "setrlimit failed, running the BPFTcFilterTests suite requires root permissions"; } } }; @@ -132,22 +123,18 @@ class BPFTcFilterTests : public ::testing::Test TEST_F(BPFTcFilterTests, TestAllowArpPacket) { struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_ARP); - struct iphdr iph - { + struct iphdr iph { }; - struct tcphdr tcp - { + struct tcphdr tcp { }; - struct packet_v4 pkt_v4 - { + struct packet_v4 pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; @@ -171,22 +158,18 @@ TEST_F(BPFTcFilterTests, TestAllowArpPacket) TEST_F(BPFTcFilterTests, TestDropUnsupportedPackets) { struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_LOOP); - struct iphdr iph - { + struct iphdr iph { }; - struct tcphdr tcp - { + struct tcphdr tcp { }; - struct packet_v4 pkt_v4 - { + struct packet_v4 pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; @@ -210,23 +193,19 @@ TEST_F(BPFTcFilterTests, TestDropUnsupportedPackets) TEST_F(BPFTcFilterTests, TestDropIPV6Packets) { struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_IP); - struct ipv6hdr iph - { + struct ipv6hdr iph { }; iph.version = 6; - struct tcphdr tcp - { + struct tcphdr tcp { }; - struct packet_v6 pkt_v6 - { + struct packet_v6 pkt_v6 { }; pkt_v6.eth = eth; pkt_v6.iph = iph; @@ -250,24 +229,20 @@ TEST_F(BPFTcFilterTests, TestDropIPV6Packets) TEST_F(BPFTcFilterTests, TestDropInvalidHeaderLength) { struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_IP); - struct iphdr iph - { + struct iphdr iph { }; iph.version = 4; iph.ihl = 10; - struct tcphdr tcp - { + struct tcphdr tcp { }; - struct packet_v4 pkt_v4 - { + struct packet_v4 pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; @@ -285,25 +260,21 @@ TEST_F(BPFTcFilterTests, TestDropInvalidHeaderLength) TEST_F(BPFTcFilterTests, TestDropFragmentedPacket) { struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_IP); - struct iphdr iph - { + struct iphdr iph { }; iph.version = 4; iph.ihl = 5; iph.frag_off |= PCKT_FRAGMENTED; - struct tcphdr tcp - { + struct tcphdr tcp { }; - struct packet_v4 pkt_v4 - { + struct packet_v4 pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; @@ -321,26 +292,22 @@ TEST_F(BPFTcFilterTests, TestDropFragmentedPacket) TEST_F(BPFTcFilterTests, TestAllowUDPPacketDNSPortSource) { struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_IP); - struct iphdr iph - { + struct iphdr iph { }; iph.version = 4; iph.ihl = 5; iph.protocol = IPPROTO_UDP; - struct udphdr udp - { + struct udphdr udp { }; udp.source = __bpf_htons(53); - struct packet_v4_udp pkt_v4 - { + struct packet_v4_udp pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; @@ -358,26 +325,22 @@ TEST_F(BPFTcFilterTests, TestAllowUDPPacketDNSPortSource) TEST_F(BPFTcFilterTests, TestAllowUDPPacketDNSPortDest) { struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_IP); - struct iphdr iph - { + struct iphdr iph { }; iph.version = 4; iph.ihl = 5; iph.protocol = IPPROTO_UDP; - struct udphdr udp - { + struct udphdr udp { }; udp.dest = __bpf_htons(53); - struct packet_v4_udp pkt_v4 - { + struct packet_v4_udp pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; @@ -395,27 +358,23 @@ TEST_F(BPFTcFilterTests, TestAllowUDPPacketDNSPortDest) TEST_F(BPFTcFilterTests, TestAllowUDPPacketDHCPClient) { struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_IP); - struct iphdr iph - { + struct iphdr iph { }; iph.version = 4; iph.ihl = 5; iph.protocol = IPPROTO_UDP; - struct udphdr udp - { + struct udphdr udp { }; udp.source = __bpf_htons(DHCP_SERVER_PORT); udp.dest = __bpf_htons(DHCP_CLIENT_PORT); - struct packet_v4_udp pkt_v4 - { + struct packet_v4_udp pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; @@ -433,27 +392,23 @@ TEST_F(BPFTcFilterTests, TestAllowUDPPacketDHCPClient) TEST_F(BPFTcFilterTests, TestAllowUDPPacketDHCPServer) { struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_IP); - struct iphdr iph - { + struct iphdr iph { }; iph.version = 4; iph.ihl = 5; iph.protocol = IPPROTO_UDP; - struct udphdr udp - { + struct udphdr udp { }; udp.source = __bpf_htons(DHCP_CLIENT_PORT); udp.dest = __bpf_htons(DHCP_SERVER_PORT); - struct packet_v4_udp pkt_v4 - { + struct packet_v4_udp pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; @@ -471,25 +426,21 @@ TEST_F(BPFTcFilterTests, TestAllowUDPPacketDHCPServer) TEST_F(BPFTcFilterTests, TestDropUnknownUDPPackets) { struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_IP); - struct iphdr iph - { + struct iphdr iph { }; iph.version = 4; iph.ihl = 5; iph.protocol = IPPROTO_UDP; - struct udphdr udp - { + struct udphdr udp { }; - struct packet_v4_udp pkt_v4 - { + struct packet_v4_udp pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; @@ -507,25 +458,21 @@ TEST_F(BPFTcFilterTests, TestDropUnknownUDPPackets) TEST_F(BPFTcFilterTests, TestDropUnknownTCPDestination) { struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_IP); - struct iphdr iph - { + struct iphdr iph { }; iph.version = 4; iph.ihl = 5; iph.protocol = IPPROTO_TCP; - struct tcphdr tcp - { + struct tcphdr tcp { }; - struct packet_v4 pkt_v4 - { + struct packet_v4 pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; @@ -544,14 +491,12 @@ TEST_F(BPFTcFilterTests, TestAllowTCPAddressInAllowedIPs) { int allowed_ips_map_fd; struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_IP); - struct iphdr iph - { + struct iphdr iph { }; iph.version = 4; iph.ihl = 5; @@ -564,12 +509,10 @@ TEST_F(BPFTcFilterTests, TestAllowTCPAddressInAllowedIPs) int ret = bpf_map_update_elem(allowed_ips_map_fd, &iph.daddr, &val, BPF_ANY); ASSERT_EQ(ret, 0); - struct tcphdr tcp - { + struct tcphdr tcp { }; - struct packet_v4 pkt_v4 - { + struct packet_v4 pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; @@ -587,25 +530,21 @@ TEST_F(BPFTcFilterTests, TestAllowTCPAddressInAllowedIPs) TEST_F(BPFTcFilterTests, TestDropUnknownICMPDestination) { struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_IP); - struct iphdr iph - { + struct iphdr iph { }; iph.version = 4; iph.ihl = 5; iph.protocol = IPPROTO_ICMP; - struct tcphdr tcp - { + struct tcphdr tcp { }; - struct packet_v4 pkt_v4 - { + struct packet_v4 pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; @@ -624,14 +563,12 @@ TEST_F(BPFTcFilterTests, TestAllowICMPAddressInAllowedIPs) { int allowed_ips_map_fd; struct bpf_test_run_opts opts = {}; - opts.sz = sizeof(opts); - struct ethhdr eth - { + opts.sz = sizeof(opts); + struct ethhdr eth { }; eth.h_proto = __bpf_htons(ETH_P_IP); - struct iphdr iph - { + struct iphdr iph { }; iph.version = 4; iph.ihl = 5; @@ -644,12 +581,10 @@ TEST_F(BPFTcFilterTests, TestAllowICMPAddressInAllowedIPs) int ret = bpf_map_update_elem(allowed_ips_map_fd, &iph.daddr, &val, BPF_ANY); ASSERT_EQ(ret, 0); - struct tcphdr tcp - { + struct tcphdr tcp { }; - struct packet_v4 pkt_v4 - { + struct packet_v4 pkt_v4 { }; pkt_v4.eth = eth; pkt_v4.iph = iph; diff --git a/non-GPL/LibEbpfEvents/LibEbpfEvents.c b/non-GPL/LibEbpfEvents/LibEbpfEvents.c index 932ac36b..6998ce43 100644 --- a/non-GPL/LibEbpfEvents/LibEbpfEvents.c +++ b/non-GPL/LibEbpfEvents/LibEbpfEvents.c @@ -37,11 +37,11 @@ static int ring_buf_cb(void *ctx, void *data, size_t size) if (cb_ctx == NULL) { return 0; } - ebpf_event_handler_fn cb = cb_ctx->cb; + ebpf_event_handler_fn cb = cb_ctx->cb; if (cb == NULL) { return 0; } - struct ebpf_event_header *evt = data; + struct ebpf_event_header *evt = data; if (evt == NULL) { return 0; }