add samples

This commit is contained in:
Mario Fetka
2026-04-19 23:08:28 +02:00
parent 22dcfb823b
commit a1490efb03
8 changed files with 458 additions and 136 deletions

View File

@@ -1,4 +1,7 @@
AUX ipx.confd 552 BLAKE2B e953dfafdec15aed36928133ca9db9bd768112f814534fa1f13ae714af955abf2f7d3ce762e9f4c6f6440f80b2e3726f9d1c435eb8804cb3760e39394deb7be3 SHA512 ba7de25e2ee3b9997d51a4eed0b8eb6ede232b627962cbc0efe6c318c1b34911cb64e4c19786e44800d8b573c8730e355e71f78aaf17391f019cc17a49c6c84d
AUX ipx.init 847 BLAKE2B 8814aa5c9bcb2cc4a19cd65c21ec92e9ef10084dffd82cbd794377c3a012ca122d3ddfa78c546565e009bfd6dba0c7e9dd3933458bb35f383501fe2fabd0964d SHA512 f8a9cb8e46988a010bf5df97b6e0e29500319ba91964a81fea515cf70e19f04889a4ad061e2aa79a1b75ba3d1ab2ab0abd89d8ebf4ed626267377bd8d05eb2db
AUX ipx.service 3397 BLAKE2B 8581d8ffc754b2130c2b0cdfc260a927414eccc2e6679d4390bc0eec72cf7849f7db3c92d50226f56dce2883ea5a0893faf157171745034db68d1626e61a702f SHA512 fb6dbede0c27996f5d37c16bcee0d9ef6c216b6f66704dd041c5375347640f908ef467555ffba7e1b784920136f4c0a8d3d8e7c9faa97db003542fc949a0f984
EBUILD ipx-utils-9999.ebuild 743 BLAKE2B 450853689e9dc6b25e1995b0263ad7041ebf5af9de628833bd9e52b448462d3319ba665106b07eae6db9078c1e48ad839aeb0f534ac59335f6df848b5db088c3 SHA512 15d97870bbee8810a180a56a8c0e732c261c2fab9ac479b3062455015c1ec9468a5cf41d0bd6dea59b0738d0fa1007acc8bc5c3eb35d3e7c8d4b2e8cf3818e16
AUX ipx-utils-1.2-build-samples.patch 738 BLAKE2B ecda9215095db7dd3373e428c8429b7ebb633998fd93a8c843042691240754b884875eec0962a9b1facc96585019c3beeae2bc31405a0d06c0dc72b2c494271a SHA512 e141e6e5541fc3fd139c1e7842db6d55f652b847a4e2b2a2fc0e3a05b97389d829188fab35bef3ad626998dd7efecec6e24708bb0792182398d5f2d471393898
AUX ipx.confd 4030 BLAKE2B 5a1d911804cc2ec16f55af2e3b02314daae7d97b3c0255a400914b636834ec62475c783fadee1be53a84b40317728e3d62ac384c971a5976669bc4fe0a956686 SHA512 3be4ccab420120734c785756b9bb90b3e4689fe9c0ed0e8084088693ca5ff2814fce9fe46e2e02b06fb36b98d2767049902bfdb6aaba06ad8e0442d7930ad110
AUX ipx.init 671 BLAKE2B 42ae4bc5f2f7eb0f23140bca6346dae0af303e53f79ad29ac1cbc1a1cc0f139069666a20ce91cd3d91be85e0e05a09fb2ebc994ce47ae55e54e0c0f6ea9aec59 SHA512 be5eaa9431276284baca97763fdbb6e6a1b386b6b09faac2b2312762a5a1e888e984cd23c1e8800f20f01d3cf03091ad0c6a1e421a3a034e9885efb61ee98b61
AUX ipx.service 376 BLAKE2B 75deb44c34bca9007524c4a68bf27e91b56b0282c940b93bf4eea0f7865dad2cc70123ba5202ac6ae5f5e0d1e724391a89419897815854f7b910c966a62e5206 SHA512 297cd4fbdbf19749a94f7f2dcd6645d60c4a2764d4334746c7a9417f3af799c44323961f0fe6bf7c2252b69288797058fe25c94e8f19f73e46bd0863c8633745
AUX network-start.sh 3821 BLAKE2B a76eaffcd33167d8f6a51acafa78ad529a514800f323b151765f7eafd11c94e512926082f7eebf9e035d6f1ce595720970fa652722e31c182f21d35bbb72a43e SHA512 e4cac07b1bb6d8b8db41234e80112b27578a3c5b68a5b030fd801e529b149268bf93698bbab683897240d80bc0779bfb7abccc0142eb7d79a710be29f388678b
AUX network-stop.sh 1017 BLAKE2B dcbe9df829a788a678fbb736474b563f95474bbd1afd68aa22ac806cff66a888d2e38522e473b92c1d2801a5ef1e96843c5f3b358a288e563830c1c6f8e4b0ce SHA512 0019c4f28ab3043fa07feb745e7a76e52cf4b9736210222e8f15976753d490699d4eace834f2dd376dbc8903d95b69402180c0bae6f8373dae1cddd60129cdaa
EBUILD ipx-utils-9999.ebuild 1362 BLAKE2B 646b93d1b9256669277964597c779147a2944707c14ac00f4cfd595c8edc78b3accda388ac01c2c4cbd94c62c85e6a4c4fdf93ca4cbc37d681e6e9c13f3c67f2 SHA512 1e54940494d156c793567fb5f008d7005810df3664b589ffb7e6c150b6f5285b41aeedfc44c7cfc8d2209eb996184710d5b93834ccbde9d3f53cd63badce8737

