l4re-base-25.08.0

This commit is contained in:
2025-09-12 15:55:45 +02:00
commit d959eaab98
37938 changed files with 9382688 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
requires: libstdc++ stdlibs l4virtio-server
maintainer: matthias.lange@kernkonzept.com alexander.warg@kernkonzept.com

View File

@@ -0,0 +1,22 @@
## This file states the license of this package and possibly its subpackages
## in machine and human readable format. The PackageName refers to the package
## whose license is defined by PackageLicenseConcluded.
## For more information about this file format visit the SPDX website at
## https://spdx.org
SPDXVersion: SPDX-2.3
DataLicense: CC0-1.0
SPDXID: SPDXRef-DOCUMENT
DocumentNamespace: spdx:kernkonzept/virtio-net-382c26ea-61e3-11e9-9b84-2784e724081d
DocumentName: virtio-net
Creator: Organization: Kernkonzept GmbH (info@kernkonzept.com)
Created: 2023-08-04T00:00:00Z
## Package Information
PackageName: virtio-net
PackageOriginator: Organization: Kernkonzept GmbH (info@kernkonzept.com)
PackageLicenseDeclared: GPL-2.0-only
PackageLicenseConcluded: GPL-2.0-only
FilesAnalyzed: false
PackageCopyrightText: NOASSERTION
PackageDownloadLocation: NOASSERTION

View File

@@ -0,0 +1,4 @@
PKGDIR ?= .
L4DIR ?= $(PKGDIR)/../..
include $(L4DIR)/mk/subdir.mk

View File

