From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Cc: Michael Tremer <michael.tremer@ipfire.org>
Subject: [PATCH 6/6] initscripts: Add an initscript for lldpd
Date: Thu, 6 Nov 2025 16:46:56 +0000 [thread overview]
Message-ID: <20251106164907.1484873-7-michael.tremer@ipfire.org> (raw)
In-Reply-To: <20251106164907.1484873-1-michael.tremer@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
config/rootfiles/common/aarch64/initscripts | 4 ++
config/rootfiles/common/riscv64/initscripts | 4 ++
config/rootfiles/common/x86_64/initscripts | 4 ++
lfs/initscripts | 3 +
src/initscripts/system/lldpd | 79 +++++++++++++++++++++
5 files changed, 94 insertions(+)
create mode 100755 src/initscripts/system/lldpd
diff --git a/config/rootfiles/common/aarch64/initscripts b/config/rootfiles/common/aarch64/initscripts
index fa43d4fe1..3f0e31f56 100644
--- a/config/rootfiles/common/aarch64/initscripts
+++ b/config/rootfiles/common/aarch64/initscripts
@@ -31,6 +31,7 @@ etc/rc.d/init.d/grub-btrfsd
etc/rc.d/init.d/halt
etc/rc.d/init.d/ipsec
etc/rc.d/init.d/leds
+etc/rc.d/init.d/lldpd
etc/rc.d/init.d/localnet
etc/rc.d/init.d/modules
etc/rc.d/init.d/mountfs
@@ -99,6 +100,7 @@ etc/rc.d/init.d/wlanclient
etc/rc.d/rc0.d/K01grub-btrfsd
#etc/rc.d/rc0.d/K01vdradmin
etc/rc.d/rc0.d/K08fcron
+etc/rc.d/rc0.d/K09lldpd
etc/rc.d/rc0.d/K10openvpn-rw
etc/rc.d/rc0.d/K11openvpn-n2n
etc/rc.d/rc0.d/K28apache
@@ -138,6 +140,7 @@ etc/rc.d/rc3.d/S24cyrus-sasl
etc/rc.d/rc3.d/S30sshd
etc/rc.d/rc3.d/S32apache
etc/rc.d/rc3.d/S40fcron
+etc/rc.d/rc3.d/S41lldpd
etc/rc.d/rc3.d/S51openvpn-n2n
etc/rc.d/rc3.d/S50openvpn-rw
etc/rc.d/rc3.d/S50wireguard
@@ -148,6 +151,7 @@ etc/rc.d/rc3.d/S99grub-btrfsd
etc/rc.d/rc6.d/K01grub-btrfsd
#etc/rc.d/rc6.d/K01vdradmin
etc/rc.d/rc6.d/K08fcron
+etc/rc.d/rc6.d/K09lldpd
etc/rc.d/rc6.d/K10openvpn-rw
etc/rc.d/rc6.d/K11openvpn-n2n
etc/rc.d/rc6.d/K28apache
diff --git a/config/rootfiles/common/riscv64/initscripts b/config/rootfiles/common/riscv64/initscripts
index a31359134..fb7cf4ff4 100644
--- a/config/rootfiles/common/riscv64/initscripts
+++ b/config/rootfiles/common/riscv64/initscripts
@@ -31,6 +31,7 @@ etc/rc.d/init.d/grub-btrfsd
etc/rc.d/init.d/halt
etc/rc.d/init.d/ipsec
etc/rc.d/init.d/leds
+etc/rc.d/init.d/lldpd
etc/rc.d/init.d/localnet
etc/rc.d/init.d/modules
etc/rc.d/init.d/mountfs
@@ -98,6 +99,7 @@ etc/rc.d/init.d/wlanclient
etc/rc.d/rc0.d/K01grub-btrfsd
#etc/rc.d/rc0.d/K01vdradmin
etc/rc.d/rc0.d/K08fcron
+etc/rc.d/rc0.d/K09lldpd
etc/rc.d/rc0.d/K10openvpn-rw
etc/rc.d/rc0.d/K11openvpn-n2n
etc/rc.d/rc0.d/K28apache
@@ -137,6 +139,7 @@ etc/rc.d/rc3.d/S24cyrus-sasl
etc/rc.d/rc3.d/S30sshd
etc/rc.d/rc3.d/S32apache
etc/rc.d/rc3.d/S40fcron
+etc/rc.d/rc3.d/S41lldpd
etc/rc.d/rc3.d/S51openvpn-n2n
etc/rc.d/rc3.d/S50openvpn-rw
etc/rc.d/rc3.d/S50wireguard
@@ -147,6 +150,7 @@ etc/rc.d/rc3.d/S99grub-btrfsd
etc/rc.d/rc6.d/K01grub-btrfsd
#etc/rc.d/rc6.d/K01vdradmin
etc/rc.d/rc6.d/K08fcron
+etc/rc.d/rc6.d/K09lldpd
etc/rc.d/rc6.d/K10openvpn-rw
etc/rc.d/rc6.d/K11openvpn-n2n
etc/rc.d/rc6.d/K28apache
diff --git a/config/rootfiles/common/x86_64/initscripts b/config/rootfiles/common/x86_64/initscripts
index a31359134..fb7cf4ff4 100644
--- a/config/rootfiles/common/x86_64/initscripts
+++ b/config/rootfiles/common/x86_64/initscripts
@@ -31,6 +31,7 @@ etc/rc.d/init.d/grub-btrfsd
etc/rc.d/init.d/halt
etc/rc.d/init.d/ipsec
etc/rc.d/init.d/leds
+etc/rc.d/init.d/lldpd
etc/rc.d/init.d/localnet
etc/rc.d/init.d/modules
etc/rc.d/init.d/mountfs
@@ -98,6 +99,7 @@ etc/rc.d/init.d/wlanclient
etc/rc.d/rc0.d/K01grub-btrfsd
#etc/rc.d/rc0.d/K01vdradmin
etc/rc.d/rc0.d/K08fcron
+etc/rc.d/rc0.d/K09lldpd
etc/rc.d/rc0.d/K10openvpn-rw
etc/rc.d/rc0.d/K11openvpn-n2n
etc/rc.d/rc0.d/K28apache
@@ -137,6 +139,7 @@ etc/rc.d/rc3.d/S24cyrus-sasl
etc/rc.d/rc3.d/S30sshd
etc/rc.d/rc3.d/S32apache
etc/rc.d/rc3.d/S40fcron
+etc/rc.d/rc3.d/S41lldpd
etc/rc.d/rc3.d/S51openvpn-n2n
etc/rc.d/rc3.d/S50openvpn-rw
etc/rc.d/rc3.d/S50wireguard
@@ -147,6 +150,7 @@ etc/rc.d/rc3.d/S99grub-btrfsd
etc/rc.d/rc6.d/K01grub-btrfsd
#etc/rc.d/rc6.d/K01vdradmin
etc/rc.d/rc6.d/K08fcron
+etc/rc.d/rc6.d/K09lldpd
etc/rc.d/rc6.d/K10openvpn-rw
etc/rc.d/rc6.d/K11openvpn-n2n
etc/rc.d/rc6.d/K28apache
diff --git a/lfs/initscripts b/lfs/initscripts
index 49215c0ae..d2ef7ef85 100644
--- a/lfs/initscripts
+++ b/lfs/initscripts
@@ -94,6 +94,7 @@ $(TARGET) :
ln -sf ../init.d/grub-btrfsd /etc/rc.d/rc0.d/K01grub-btrfsd
ln -sf ../init.d/vdradmin /etc/rc.d/rc0.d/K01vdradmin
ln -sf ../init.d/fcron /etc/rc.d/rc0.d/K08fcron
+ ln -sf ../init.d/lldpd /etc/rc.d/rc0.d/K09lldpd
ln -sf ../init.d/apache /etc/rc.d/rc0.d/K28apache
ln -sf ../init.d/openvpn-rw /etc/rc.d/rc0.d/K10openvpn-rw
ln -sf ../init.d/openvpn-n2n /etc/rc.d/rc0.d/K11openvpn-n2n
@@ -131,6 +132,7 @@ $(TARGET) :
ln -sf ../init.d/sshd /etc/rc.d/rc3.d/S30sshd
ln -sf ../init.d/apache /etc/rc.d/rc3.d/S32apache
ln -sf ../init.d/fcron /etc/rc.d/rc3.d/S40fcron
+ ln -sf ../init.d/lldpd /etc/rc.d/rc3.d/S41lldpd
ln -sf ../init.d/openvpn-n2n /etc/rc.d/rc3.d/S51openvpn-n2n
ln -sf ../init.d/openvpn-rw /etc/rc.d/rc3.d/S50openvpn-rw
ln -sf ../init.d/wireguard /etc/rc.d/rc3.d/S50wireguard
@@ -141,6 +143,7 @@ $(TARGET) :
ln -sf ../init.d/grub-btrfsd /etc/rc.d/rc6.d/K01grub-btrfsd
ln -sf ../init.d/vdradmin /etc/rc.d/rc6.d/K01vdradmin
ln -sf ../init.d/fcron /etc/rc.d/rc6.d/K08fcron
+ ln -sf ../init.d/lldpd /etc/rc.d/rc6.d/K09lldpd
ln -sf ../init.d/openvpn-rw /etc/rc.d/rc6.d/K10openvpn-rw
ln -sf ../init.d/openvpn-n2n /etc/rc.d/rc6.d/K11openvpn-n2n
ln -sf ../init.d/apache /etc/rc.d/rc6.d/K28apache
diff --git a/src/initscripts/system/lldpd b/src/initscripts/system/lldpd
new file mode 100755
index 000000000..128115dbb
--- /dev/null
+++ b/src/initscripts/system/lldpd
@@ -0,0 +1,79 @@
+#!/bin/sh
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+# Read the configuration
+readhash CONFIG "/var/ipfire/lldp/settings"
+
+generate_config() {
+ # Set the description (if given)
+ if [ -n "${CONFIG["DESCRIPTION"]}" ]; then
+ echo "configure system description ${CONFIG["DESCRIPTION"]}"
+ fi
+
+ return 0
+}
+
+case "${1}" in
+ start)
+ # Do nothing if the service is not enabled
+ if [ "${CONFIG["ENABLED"]}" != "on" ]; then
+ exit 0
+ fi
+
+ # Generate the configuration file
+ if ! generate_config > /etc/lldpd.d/lldpd.conf; then
+ boot_mesg -n "Failed to generate configuration for lldpd" ${WARNING}
+ boot_mesg "" ${NORMAL}
+ exit 1
+ fi
+
+ boot_mesg "Starting Link-Layer Discovery Protocol Daemon..."
+ loadproc /usr/sbin/lldpd
+ ;;
+
+ stop)
+ boot_mesg "Stopping Link-Layer Discovery Protocol Daemon..."
+ killproc /usr/sbin/lldpd
+ ;;
+
+ reload)
+ boot_mesg "Reloading Link-Layer Discovery Protocol Daemoon..."
+ reloadproc /usr/sbin/lldpd
+ ;;
+
+ restart)
+ ${0} stop
+ sleep 1
+ ${0} start
+ ;;
+
+ status)
+ statusproc /usr/sbin/lldpd
+ ;;
+
+ *)
+ echo "Usage: ${0} {start|stop|reload|restart|status}"
+ exit 1
+ ;;
+esac
--
2.47.3
prev parent reply other threads:[~2025-11-06 16:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 16:46 New Feature: LLDP Michael Tremer
2025-11-06 16:46 ` [PATCH 1/6] lldpd: New package Michael Tremer
2025-11-06 21:45 ` Adolf Belka
2025-11-07 14:10 ` Michael Tremer
2025-11-06 16:46 ` [PATCH 2/6] misc-progs: Add lldpdctrl Michael Tremer
2025-11-06 16:46 ` [PATCH 3/6] cfgroot: Create /var/ipfire/lldp/settings Michael Tremer
2025-11-06 16:46 ` [PATCH 4/6] web-user-interface: Add lldp.cgi Michael Tremer
2025-11-06 16:46 ` [PATCH 5/6] web-user-interface: Add LLDP to the network menu Michael Tremer
2025-11-06 16:46 ` Michael Tremer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251106164907.1484873-7-michael.tremer@ipfire.org \
--to=michael.tremer@ipfire.org \
--cc=development@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox