From 495528ae38107e93a76f563c1e3035038f149d2d Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Tue, 26 May 2026 17:13:12 +0000 Subject: [PATCH 1/4] Add documents with policies and some rationale for copyright and license in p4lang projects Signed-off-by: Andy Fingerhut --- ...yright-holder-and-license-for-new-files.md | 198 ++++++++++++++++++ .../licenses-apache-and-bsd.md | 60 ++++++ .../licenses-apache-and-gpl-v2.md | 122 +++++++++++ .../licenses-ptf-and-scapy.md | 74 +++++++ copyright-and-license-issues/licenses.md | 189 +++++++++++++++++ 5 files changed, 643 insertions(+) create mode 100644 copyright-and-license-issues/README-choosing-copyright-holder-and-license-for-new-files.md create mode 100644 copyright-and-license-issues/licenses-apache-and-bsd.md create mode 100644 copyright-and-license-issues/licenses-apache-and-gpl-v2.md create mode 100644 copyright-and-license-issues/licenses-ptf-and-scapy.md create mode 100644 copyright-and-license-issues/licenses.md diff --git a/copyright-and-license-issues/README-choosing-copyright-holder-and-license-for-new-files.md b/copyright-and-license-issues/README-choosing-copyright-holder-and-license-for-new-files.md new file mode 100644 index 0000000..e308faa --- /dev/null +++ b/copyright-and-license-issues/README-choosing-copyright-holder-and-license-for-new-files.md @@ -0,0 +1,198 @@ + + +# Introduction + +If you are adding a new file to a p4lang repository, you should add a +copyright notice and a license annotation in the new file. + +While there are software tools that can help automate the process of +adding such annotations to a file using a syntax that can be +automatically validated in p4lang project CI checks on Github (see the +["Using REUSE +..."](#using-reuse-to-automate-the-process-of-adding-copyright-and-license-annotations) +section below), those tools _cannot_ tell you who the copyright holder +should be, nor what license the file should have. You must use your +best judgement to determine those, using the guidelines described in +this document. + +If you still have questions not addressed by this document, please ask +in a Github issue in a relevant p4lang project where you wish to add +the file. You may also find this article useful: ++ https://reuse.software/faq + + +# Determining the copyright holder + +Did you use AI tools to write the file? If yes, you should find +documentation for that AI tool that describes what your choices are +regarding the legal entity that is the copyright holder of that file. + +Did someone else write the file's contents, and you copied all or most +of it, e.g. from some other project's code? In that case, hopefully +there are one or more copyright notices in the file already. You +_MUST NOT_ remove these copyright notices, because you are not the +copyright holder -- they are. Hopefully the file already contains a +license annotation as well, or the project that you copied the file +from has an overall license published for it. you _MUST NOT_ change +these license annotations, because you are not the copyright holder. +If that license is Apache-2.0, or one of a short list of other +licenses that are compatible in combining in the same executable with +Apache-2.0 licensed code (e.g. BSD-2-Clause, BSD-3-Clause, MIT, +FSFAP), then it is fine to add it to a p4lang repository. If it is +any copyleft license (e.g. GPL-2.0-only, GPL-3.0-only), then see the +[Copyleft +licenses](#exceptions-to-using-apache-2.0---copyleft-licenses) section +below. + +Did you write the file completely or mostly by your own efforts? +Then the two main possibilities are: + ++ You did this as part of working for some corporation, who paid you + to do this work. You should check with your manager, because they + might prefer that you use the name of the corporation as the + copyright holder. Many files in the p4lang repositories have + companies such as "Barefoot Networks, Inc.", "Cisco Systems, Inc.", + "VMware, Inc.", etc. as the copyright holder, because their authors + worked for that company at the time they wrote the contents of the + file, as part of their job. ++ You did this on your own time, using your own computing resources. + In this case you have the option to make yourself the copyright + holder. If you wish, you can choose to use "The P4 Language + Consortium" as the copyright holder, but this is not required. + +If you have a more complicated scenario, e.g. a file consists half of +code copied from a GPL-2.0-only licensed project, and half from a +BSD-2-Clause licensed project, then you should not add the file to any +p4lang repository in that form. Separate the code with different +licenses into different files, and then apply the guidelines in this +document to each of those separate files. If you still have +questions, ask in a Github issue on an appropriate p4lang project +before submitting the code. + + +# Determining the copyright year + +If there is no existing copyright notice, and you are adding a new +one, we recommend that you use a single year that is the year the file +was first developed. Yes, many projects and companies have other +policies, but there are good arguments (unfortunately at an article +linked from [this FAQ +page](https://reuse.software/faq/#years-copyright) that no longer +works) for using the year the file was first developed, and leaving it +that way without updating it later. Sure, if the file is rewritten +completely or substantially from scratch, updating the year makes +sense, but otherwise leaving the copyright year unchanged when +modifying the file is a legally defensible choice. + + +# Determining the license + +If you as an indidividual are the copyright holder, then you can +choose the license you wish to release the file under. You even have +the legal option to choose to release the file under different +licenses in different projects. + +If you are working for a corporation that wants to be the copyright +holder, then that corporation can choose the license. + +In either of the cases above, in most cases it is strongly preferred +to choose the Apache-2.0 license for files added to a p4lang project, +unless there are good reasons to use a different license (see examples +below). If the copyright holder agrees to the Apache-2.0 license, +please use that. + + +## Exceptions to using Apache-2.0 - Copyleft licenses + +If the file contains source code that links to, or imports, copylefted +libraries released under GPL-2.0-only (or GPL-3.0-only) with no +exceptions, then releasing it under any license _other_ than +GPL-2.0-only (or GPL-3.0-only) would fall under the category of +[questionable legal ground](licenses-apache-and-gpl-v2.md). If the +file is included in a p4lang repository, it should be released under +the same license as the copylefted code it is linked with (or some +license compatible with it). + +A few files in p4lang repositories are released with license +GPL-2.0-only, primarily for one of the following reasons: ++ It is a test program written in Python that imports the `scapy` + package, which is licensed GPL-2.0-only. These test programs are + never linked with executable binaries such as the `p4c` compiler or + BMv2 software switch. They are run standalone, often interacting + with those programs over sockets or other interprocess communication + mechanisms, and only for the purpose of testing those programs. ++ It is a source file intended to be executed within the Linux kernel, + e.g. C source code intended to be part of an EBPF program. + + +## Other exceptions to using Apache-2.0 - BSD, MIT, and FSFAP licenses + +Many libraries are released under BSD-2-Clause, BSD-3-Clause, MIT, or +FSFAP licenses. To the best of our knowledge, it is [legally +acceptable](licenses-apache-and-bsd.md) to link such code with +executable binaries that are released under the Apache-2.0 license. +Many libraries whose source code has been copied into p4lang +repositories have one of these license. They are often within a +directory called `third-party` or `third_party`. + + + +# Using REUSE to automate the process of adding copyright and license annotations + +In many Python installation scenarios, you can install the +[REUSE](https://pypi.org/project/reuse) Python package using this +command: +```sh +pip3 install reuse +``` +If you are using some Python installation where that does not work for +you, hopefully it is because you use some tailored Python installation +environment, and you already know what you should be using instead of +the command above. + +Once the REUSE package is installed, you can use it to add copyright +and licnese annotations to most source code files that following +common file name conventions using a command like the following: +```sh +reuse annotate -c "the copyright holder" -y 2026 -l Apache-2.0 +``` + +See the [SPDX license list](https://spdx.org/licenses/) web page for +the string to use other than `Apache-2.0` for other licenses. + +You may want to use the `--style` command line option in that command +if `reuse` does not correctly identify the comment syntax for the +file. For example, to force it to use Python style comments beginning +with `#`, use this: +```sh +reuse annotate --style python -c "the copyright holder" -y 2026 -l Apache-2.0 +``` + +Use this command to see other style names recognized by REUSE: +```sh +reuse annotate --help +``` + +If the file is a binary file (e.g. PNG, JPG, etc.) or a text data file +format that does not have a comment syntax (e.g. JSON data files), add +a `--fallback-dot-license` command line option to the command above, +as shown in the example below: +```sh +reuse annotate --fallback-dot-license -c "the copyright holder" -y 2026 -l Apache-2.0 +``` +This will create a new file whose name is the same as the original +file name, with a suffix of `.license` appended at the end. That file +will contain the copyright and license annotation. This is a +convention used by the REUSE project. + +If you are annotating source files for a third party library copied +into a p4lang repository, you may also wish to use +`--force-dot-license` instead of `--fallback-dot-license`, so that a +`.license` file is created even though the file has a comment syntax. +For example, this can make it easier when doing `diff` between the +copied code and the original source it came from, and when updating +the copy in the p4lang repository to a newer version. diff --git a/copyright-and-license-issues/licenses-apache-and-bsd.md b/copyright-and-license-issues/licenses-apache-and-bsd.md new file mode 100644 index 0000000..c7c0db2 --- /dev/null +++ b/copyright-and-license-issues/licenses-apache-and-bsd.md @@ -0,0 +1,60 @@ + + +# Compatibility of BSD and Apache 2.0 licenses + +Reference for what the SPDX-License-Identifer possible string values +are, including Apache-2.0 and BSD-3-Clause: + ++ https://spdx.org/licenses + +| Python program A | ... imports Python | | +| with license | package B with license | Allowed? | +| ----------------- | ----------------------- | -------- | +| Apache-2.0 | Apache-2.0 | yes, same licenses | +| BSD-3-Clause | BSD-3-Clause | yes, same licenses | +| Apache-2.0 | BSD-3-Clause | yes, if released as Apache-2.0 | +| BSD-3-Clause | Apache-2.0 | yes, if released as Apache-2.0 | + + +# Open Source Automation Development Lab (OSADL) + +The OSADL [1] publishes a license compatibility matrix [2]. The +details in this section are for the version of this matrix downloaded +on 2025-Jan-23. + +The matrix entry for the leading license being BSD-3-Clause and the +subordinate license being Apache-2.0 says: +``` + { "name": "Apache-2.0", "compatibility": "Yes", "explanation": "Non-copyleft licenses such as the Apache-2.0 license and the BSD-3-Clause license are generally considered mutually compatible."}, +``` + +The matrix entry for the leading license being Apache-2.0 and the +subordinate license being BSD-3-Clause says: +``` + { "name": "BSD-3-Clause", "compatibility": "Yes", "explanation": "Non-copyleft licenses such as the BSD-3-Clause license and the Apache-2.0 license are generally considered mutually compatible."}, +``` + + +# David Wheeler's FLOSS License Slide + +See [3]. + +The opinion of the author is that software released under BSD-3-Clause +and Apache-2.0 licenses can be combined into a single work. The +combined work can be released under the Apache-2.0 license. + + +# References + +[1] https://osadl.org + +[2] "OASDL license compatibility matrix with explanations", + https://www.osadl.org/html/CompatMatrix.html + +[3] David A. Wheeler, "The Free-Libre / Open Source Software (FLOSS) + License Slide", Jan 26, 2017 (was Sep 27, 2007), + https://dwheeler.com/essays/floss-license-slide.html diff --git a/copyright-and-license-issues/licenses-apache-and-gpl-v2.md b/copyright-and-license-issues/licenses-apache-and-gpl-v2.md new file mode 100644 index 0000000..6204352 --- /dev/null +++ b/copyright-and-license-issues/licenses-apache-and-gpl-v2.md @@ -0,0 +1,122 @@ + + +# Compatibility of GPL v2.0 and Apache 2.0 licenses + +Please suggest additional references, whether they argue for +compatibility or incompatbility of these two software licenses. They +need not _settle_ the question authoritatively. The point of this +article as of 2025 is that the question of their compatibilty seems +not to be settled yet. + +Reference for what the SPDX-License-Identifer possible string values +are, including Apache-2.0 and GPL-2.0-only: + ++ https://spdx.org/licenses + +| Python program A | ... imports Python | | +| with license | package B with license | Allowed? | +| ----------------- | ----------------------- | -------- | +| Apache-2.0 | Apache-2.0 | yes, same licenses | +| GPL-2.0-only | GPL-2.0-only | yes, same licenses | +| Apache-2.0 | GPL-2.0-only | legally questionable | +| GPL-2.0-only | Apache-2.0 | legally questionable | + +There is no publicly available advice we have found so far on the last +two rows of the table above that makes the answer obviously +"compatible", or obviously "incompatible", hence the "legally +questionable" statement on whether it is allowed. See later sections +for examples arguing both ways. + +Given that lack of clarity on whether it is allowed, it seems prudent +that the P4 Consortium should not risk its limited funds and available +volunteer time by using legally questionable combinations of software +licenses. We have a way to avoid that risk: use combinations of +licenses that are well known to be compatible. + +If someone proposes using other approaches, it seems wise that they +should provide advice backed by an organization with at least one +intellectual property lawyer, and willing to defend the approach in +court. + + +# Article published in a law journal + +See [5]. + +Here is the text of the abstract of this 29-page article: + + License “incompatibility” in free and open source software + licensing means that, when two differently licensed pieces of software + are combined, one cannot comply with both licenses at the same time. + It is commonly accepted that the GNU General Public License version + 2 is incompatible with the Apache License, version 2 because certain + provisions of the Apache License would be considered “further + restrictions” not permitted by the GPLv2. However, this article will + explain why there is no legally cognizable claim for combining the two, + either under a copyright infringement theory or a breach of contract + theory. + +The P4 Consortium has no legal advice to say whether the arguments +presented in that article would hold up in a court case. + + +# Open Source Automation Development Lab (OSADL) + +The OSADL [1] publishes a license compatibility matrix [2]. The +details in this section are for the version of this matrix downloaded +on 2025-Jan-23. + +The matrix entry for the leading license being GPL-2.0-only and the +subordinate license being Apache-2.0 says: +``` + { "name": "Apache-2.0", "compatibility": "No", "explanation": "Incompatibility of the Apache-2.0 license with the GPL-2.0-only license is explicitly stated in the GPL-2.0-only license checklist."}, +``` + +The matrix entry for the leading license being Apache-2.0 and the +subordinate license being GPL-2.0-only says: +``` + { "name": "GPL-2.0-only", "compatibility": "No", "explanation": "Software under a copyleft license such as the GPL-2.0-only license normally cannot be redistributed under a non-copyleft license such as the Apache-2.0 license, except if it were explicitly permitted in the licenses."}, +``` + + +# Free Software Foundation (FSF) + +"By the same token, lax licenses are usually compatible with any +copyleft license. In the combined program, the parts that came in +under lax licenses still carry them, and the combined program as a +whole carries the copyleft license. One lax license, Apache 2.0, has +patent clauses which are incompatible with GPL version 2; since I +think those patent clauses are good, I made GPL version 3 compatible +with them." [4] + +The above was written by Richard Stallman, who often speaks for the +FSF, but I do not know whether the FSF specifically endorses the legal +interpretations in the quoted paragraph above. It is published on the +gnu.org site quite prominently, though. + + +# Randomly found StackExchange discussion + +See [3]. I don't claim anything in there as authoritative, but it +might have useful links that lead to more authoritiatve information. + + +# References + +[1] https://osadl.org + +[2] "OASDL license compatibility matrix with explanations", + https://www.osadl.org/html/CompatMatrix.html + +[3] https://opensource.stackexchange.com/questions/1357/can-i-link-a-apache-2-0-library-into-software-under-gplv2 + +[4] https://www.gnu.org/licenses/license-compatibility.html + +[5] Pamela S. Chestek, "A promise without a remedy: The supposed + incompatibility of the GPL v2 and Apache v2 licenses", Santa Clara + High Technology Law Journal, Vol 40, Issue 3, Article 2, + https://digitalcommons.law.scu.edu/cgi/viewcontent.cgi?article=1701&context=chtlj#:~:text=It%20is%20commonly%20accepted%20that,not%20permitted%20by%20the%20GPLv2. diff --git a/copyright-and-license-issues/licenses-ptf-and-scapy.md b/copyright-and-license-issues/licenses-ptf-and-scapy.md new file mode 100644 index 0000000..24a1b71 --- /dev/null +++ b/copyright-and-license-issues/licenses-ptf-and-scapy.md @@ -0,0 +1,74 @@ + + +# Considerations for ptf and scapy Python packages + +The Python library Scapy is released under the GNU General Public +License v2.0 [1]. + +[1] https://github.com/secdev/scapy/blob/master/LICENSE + + +The ptf package is released under the Apache 2.0 license: + +[2] https://github.com/p4lang/ptf/blob/main/LICENSE + + + +# Compatibility of GPL v2.0 and Apache 2.0 licenses + +See [this article](licenses-apache-and-gpl-v2.md). + + +# Consequences + +Assuming everything above is correct, consider a Python program that +imports both the scapy and ptf packages _directly_, i.e. it imports +ptf directly, and it also imports scapy directly. + +Should P4.org publish such a program, and if so, under what license +should it be released? + +It seems that the answer is "no", because the argument for whether +this is allowed is too unclear. + +Should P4.org publish such a program under Apache-2.0? It seems +that the answer is "no", because the program imports scapy, which is +GPL-2.0-only. It is too unclear whether this is allowed. + +Should P4.org publish such a program under GPL-2.0-only? It seems +that the answer is "no", because the program imports ptf, which is +Apache-2.0. Again, it is too unclear whether this is allowed. + +There are at least a few Python programs in p4lang repositories that +currently import both the scapy and ptf packages, including these: + ++ https://github.com/p4lang/p4factory/blob/master/testutils/xnt.py ++ https://github.com/p4lang/p4c/blob/master/backends/ebpf/tests/ptf/test.py ++ https://github.com/p4lang/p4c/blob/master/backends/ebpf/tests/ptf/l2l3_acl.py ++ https://github.com/p4lang/switch/blob/master/testutils/xnt.py ++ https://github.com/p4lang/switch/blob/master/tests/ptf-tests/common/utils.py ++ https://github.com/p4lang/p4-dpdk-target/blob/main/third-party/ptf_grpc/ptf-tests/switchd/wcm/switchdverifywcmtraffic.py ++ https://github.com/p4lang/p4-dpdk-target/blob/main/third-party/ptf_grpc/ptf-tests/switchd/lpm/switchdverifytraffic.py ++ https://github.com/p4lang/ptf/blob/master/src/ptf/packet_scapy.py ++ https://github.com/p4lang/ptf/blob/master/utests/tests/ptf/test_mask.py + + +# What could we do about this? + +One possibility _might_ be to change the license of ptf so that it is +multi-licensed [1], i.e. it can be used either as the Apache-2.0 +license, or GPL v2, at the choice of the user. + +Then in the cases where someone writes a program A that imports both +scapy and ptf in in A, they can choose to use ptf under the GPL v2 +license, and also release program A under the GPL v2 license. + +In cases where they write a program A that imports ptf, but not scapy, +then they have a choice whether to publish program A under the GPL v2 +license, or the Apache-2.0 license. + +[1] https://en.wikipedia.org/wiki/Multi-licensing diff --git a/copyright-and-license-issues/licenses.md b/copyright-and-license-issues/licenses.md new file mode 100644 index 0000000..71dafca --- /dev/null +++ b/copyright-and-license-issues/licenses.md @@ -0,0 +1,189 @@ + + +# Introduction + +The P4 compiler `p4c` is a leading project of the P4 Consortium, and +used by several companies as the front end of P4 compilers for a +variety of hardware targets. Most of these companies develop +significant proprietary back end code, combine it with some of the +code published in https://github.com/p4lang/p4c, and the resulting +binary executables are released. These companies have no obligation +due to copyleft licenses to release their compiler back end source +code. + +This is allowed, because p4c source files published in the +https://github.com/p4lang/p4c repository are licensed under the Apache +2.0 license. This license was chosen for multiple reasons, but in +part to enable companies to do this. It is the P4 Consortium's intent +to continue enabling this. + + +# Linux Foundation review of P4.org software licenses in published code + +In early 2024 P4.org became part of The Linux Foundation. In November +2024 the Linux Foundation designated a licensing specialist to do a +quick review of software licenses in the public repositories in the +https://github.com/p4lang organization. + +They recommended a fairly light-weight mechanism to make the software +license of all source files explicit and easy to track with automated +tools: adding an SPDX-License-Identifier comment line [1]. + +[1] https://spdx.org/licenses/ + +These look like the following examples, where the syntax of everything +_except_ the comment indicator is required by SPDX, i.e. there is a +precise specified syntax for ethe "SPDX-License-Identifier:" +characters to be present, and exactly what sequence of characters may +follow it on the line. + +```c++ +// SPDX-License-Identifier: Apache-2.0 +``` + +```python +# SPDX-License-Identifier: GPL-2.0-only +``` + + +# Why is the top level LICENSE file insufficient? + +One short answer is that for a few files in the p4c repository, and +some other p4lang repositories, releasing them under an Apache 2.0 +license puts P4.org on [questionable legal +ground](licenses-apache-and-gpl-v2.md). Source files that are an +exception to the Apache 2.0 license are described below. We expect +them to be a fairly small set of files, and that these exceptions are +_not_ among the source files that are compiled to create a P4 compiler +executable binary. + +Given that, a per-file software license tracking mechanism becomes +useful. It is also useful when individual files or subsets of files +are copied into other open source software projects. + + +# Most source files will be released with Apache 2.0 license + +The Apache 2.0 license is the default choice for all source files in +https://github.com/p4lang projects, unless this would put P4.org on +[questionable legal grounds](licenses-apache-and-gpl-v2.md). + + +# Source files that should not be released under the Apache 2.0 license + +See [this article](licenses-apache-and-gpl-v2.md) for background on +questions of compatibility of the Apache 2.0 and GPL v2 licenses. + + +## Python source files that import the Scapy package + +Note: All of the source files in this section are _only_ for running +tests, and are _not_ part of a compiled `p4c` executable. + +The Python library Scapy is released under the GNU General Public +License v2.0 [2]. + +[2] https://github.com/secdev/scapy/blob/master/LICENSE + +Note: Scapy is released under the GPL, _not_ the Lesser GPL (aka +LGPL). + +While the LGPL explicitly allows releasing proprietary binaries that +dynamically link with LGPL libraries, the GPL has no such provisions. + +Unless someone can provide a legal ruling from an intellectual +property lawyer to the contrary, we prefer to avoid [questionable +legal ground](licenses-apache-and-gpl-v2.md) by releasing all Python +source files meeting the following conditions under the GPL v2.0 +license: + +(a) files that directly import the `scapy` package +(b) files that indirectly import the Scapy package, by importing a + package that imports Scapy + +We believe that this should not be a significant hindrance to those +who wish to distribute proprietary P4 compiler executables, because +all such Python source files are test programs, run either during CI +for testing p4c executables, or during testing by those making +modifications to p4c code. These Python source files that use Scapy +are not part of P4 compiler executables. + +If a company wishes to distribute Python programs that import the +Scapy package, they will have to decide how to comply with Scapy's +license themselves. P4.org can inform them of the reasons we made the +licensing choices related to Scapy that we did, and continue to avoid +using Scapy or any other copylefted libraries in P4 compiler +executables. Similarly for any other programs besides the P4 compiler +that we expect companies will want to add proprietary extensions to. + + +## C files intended to be compiled and executed in the Linux kernel, e.g. EBPF + +Note: When analyzing the source files described in this section more +carefully, we will take special care to ensure that they are not files +used to build a P4 compiler executable, and update this note when that +task is complete with our findings. + +One or more published p4c back ends produce C source files that are +intended to be compiled and loaded into the kernel via the EBPF +feature, at least [3], [4] and perhaps others. + +[3] https://github.com/p4lang/p4c/blob/main/backends/ebpf/README.md +[4] https://github.com/p4lang/p4c/blob/main/backends/tc/README.md + +While there are a few examples of companies releasing binaries of +Linux driver code for their hardware and not releasing the source +code, we leave it to their legal teams to navigate any of the +intricacies that may be involved in that endeavor. + +[5] is a good introduction to software licensing questions related to +using EBPF. + +[5] https://ebpf.io/blog/ebpf-licensing-guide/ + +While it is _possible_ to write restricted EBPF programs that are +loaded into the Linux kernel that can be distributed under a non-GPL +license, these are the exception, not the rule. + +Do companies using EBPF distribute these programs under GPL 2.0? Yes, +they commonly do. The EBPF code loaded and run in the Linux kernel is +the "data plane" part of the system. The "control plane" part of the +system runs in user space applications on Linux, and these can be +distributed under other licenses, including proprietary licenses. 98% +or more of the code of these systems is in the control plane code. +The data plane code by itself is unlikely to cause any significant +loss of competitive advantage to publicize it. + +Thus our plan is to release all of the following kinds of source files +under the GPL v2.0 license, the same as the Linux kernel: + +(a) files that are intended to be compiled and loaded into the kernel + via EBPF. +(b) header files included from files in category (a). + +Note that this list of files appear to consist of _only_ 2 source +files in the entire p4c repository. Most of the source files related +to EBPF are part of a p4c back end that uses EBPF, which can be +Apache-2.0 licensed, or they are control plane source files used for +testing the EBPF programs loaded into the kernel. + +If any subtle questions arise as to whether a particular P4 compiler +back end, e.g. `p4c-ebpf`, must thus be released under GPL v2.0, we +will raise these questions to the P4 Technical Steering Team for their +advice. + +We expect that for P4 compiler back ends that do not produce source +code for use with EBPF, this question will never arise. + + +# Third party libraries used by p4c + +There are many libraries used by `p4c` executable binaries, and for +some, several alternate libraries that can be used in their place. + +TODO: We should summarize those, and their licenses, here, as advice +to those who wish to produce proprietary `p4c` executable binaries. From e41a4c5f38a5b638ee2643c26858d33aaa0ad054 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Wed, 3 Jun 2026 16:25:25 +0000 Subject: [PATCH 2/4] Add copyright and license annotations for all files Signed-off-by: Andy Fingerhut --- .github/workflows/bump-version.yml | 4 + .github/workflows/dco-welcome-reusable.yml | 4 + .github/workflows/dco-welcome.yml | 4 + .github/workflows/publish-release.yml | 4 + CONTRIBUTING.md | 6 + LICENSE | 202 +-------------------- LICENSES/Apache-2.0.txt | 73 ++++++++ README.md | 6 + SECURITY.md | 6 + profile/README.md | 6 + 10 files changed, 114 insertions(+), 201 deletions(-) mode change 100644 => 120000 LICENSE create mode 100644 LICENSES/Apache-2.0.txt diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 840e532..178b468 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2026 The P4 Language Consortium +# +# SPDX-License-Identifier: Apache-2.0 + # Reusable workflow for bumping the version number in a new PR. name: Bump version number diff --git a/.github/workflows/dco-welcome-reusable.yml b/.github/workflows/dco-welcome-reusable.yml index 5b77915..d250a45 100644 --- a/.github/workflows/dco-welcome-reusable.yml +++ b/.github/workflows/dco-welcome-reusable.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2026 The P4 Language Consortium +# +# SPDX-License-Identifier: Apache-2.0 + name: DCO Assistant for First-Time Contributors on: diff --git a/.github/workflows/dco-welcome.yml b/.github/workflows/dco-welcome.yml index fb75a8e..3fc986c 100644 --- a/.github/workflows/dco-welcome.yml +++ b/.github/workflows/dco-welcome.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2026 The P4 Language Consortium +# +# SPDX-License-Identifier: Apache-2.0 + name: DCO Assistant for First-Time Contributors on: diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 6e8f274..a889762 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2026 The P4 Language Consortium +# +# SPDX-License-Identifier: Apache-2.0 + # Reusable workflow for publish a release. Usually triggered by changes to the # VERSION file. name: Publish Release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba8b9da..b0f0efb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,9 @@ + + # Contribute to the P4 Language Organization Thank you for considering contributing to the P4 Language Organization! Your contributions are valuable and help improve the project for everyone. Before getting started, please take a moment to review the following guidelines. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/LICENSE b/LICENSE new file mode 120000 index 0000000..5431dc1 --- /dev/null +++ b/LICENSE @@ -0,0 +1 @@ +LICENSES/Apache-2.0.txt \ No newline at end of file diff --git a/LICENSES/Apache-2.0.txt b/LICENSES/Apache-2.0.txt new file mode 100644 index 0000000..137069b --- /dev/null +++ b/LICENSES/Apache-2.0.txt @@ -0,0 +1,73 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + + You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/README.md b/README.md index 23a977f..aee770e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,8 @@ + + # .github Organization-wide policy and governance documents. diff --git a/SECURITY.md b/SECURITY.md index 56c00a7..fbb1a27 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,3 +1,9 @@ + + # Security Policy ## Reporting a Vulnerability diff --git a/profile/README.md b/profile/README.md index bbb85fa..5dd1d7a 100644 --- a/profile/README.md +++ b/profile/README.md @@ -1,3 +1,9 @@ + + # P4 Language Consortium Welcome to the official GitHub organization for the P4 Language Consortium. This organization hosts the open-source ecosystem for P4, a domain-specific language used to specify how data plane devices process packets. From 80a9f8ca0115f3bba91462f43d8fbe1652debbc9 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Wed, 3 Jun 2026 16:51:53 +0000 Subject: [PATCH 3/4] Add comments so that REUSE ignores documentation text that looks like SPDX license annotations, but are intended only as documentation examples for people to read of what those annotations look like. Signed-off-by: Andy Fingerhut --- copyright-and-license-issues/licenses.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/copyright-and-license-issues/licenses.md b/copyright-and-license-issues/licenses.md index 71dafca..ff8e969 100644 --- a/copyright-and-license-issues/licenses.md +++ b/copyright-and-license-issues/licenses.md @@ -35,6 +35,9 @@ tools: adding an SPDX-License-Identifier comment line [1]. [1] https://spdx.org/licenses/ + These look like the following examples, where the syntax of everything _except_ the comment indicator is required by SPDX, i.e. there is a precise specified syntax for ethe "SPDX-License-Identifier:" @@ -48,6 +51,9 @@ follow it on the line. ```python # SPDX-License-Identifier: GPL-2.0-only ``` + # Why is the top level LICENSE file insufficient? From b09ad11105024e0028b4ba22b0cf28689515beb4 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Wed, 3 Jun 2026 17:03:39 +0000 Subject: [PATCH 4/4] Add a few more comments on choosing copyright holder and license Signed-off-by: Andy Fingerhut --- ...copyright-holder-and-license-for-new-files.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/copyright-and-license-issues/README-choosing-copyright-holder-and-license-for-new-files.md b/copyright-and-license-issues/README-choosing-copyright-holder-and-license-for-new-files.md index e308faa..01dcb50 100644 --- a/copyright-and-license-issues/README-choosing-copyright-holder-and-license-for-new-files.md +++ b/copyright-and-license-issues/README-choosing-copyright-holder-and-license-for-new-files.md @@ -31,6 +31,16 @@ Did you use AI tools to write the file? If yes, you should find documentation for that AI tool that describes what your choices are regarding the legal entity that is the copyright holder of that file. +Important aside: This might not be as easy as it sounds. It is an +active area of legal consideration who the copyright holder of such +AI-generated files are. In some countries (e.g. the USA), if no +person contributes significantly to the content of a file, it _cannot_ +have a copyright holder at all, should likely be considered part of +the public domain, and thus cannot have a license associated with it +(because there is _no_ copyright holder who can assert their copyright +rights to choose what restrictions or permissions hold for what others +can do with it). + Did someone else write the file's contents, and you copied all or most of it, e.g. from some other project's code? In that case, hopefully there are one or more copyright notices in the file already. You @@ -73,6 +83,12 @@ document to each of those separate files. If you still have questions, ask in a Github issue on an appropriate p4lang project before submitting the code. +Note: Except for the suggestion of using "The P4 Language Consortium" +as the copyright holder for files you write on your own personal time, +all of the above in this section applies to _every_ software you work +on and project that you add files to, not only to files added to +projects in the p4lang Github organization. + # Determining the copyright year