View File

@@ -0,0 +1,35 @@
diff '--color=auto' -uNr ipx-utils-9999.orig/Makefile.am ipx-utils-9999/Makefile.am
--- ipx-utils-9999.orig/Makefile.am 2026-04-19 22:40:49.949320330 +0200
+++ ipx-utils-9999/Makefile.am 2026-04-19 22:42:54.743135308 +0200
@@ -4,7 +4,11 @@
ipx_configure \
ipx_interface \
ipx_internal_net \
- ipx_route
+ ipx_route \
+ ipxrcv \
+ ipxsend \
+ rip \
+ sap
ipx_configure_SOURCES = \
src/ipx_configure.c
@@ -18,6 +22,18 @@
ipx_route_SOURCES = \
src/ipx_route.c
+ipxrcv_SOURCES = \
+ Samples/ipxrcv.c
+
+ipxsend_SOURCES = \
+ Samples/ipxsend.c
+
+rip_SOURCES = \
+ Samples/rip.c
+
+sap_SOURCES = \
+ Samples/sap.c
+
man_MANS = \
docs/ipx_configure.8 \
docs/ipx_interface.8 \

View File

@@ -1,26 +1,140 @@
# Copyright 1999-2004 Gentoo Foundation
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Config file for /etc/init.d/ipx
# Configuration for the IPX network startup helpers.
#
# This file is used by:
# - /etc/init.d/ipx
# - /usr/libexec/ipx/network-start.sh
# - /usr/libexec/ipx/network-stop.sh
# - /etc/systemd/system/ipx.service
#
# Manual interface configuration:
# IPX_INTERFACES contains one entry per line.
#
# Format:
# <device>:<frame>:<netnum>
#
# Example:
# IPX_INTERFACES="
# enp0s31f6:802.2:1
# enp46s0u1u3u3:802.2:2
# wlp0s20f3:802.2:3
# "
#
# Behaviour:
# - The first successfully configured interface becomes the primary IPX
# interface.
# - Additional interfaces are configured as non-primary interfaces.
# - Each manually configured interface should use its own IPX network
# number.
# - Interfaces that are not currently present are skipped with a warning.
# - This is useful for optional hardware such as a docking station NIC.
#
# Link-state handling:
# If IPX_SKIP_LINK_DOWN=yes, interfaces that exist but currently do not
# have an active link are skipped as well.
#
# This is useful for cases such as:
# - a docking station NIC that exists but currently has no link
# - a physical Ethernet device with no cable attached
#
# Detection order:
# 1. /sys/class/net/<if>/carrier
# 2. /sys/class/net/<if>/operstate
#
# Example with an optional docking station interface:
# IPX_INTERFACES="
# enp46s0u1u3u3:802.2:1
# enp0s31f6:802.2:2
# wlp0s20f3:802.2:3
# "
#
# In that example:
# - if enp46s0u1u3u3 is present and usable, it will be configured first
# and become the primary IPX interface
# - if enp46s0u1u3u3 is missing, it will be skipped
# - if enp46s0u1u3u3 exists but has no active link and
# IPX_SKIP_LINK_DOWN=yes, it will also be skipped
# - the next successfully configured interface will become primary
#
# Static route configuration:
# IPX_ROUTES contains one entry per line.
#
# Format:
# <target_network>:<router_network>:<router_node>
#
# Example:
# IPX_ROUTES="
# 00000010:00000001:508140F6AC45
# 00000020:00000003:44E517C3D034
# "
#
# Route behaviour:
# - Routes are added after all interfaces have been configured
# - During shutdown, routes are removed again by target network
# - Empty lines and comment lines starting with '#' are ignored
#
# Automatic configuration:
# IPX_AUTO_PRIMARY and IPX_AUTO_INTERFACE are passed to ipx_configure.
#
# Recommended setting for manual interface definitions:
# - IPX_AUTO_INTERFACE=off
#
# This avoids mixing manual interface definitions with automatically created
# IPX interfaces.
#
# Internal network mode:
# If IPX_INTERNAL_NET=yes, no physical interfaces from IPX_INTERFACES are
# configured.
#
# Instead, an IPX internal network is created using IPX_NETNUM and
# IPX_NODENUM.
#
# The internal network does not use a physical device or frame type and
# automatically becomes the primary IPX interface.
#
# There can only be one internal network per host.
# Automatically selecting a primary interface.
# Automatically select a primary IPX interface.
IPX_AUTO_PRIMARY=on
# Automatically creating interfaces.
IPX_AUTO_INTERFACE=on
# Automatically create IPX interfaces.
# Recommended: off when using IPX_INTERFACES.
IPX_AUTO_INTERFACE=off
# Interface to which IPX sockets are bound.
IPX_DEVICE=eth0
# Skip interfaces that are present but currently have no active link.
# Valid values: yes / no
IPX_SKIP_LINK_DOWN=yes
# The IPX frame type to use
IPX_FRAME=802.2
# Create a special kind of IPX interface that does not
# have a physical device or frame type.
# Create a special internal IPX network instead of binding to physical NICs.
# Valid values: yes / no
IPX_INTERNAL_NET=no
# Network number
# IPX network number for internal network mode only.
IPX_NETNUM=1
# Node number
# IPX node number for internal network mode only.
IPX_NODENUM=1
# Manually configured IPX interfaces.
# Format: <device>:<frame>:<netnum>
#
# The first successfully configured interface becomes primary.
# Missing interfaces are skipped.
IPX_INTERFACES="
enp46s0u1u3u3:802.2:1
enp0s31f6:802.2:2
wlp0s20f3:802.2:3
"
# Static IPX routes.
# Format: <target_network>:<router_network>:<router_node>
#
# Example:
# IPX_ROUTES="
# 00000010:00000001:508140F6AC45
# 00000020:00000003:44E517C3D034
# "
IPX_ROUTES="
"

