From patchwork Tue Oct 3 07:49:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Langowski X-Patchwork-Id: 31599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EF14E75434 for ; Tue, 3 Oct 2023 07:49:46 +0000 (UTC) Received: from 8.mo583.mail-out.ovh.net (8.mo583.mail-out.ovh.net [178.32.116.78]) by mx.groups.io with SMTP id smtpd.web11.103188.1696319382627082252 for ; Tue, 03 Oct 2023 00:49:43 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=softfail (domain: 3mdeb.com, ip: 178.32.116.78, mailfrom: pawel.langowski@3mdeb.com) Received: from director5.ghost.mail-out.ovh.net (unknown [10.109.138.52]) by mo583.mail-out.ovh.net (Postfix) with ESMTP id 7A1CE211A2 for ; Tue, 3 Oct 2023 07:49:40 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-r9cbt (unknown [10.110.103.73]) by director5.ghost.mail-out.ovh.net (Postfix) with ESMTPS id C75101FEA4; Tue, 3 Oct 2023 07:49:39 +0000 (UTC) Received: from 3mdeb.com ([37.59.142.101]) by ghost-submission-6684bf9d7b-r9cbt with ESMTPSA id xUxaJZPHG2WjLAAA6QRSDA (envelope-from ); Tue, 03 Oct 2023 07:49:39 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-101G00415c86915-d588-4ad5-91f8-ddee1475da2f, 444C33B3F4575406F9FC87223DE8D01215E8EE40) smtp.auth=pawel.langowski@3mdeb.com X-OVh-ClientIp: 213.192.77.249 From: Pawel Langowski To: openembedded-devel@lists.openembedded.org Cc: piotr.krol@3mdeb.com, tomasz.zyjewski@3mdeb.com Subject: [meta-networking][PATCHv5] recipes-connectivity: Add tayga recipe Date: Tue, 3 Oct 2023 09:49:29 +0200 Message-ID: <20231003074929.505981-1-pawel.langowski@3mdeb.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Ovh-Tracer-Id: 14381119511522947737 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrfeehgddulecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomheprfgrfigvlhcunfgrnhhgohifshhkihcuoehprgifvghlrdhlrghnghhofihskhhiseefmhguvggsrdgtohhmqeenucggtffrrghtthgvrhhnpefgffdtkefhkeeggfejhfetteelvdduvdefffeggfdvkefhheejhfeggedtgeefudenucffohhmrghinheplhhithgvtghhrdhorhhgnecukfhppeduvdejrddtrddtrddupddvudefrdduledvrdejjedrvdegledpfeejrdehledrudegvddruddtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehprgifvghlrdhlrghnghhofihskhhiseefmhguvggsrdgtohhmqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehophgvnhgvmhgsvgguuggvugdquggvvhgvlheslhhishhtshdrohhpvghnvghmsggvugguvggurdhorhhgpdfovfetjfhoshhtpehmohehkeefpdhmohguvgepshhmthhpohhuth List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 03 Oct 2023 07:49:46 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/105318 Recipe for TAYGA - an out-of-kernel stateless NAT64 implementation for Linux Signed-off-by: Pawel Langowski --- .../tayga/files/0001-include-sys-uio.patch | 18 +++ .../tayga/files/tayga.conf | 103 ++++++++++++++++++ .../tayga/files/tayga.service | 12 ++ .../recipes-connectivity/tayga/tayga_0.9.2.bb | 21 ++++ 4 files changed, 154 insertions(+) create mode 100644 meta-networking/recipes-connectivity/tayga/files/0001-include-sys-uio.patch create mode 100644 meta-networking/recipes-connectivity/tayga/files/tayga.conf create mode 100644 meta-networking/recipes-connectivity/tayga/files/tayga.service create mode 100644 meta-networking/recipes-connectivity/tayga/tayga_0.9.2.bb diff --git a/meta-networking/recipes-connectivity/tayga/files/0001-include-sys-uio.patch b/meta-networking/recipes-connectivity/tayga/files/0001-include-sys-uio.patch new file mode 100644 index 000000000000..0c6f1609af5e --- /dev/null +++ b/meta-networking/recipes-connectivity/tayga/files/0001-include-sys-uio.patch @@ -0,0 +1,18 @@ + +This patch addresses the following clang failure: tayga-0.9.2/nat64.c:119:6: +error: call to undeclared function 'writev'; ISO C99 and later do not support +implicit function declarations [-Wimplicit-function-declaration] + +Upstream-Status: Pending +Signed-off-by: Pawel Langowski + +--- tayga.h 2023-09-29 14:38:05.005837695 +0200 ++++ tayga-2.h 2023-09-29 14:37:45.560837257 +0200 +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/meta-networking/recipes-connectivity/tayga/files/tayga.conf b/meta-networking/recipes-connectivity/tayga/files/tayga.conf new file mode 100644 index 000000000000..c1b6163a4591 --- /dev/null +++ b/meta-networking/recipes-connectivity/tayga/files/tayga.conf @@ -0,0 +1,103 @@ +# +# Sample configuration file for TAYGA 0.9.2 +# +# Modify this to use your own addresses!! +# + +# +# TUN device that TAYGA will use to exchange IPv4 and IPv6 packets with the +# kernel. You may use any name you like, but `nat64' is recommended. +# +# This device may be created before starting the tayga daemon by running +# `tayga --mktun`. This allows routing and firewall rules to be set up prior +# to commencement of packet translation. +# +# Mandatory. +# +tun-device nat64 + +# +# TAYGA's IPv4 address. This is NOT your router's IPv4 address! TAYGA +# requires its own address because it acts as an IPv4 and IPv6 router, and +# needs to be able to send ICMP messages. TAYGA will also respond to ICMP +# echo requests (ping) at this address. +# +# This address can safely be located inside the dynamic-pool prefix. +# +# Mandatory. +# +ipv4-addr 192.168.254.1 + +# +# TAYGA's IPv6 address. This is NOT your router's IPv6 address! TAYGA +# requires its own address because it acts as an IPv4 and IPv6 router, and +# needs to be able to send ICMP messages. TAYGA will also respond to ICMP +# echo requests (ping6) at this address. +# +# You can leave ipv6-addr unspecified and TAYGA will construct its IPv6 +# address using ipv4-addr and the NAT64 prefix. +# +# Optional if the NAT64 prefix is specified, otherwise mandatory. It is also +# mandatory if the NAT64 prefix is 64:ff9b::/96 and ipv4-addr is a private +# (RFC1918) address. +# +#ipv6-addr 2001:db8:1::2 +ipv6-addr fdaa:bb:1::1 + +# +# The NAT64 prefix. The IPv4 address space is mapped into the IPv6 address +# space by prepending this prefix to the IPv4 address. Using a /96 prefix is +# recommended in most situations, but all lengths specified in RFC 6052 are +# supported. +# +# This must be a prefix selected from your organization's IPv6 address space +# or the Well-Known Prefix 64:ff9b::/96. Note that using the Well-Known +# Prefix will prohibit IPv6 hosts from contacting IPv4 hosts that have private +# (RFC1918) addresses, per RFC 6052. +# +# The NAT64 prefix need not be specified if all required address mappings are +# listed in `map' directives. (See below.) +# +# Optional. +# +##prefix 2001:db8:1:ffff::/96 +prefix 64:ff9b::/96 + +# +# Dynamic pool prefix. IPv6 hosts which send traffic through TAYGA (and do +# not correspond to a static map or an IPv4-translatable address in the NAT64 +# prefix) will be assigned an IPv4 address from the dynamic pool. Dynamic +# maps are valid for 124 minutes after the last matching packet is seen. +# +# If no unassigned addresses remain in the dynamic pool (or no dynamic pool is +# configured), packets from unknown IPv6 hosts will be rejected with an ICMP +# unreachable error. +# +# Optional. +# +dynamic-pool 192.168.254.0/24 + +# +# Persistent data storage directory. The dynamic.map file, which saves the +# dynamic maps that are created from dynamic-pool, is stored in this +# directory. Omit if you do not need these maps to be persistent between +# instances of TAYGA. +# +# Optional. +# +data-dir /var/spool/tayga + +# +# Establishes a single-host map. If an IPv6 host should be consistently +# reachable at a specific IPv4 address, the mapping can be specified in a +# `map' directive. (IPv6 hosts numbered with an IPv4-translatable address do +# not need map directives.) +# +# IPv4 addresses specified in the `map' directive can safely be located inside +# the dynamic-pool prefix. +# +# Optional. +# +#map 192.168.5.42 2001:db8:1:4444::1 +#map 192.168.5.43 2001:db8:1:4444::2 +#map 192.168.255.2 2001:db8:1:569::143 diff --git a/meta-networking/recipes-connectivity/tayga/files/tayga.service b/meta-networking/recipes-connectivity/tayga/files/tayga.service new file mode 100644 index 000000000000..0bffeb92a501 --- /dev/null +++ b/meta-networking/recipes-connectivity/tayga/files/tayga.service @@ -0,0 +1,12 @@ +[Unit] +SourcePath=/usr/sbin/tayga +Description=LSB: userspace NAT64 + +[Service] +Type=forking +ExecStart=/usr/sbin/tayga -d --config /etc/tayga.conf +RemainAfterExit=yes +TimeoutStopSec=infinity + +[Install] +WantedBy=multi-user.target diff --git a/meta-networking/recipes-connectivity/tayga/tayga_0.9.2.bb b/meta-networking/recipes-connectivity/tayga/tayga_0.9.2.bb new file mode 100644 index 000000000000..36d35e6dee89 --- /dev/null +++ b/meta-networking/recipes-connectivity/tayga/tayga_0.9.2.bb @@ -0,0 +1,21 @@ +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" + +SRC_URI = " \ + http://www.litech.org/tayga/tayga-${PV}.tar.bz2 \ + file://tayga.conf \ + file://tayga.service \ + file://0001-include-sys-uio.patch;striplevel=0 \ + " +SRC_URI[sha256sum] = "2b1f7927a9d2dcff9095aff3c271924b052ccfd2faca9588b277431a44f0009c" + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE:${PN} = "tayga.service" + +do_install:append() { + install -m 0644 ${WORKDIR}/tayga.conf ${D}${sysconfdir}/tayga.conf + install -d ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/tayga.service ${D}${systemd_unitdir}/system/ +} + +inherit autotools systemd