@@ -0,0 +1,21 @@
# Virtio-net
This package provides a virtual peer-to-peer link between two Virtio network
devices. For example, two virtualised operating systems running in separate
uvmm instances can be connected with each other.
# Documentation
This package is part of the L4Re operating system. For documentation and
build instructions see the
[L4Re wiki](https://kernkonzept.com/L4Re/guides/l4re).
# Contributions
We welcome contributions. Please see our contributors guide on
[how to contribute](https://kernkonzept.com/L4Re/contributing/l4re).
# License
Detailed licensing and copyright information can be found in
the [LICENSE](LICENSE.spdx) file.

View File

@@ -0,0 +1,29 @@
# Security Policy
This document outlines security procedures for the open-source projects of the
L4Re Operating System Framework as found on https://github.com/kernkonzept.
# Reporting a vulnerability
Security is very important to us and we take all security vulnerabilities
seriously. Thank you for improving the security of our open source software. If
you have discovered a security issue, we appreciate your efforts and your
responsible disclosure.
Please report a security vulnerability by sending an encrypted email to our
security team using our [public
key](https://www.kernkonzept.com/dl/security-at-kernkonzept.pub)
to **security@kernkonzept.com**. The fingerprint of our public key is
````
C4DC 2909 A22E D080 C012 5373 4055 CBA2 A4FD 855B
````
Please include the following in your report:
* A description of the vulnerability
* Steps to reproduce the vulnerability
A member of Kernkonzept's security team will confirm the vulnerability,
determine its impact, and develop a fix. The fix will be applied to the master
branch, tested, and released.

View File

@@ -0,0 +1,2 @@
INPUT += %PKGDIR%/doc/virtio-net-p2p.dox
INPUT += %PKGDIR%/doc/usage.md

View File

@@ -0,0 +1,87 @@
# l4vio_net_p2p, a virtual network point-to-point link {#l4re_servers_virtio_net_p2p}
The virtual network point-to-point server (p2p) connects two clients with a
virtual network connection. It uses virtio as the transport mechanism. Each
virtual network p2p endpoint implements the device-side of a virtio network
device. Each client can access its endpoint using the driver-side semantics
of a virtio network device.
## Building and Configuration
The virtual network p2p server can be built using the L4Re build system by
placing this project into the `pkg` directory.
## Starting the service
The virtual network p2p server can be started with Lua like this:
local p2p = L4.default_loader:new_channel();
L4.default_loader:start(
{
caps = {
svr = p2p:svr(),
},
},
"rom/l4vio_net_p2p [<options>]");
First an IPC gate (`p2p`) is created which is used between the virtual
network p2p server and a client to create new virtual ports. The server-side
is assigned to the mandatory `svr` capability of the virtual network p2p
server. See the section below on how to create a new virtual port and
connect a client to it.
### Options
The following command line options are supported:
* `-p <num_usec>`, `--poll <num_usec>`
Enable polling mode and set the poll interval. IRQ notification is disabled
for queues while in polling mode. Must be a positive integer specified in
microseconds.
* `-s <num>`, `--size <num>`
Set the maximum queue size for the device-side virtio queues.
Must be a power of 2 in the range of 1 to 32768 inclusive.
## Connecting a client
Prior to connecting a client to a virtual network p2p server port it has to
be created using the following Lua function. It has to be called on the
client side of the IPC gate capability whose server side is bound to the
virtual network p2p server.
The "key=value" pairs passed to create() can be omitted and their order is
not important.
create(obj_type, ["ds-max=<max>" , "mac=<mac_address>"])
* `obj_type`
The type of object that should be created by the server. The type must be
a positive integer. Currently the following objects are supported:
* `0`: Virtual p2p port
* `"ds-max=<max>"`
Specifies the upper limit of the number of dataspaces the client is
allowed to register with the server for virtio DMA. Must be in the range of
1 to 80 inclusive. The default value is 2.
* `"mac=<mac_address>"`
Specify the MAC address of the endpoint where `<mac_address>` is of
the form X:XX:Xx:x:xx:xX.
If the `create()` call is successful a new capability which references a
virtual network p2p server port is returned. A client uses this capability
to talk to the virtual network p2p server using the virtio network protocol.
A couple of examples on how to create ports with different properties are
listed below.
-- two normal ports with at most 4 data spaces
net0 = p2p:create(0, "ds-max=4")
net1 = p2p:create(0, "ds-max=4")
-- normal port with 4 data spaces and MAC address
net0 = p2p:create(0, "ds-max=4", "mac=11:22:33:44:55:66")

View File

@@ -0,0 +1,6 @@
// vi:ft=c
/**
* \page l4re_servers L4Re Servers
*
* - \subpage l4re_servers_virtio_net_p2p
*/

View File

@@ -0,0 +1,6 @@
PKGDIR ?= ..
L4DIR ?= $(PKGDIR)/../..
TARGET = p2p-link
include $(L4DIR)/mk/subdir.mk

View File

@@ -0,0 +1,67 @@
/*
* Copyright (C) 2018, 2024 Kernkonzept GmbH.
* Author(s): Andreas Wiese <andreas.wiese@kernkonzept.com>
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include <l4/sys/l4int.h>
/**
* A network checksum.
*
* This class calculates a 1's complement checksum over the data
* incrementally provided to it.
*/
class Net_checksum
{
private:
l4_uint32_t _sum;
public:
/**
* Initialise a network checksum with start value 0.
*/
Net_checksum() : _sum(0) {}
/**
* Reset the checksum to its initial start value.
*/
void reset()
{ _sum = 0; }
/**
* Add a given data buffer to the checksum.
*
* \param buf A data buffer to be added to the checksum.
* \param len The size of the data buffer.
*
* This adds the given data buffer to the current checksum.
*/
void add(l4_uint8_t const *buf, size_t len)
{
for (; len > 1; len -= 2, buf += 2)
_sum += ((l4_uint16_t)buf[0] << 8) | buf[1];
if (len > 0)
_sum += *buf << 8;
}
/**
* Finalize the checksum value.
*
* \retval The final checksum value.
*
* This adds the carry of the current checksum value to the checksum
* and returns the final (negated) checksum value.
*/
l4_uint16_t finalize()
{
while (_sum >> 16)
_sum = (_sum & 0xffffU) + (_sum >> 16);
return ~_sum & 0xffffU;
}
};

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2012-2017, 2024 Kernkonzept GmbH.
* Author(s): Alexander Warg <alexander.warg@kernkonzept.com>
* Adam Lackorzynski <adam.lackorzynski@kernkonzept.com>
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include <l4/re/util/debug>
struct Err : L4Re::Util::Err
{
Err(Level l = Fatal) : L4Re::Util::Err(l, "net") {}
};
struct Dbg : L4Re::Util::Dbg
{
enum
{
Info = 1,
Warn = 2,
Hsi = 0x10000,
Switch = 0x20000,
};
Dbg(unsigned long l = Info, char const *subsys = "")
: L4Re::Util::Dbg(l, "net", subsys) {}
};

View File

@@ -0,0 +1,9 @@
PKGDIR ?= ../..
L4DIR ?= $(PKGDIR)/../..
TARGET = l4vio_net_p2p
REQUIRES_LIBS = libstdc++ l4virtio
PRIVATE_INCDIR += $(PKGDIR)/server/include
SRC_CC = net.cc
include $(L4DIR)/mk/prog.mk

File diff suppressed because it is too large Load Diff