View File

@@ -1,41 +1,27 @@
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/ipx
# IPX network setup service
#
# Configuration is read from /etc/conf.d/ipx.
# The actual start/stop logic is implemented in helper scripts under
# /usr/libexec/ipx/ so that OpenRC and systemd can share the same code.
description="Configure IPX interfaces and automatic IPX behaviour"
depend() {
use net
use net
}
start() {
local retval=0
ebegin "Bringing IPX up"
if [ ${IPX_INTERNAL_NET} = "yes" ]
then
/sbin/ipx_internal_net add ${IPX_NETNUM} ${IPX_NODENUM}
retval=$?
else
/sbin/ipx_interface add -p ${IPX_DEVICE} \
${IPX_FRAME} ${IPX_NETNUM}
retval=$?
fi
/sbin/ipx_configure \
--auto_primary=${IPX_AUTO_PRIMARY} \
--auto_interface=${IPX_AUTO_INTERFACE}
retval=$(( $retval + $? ))
eend ${retval} "Failed to bring IPX up"
ebegin "Bringing IPX up"
/usr/libexec/ipx/network-start.sh
eend $? "Failed to bring IPX up"
}
stop() {
local retval=0
ebegin "Bringing IPX down"
/sbin/ipx_configure --auto_primary=off --auto_interface=off
retval=$?
/sbin/ipx_interface delall
retval=$(( $retval + $? ))
eend ${retval} "Failed to down IPX"
ebegin "Bringing IPX down"
/usr/libexec/ipx/network-stop.sh
eend $? "Failed to bring IPX down"
}

View File

@@ -1,84 +1,16 @@
# It's not recommended to modify this file in-place, because it will be
# overwritten during upgrades. If you want to customize, the best
# way is to use the "systemctl edit" command to create an override unit.
#
# For example, to pass additional options, create an override unit
# (as is done by systemctl edit) and enter the following:
#
# [Service]
# Environment=OPTIONS="-l 127.0.0.1,::1"
[Unit]
Description=IPX Network Config
After=network.target
Description=IPX network setup
Documentation=man:systemd.service(5)
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/ipx
ExecStart=/usr/bin/memcached -p ${PORT} -u ${USER} -m ${CACHESIZE} -c ${MAXCONN} $OPTIONS
# Set up a new file system namespace and mounts private /tmp and /var/tmp
# directories so this service cannot access the global directories and
# other processes cannot access this service's directories.
PrivateTmp=true
# Mounts the /usr, /boot, and /etc directories read-only for processes
# invoked by this unit.
ProtectSystem=full
# Ensures that the service process and all its children can never gain new
# privileges
NoNewPrivileges=true
# Sets up a new /dev namespace for the executed processes and only adds API
# pseudo devices such as /dev/null, /dev/zero or /dev/random (as well as
# the pseudo TTY subsystem) to it, but no physical devices such as /dev/sda.
PrivateDevices=true
# Required for dropping privileges and running as a different user
CapabilityBoundingSet=CAP_SETGID CAP_SETUID CAP_SYS_RESOURCE
# Restricts the set of socket address families accessible to the processes
# of this unit. Protects against vulnerabilities such as CVE-2016-8655
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
# Some security features are not in the older versions of systemd used by
# e.g. RHEL7/CentOS 7. The below settings are automatically edited at package
# build time to uncomment them if the target platform supports them.
# Attempts to create memory mappings that are writable and executable at
# the same time, or to change existing memory mappings to become executable
# are prohibited.
##safer##MemoryDenyWriteExecute=true
# Explicit module loading will be denied. This allows to turn off module
# load and unload operations on modular kernels. It is recommended to turn
# this on for most services that do not need special file systems or extra
# kernel modules to work.
##safer##ProtectKernelModules=true
# Kernel variables accessible through /proc/sys, /sys, /proc/sysrq-trigger,
# /proc/latency_stats, /proc/acpi, /proc/timer_stats, /proc/fs and /proc/irq
# will be made read-only to all processes of the unit. Usually, tunable
# kernel variables should only be written at boot-time, with the sysctl.d(5)
# mechanism. Almost no services need to write to these at runtime; it is hence
# recommended to turn this on for most services.
##safer##ProtectKernelTunables=true
# The Linux Control Groups (cgroups(7)) hierarchies accessible through
# /sys/fs/cgroup will be made read-only to all processes of the unit.
# Except for container managers no services should require write access
# to the control groups hierarchies; it is hence recommended to turn this
# on for most services
##safer##ProtectControlGroups=true
# Any attempts to enable realtime scheduling in a process of the unit are
# refused.
##safer##RestrictRealtime=true
# Takes away the ability to create or manage any kind of namespace
##safer##RestrictNamespaces=true
ExecStart=/usr/libexec/ipx/network-start.sh
ExecStop=/usr/libexec/ipx/network-stop.sh
ExecStopPost=/usr/libexec/ipx/network-stop.sh
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,176 @@
#!/bin/sh
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# IPX start helper for systemd and OpenRC.
#
# This script reads its configuration from environment variables, typically
# provided through /etc/conf.d/ipx.
#
# Manual interface format:
# <device>:<frame>:<netnum>
#
# Static route format:
# <target_network>:<router_network>:<router_node>
#
# Behaviour:
# - The first successfully configured interface becomes the primary IPX
# interface.
# - Missing interfaces are skipped.
# - Optionally, interfaces with no active link can also be skipped.
# - Static routes are added after interface configuration.
set -u
configured=0
retval=0
primary_set=0
log_warn() {
printf '%s\n' "ipx: $*" >&2
}
log_err() {
printf '%s\n' "ipx: $*" >&2
}
link_is_usable() {
local dev carrier_file operstate_file state
dev=$1
carrier_file="/sys/class/net/${dev}/carrier"
operstate_file="/sys/class/net/${dev}/operstate"
if [ "${IPX_SKIP_LINK_DOWN:-no}" != "yes" ]; then
return 0
fi
if [ -r "${carrier_file}" ]; then
state=$(cat "${carrier_file}")
if [ "${state}" = "0" ]; then
log_warn "interface ${dev} has no carrier, skipping"
return 1
fi
return 0
fi
if [ -r "${operstate_file}" ]; then
state=$(cat "${operstate_file}")
case "${state}" in
down)
log_warn "interface ${dev} is link-down, skipping"
return 1
;;
esac
fi
return 0
}
if [ "${IPX_INTERNAL_NET:-no}" = "yes" ]; then
if ! /sbin/ipx_internal_net add "${IPX_NETNUM}" "${IPX_NODENUM}"; then
log_err "failed to create internal IPX network"
retval=1
fi
else
oldifs=${IFS}
IFS='
'
for entry in ${IPX_INTERFACES:-}; do
[ -n "${entry}" ] || continue
case "${entry}" in
\#*)
continue
;;
esac
dev=${entry%%:*}
rest=${entry#*:}
frame=${rest%%:*}
netnum=${rest#*:}
if [ -z "${dev}" ] || [ -z "${frame}" ] || [ -z "${netnum}" ] || [ "${rest}" = "${entry}" ]; then
log_err "invalid IPX_INTERFACES entry: ${entry}"
retval=1
break
fi
if [ ! -d "/sys/class/net/${dev}" ]; then
log_warn "interface ${dev} is not present, skipping"
continue
fi
if ! link_is_usable "${dev}"; then
continue
fi
if [ "${primary_set}" -eq 0 ]; then
if /sbin/ipx_interface add -p "${dev}" "${frame}" "${netnum}"; then
configured=1
primary_set=1
else
log_err "failed to add primary IPX interface on ${dev}"
retval=1
fi
else
if /sbin/ipx_interface add "${dev}" "${frame}" "${netnum}"; then
configured=1
else
log_err "failed to add IPX interface on ${dev}"
retval=1
fi
fi
done
IFS=${oldifs}
if [ "${configured}" -eq 0 ] && [ "${retval}" -eq 0 ]; then
log_warn "no configured IPX interfaces were present"
fi
fi
if [ "${retval}" -eq 0 ]; then
oldifs=${IFS}
IFS='
'
for entry in ${IPX_ROUTES:-}; do
[ -n "${entry}" ] || continue
case "${entry}" in
\#*)
continue
;;
esac
target=${entry%%:*}
rest=${entry#*:}
router_net=${rest%%:*}
router_node=${rest#*:}
if [ -z "${target}" ] || [ -z "${router_net}" ] || [ -z "${router_node}" ] || [ "${rest}" = "${entry}" ]; then
log_err "invalid IPX_ROUTES entry: ${entry}"
retval=1
break
fi
if ! /sbin/ipx_route add "${target}" "${router_net}" "${router_node}"; then
log_err "failed to add IPX route to ${target}"
retval=1
fi
done
IFS=${oldifs}
fi
if ! /sbin/ipx_configure \
--auto_primary="${IPX_AUTO_PRIMARY}" \
--auto_interface="${IPX_AUTO_INTERFACE}"; then
log_err "failed to apply automatic IPX configuration"
retval=1
fi
if [ "${retval}" -ne 0 ]; then
log_warn "startup failed, cleaning up partial IPX configuration"
/usr/libexec/ipx/network-stop.sh || true
fi
exit "${retval}"

View File

@@ -0,0 +1,50 @@
#!/bin/sh
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# IPX stop helper for systemd and OpenRC.
#
# This script disables automatic IPX behaviour, removes configured static
# routes, removes all configured IPX interfaces and deletes the internal IPX
# network if present.
set -u
retval=0
oldifs=${IFS}
IFS='
'
for entry in ${IPX_ROUTES:-}; do
[ -n "${entry}" ] || continue
case "${entry}" in
\#*)
continue
;;
esac
target=${entry%%:*}
if ! /sbin/ipx_route del "${target}"; then
printf '%s\n' "ipx: failed to remove route to ${target}" >&2
retval=1
fi
done
IFS=${oldifs}
if ! /sbin/ipx_configure --auto_primary=off --auto_interface=off; then
printf '%s\n' "ipx: failed to disable automatic IPX configuration" >&2
retval=1
fi
if ! /sbin/ipx_interface delall; then
printf '%s\n' "ipx: failed to remove IPX interfaces" >&2
retval=1
fi
if ! /sbin/ipx_internal_net del; then
:
fi
exit "${retval}"

View File

@@ -1,36 +1,62 @@
# Copyright 1999-2022 Gentoo Authors
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
EGIT_REPO_URI="https://github.com/pasis/ipx-utils.git"
inherit autotools git-r3
inherit autotools git-r3 systemd
DESCRIPTION="The IPX Utilities"
DESCRIPTION="IPX protocol utilities"
HOMEPAGE="https://github.com/pasis/ipx-utils"
LICENSE="ipx-utils GPL-2" # GPL-2 only for init script
SLOT="0"
KEYWORDS="~amd64"
IUSE=""
RDEPEND="net-misc/ipx-modules"
RDEPEND="
net-misc/ipx-modules
"
BDEPEND="
dev-build/autoconf
dev-build/automake
dev-build/libtool
"
DOCS=( AUTHORS ChangeLog INSTALL NEWS README )
src_prepare() {
default
eautoreconf
default
eapply "${FILESDIR}/ipx-utils-1.2-build-samples.patch"
eautoreconf
}
src_configure() {
econf --bindir="${EPREFIX}"/sbin
econf --bindir="${EPREFIX}/sbin"
}
src_install() {
newconfd "${FILESDIR}"/ipx.confd ipx
newinitd "${FILESDIR}"/ipx.init ipx
default
default
newconfd "${FILESDIR}/ipx.confd" ipx
newinitd "${FILESDIR}/ipx.init" ipx
exeinto /usr/libexec/ipx
newexe "${FILESDIR}/network-start.sh" network-start.sh
newexe "${FILESDIR}/network-stop.sh" network-stop.sh
systemd_dounit "${FILESDIR}/ipx.service"
}
pkg_postinst() {
elog "IPX support was removed in Linux 4.18. For newer kernels build the ipx module from sources: https://github.com/pasis/ipx"
elog "IPX support was removed from the upstream Linux kernel in 4.18."
elog "For newer kernels, build the external IPX kernel module sources:"
elog " https://github.com/pasis/ipx"
elog
elog "OpenRC:"
elog " rc-update add ipx default"
elog
elog "systemd:"
elog " systemctl enable --now ipx.service"
}