Skip to content

Configurable services #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e504eee
package/skeleton-init-finit: enable fewer services by default
troglobit Aug 22, 2023
03d26c7
Refactor, break out a libsrx from confd, shared with statd
troglobit Aug 22, 2023
bb2d85e
src: minor, add missing dist_doc_DATA incl. LICENSE file
troglobit Aug 22, 2023
0e7132d
confd: flatten hierarchy now that statd has moved out
troglobit Aug 22, 2023
b5bc4ff
confd: add support for enabling mDNS/SD and SSDP discovery services
troglobit Aug 22, 2023
b6c9fb4
Enable mDNS/SD and SSDP discovery services in factory-config
troglobit Aug 22, 2023
79981fa
Ignore /.backup and /x-* directories
troglobit Aug 22, 2023
693d411
patches/netcalc: add missing pipe colorization patch
troglobit Aug 22, 2023
bc30fa7
patches/tcpdump: add missing drop-verbose-default-output patch
troglobit Aug 22, 2023
fc474a4
Fix 120: rename sysrepo-bootstrap -> confd-bootstrap
troglobit Aug 23, 2023
e5ddb01
cli: add "end" alias to "up", leave this node/subsection
troglobit Aug 23, 2023
5666b7a
confd: add support for enabling LLDP agent using ieee802-dot1ab-lldp
troglobit Aug 23, 2023
f5d8c1d
Enable LLDP agent in factory-config
troglobit Aug 23, 2023
c9397c2
package/skeleton-init-finit: let SSDP advertise every 30 sec, like LLDP
troglobit Aug 24, 2023
0909793
package/skeleton-init-finit: rename SSDP service .conf
troglobit Aug 25, 2023
df328d4
test: minor, syntax pep-8
troglobit Aug 26, 2023
1b0f77f
test: add Sniffer helper class, wrapping tcpdump
troglobit Aug 27, 2023
34e548c
test: add SsdpClient helper class to probe for end devices
troglobit Aug 28, 2023
027f758
test/case: new test, verify SSDP can be disabled/enabled
troglobit Aug 28, 2023
72b7444
test/case: check for both SSDP and mDNS in same test
troglobit Aug 29, 2023
50bfbe6
test/case: add LLDP to same test
troglobit Aug 29, 2023
a11b4fc
Relocate confd-bootstrap.sh to /usr/libexec
troglobit Aug 29, 2023
569ab8d
test/case: increase test time slightly to catch per-20 sec LLDP
troglobit Aug 30, 2023
a71fd07
test: disable flaky services_basic test
troglobit Aug 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
*~
.gdb_history
/.backup
/.ccache
/dl
/output*
/x-*
/test/.venv
/local.mk
9 changes: 9 additions & 0 deletions board/netconf/rootfs/etc/auto-factory.d/10-system.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"ietf-system:system": {
"hostname": "infix"
},
"ieee802-dot1ab-lldp:lldp": {
"infix-lldp:enabled": true
},
"infix-services:mdns": {
"enabled": true
},
"infix-services:ssdp": {
"enabled": true
}
}
2 changes: 1 addition & 1 deletion board/netconf/rootfs/lib/infix/cfg-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ chmod 444 $CFG_D/auto-factory-config.cfg
ln -sf auto-factory-config.cfg $CFG_D/factory-config.cfg

# Bootstrap sysrepo db with all modules required by confd
sysrepo-bootstrap.sh $CFG_D/factory-config.cfg $CFG_D/startup-config.cfg
/usr/libexec/confd/confd-bootstrap.sh $CFG_D/factory-config.cfg $CFG_D/startup-config.cfg
1 change: 1 addition & 0 deletions package/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ source "$BR2_EXTERNAL_INFIX_PATH/package/ifupdown-ng/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/klish-plugin-infix/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/klish/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/klish-plugin-sysrepo/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/libsrx/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/lowdown/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/mdnsd/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/net/Config.in"
Expand Down
1 change: 1 addition & 0 deletions package/confd/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ config BR2_PACKAGE_CONFD
select BR2_PACKAGE_LIBITE
select BR2_PACKAGE_NETOPEER2
select BR2_PACKAGE_SYSREPO
select BR2_PACKAGE_LIBSRX
help
A plugin to sysrepo that provides the core YANG models used to
manage an Infix based system. Configuration can be done using
Expand Down
2 changes: 1 addition & 1 deletion package/confd/confd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CONFD_SITE_METHOD = local
CONFD_SITE = $(BR2_EXTERNAL_INFIX_PATH)/src/confd
CONFD_LICENSE = BSD-3
CONFD_LICENSE_FILES = LICENSE
CONFD_DEPENDENCIES = augeas jansson libite sysrepo
CONFD_DEPENDENCIES = augeas jansson libite sysrepo libsrx
CONFD_AUTORECONF = YES

define CONFD_INSTALL_EXTRA
Expand Down
7 changes: 7 additions & 0 deletions package/libsrx/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
config BR2_PACKAGE_LIBSRX
bool "libsrx"
select BR2_PACKAGE_SYSREPO
help
Extensions and helper APIs for sysrepo plugins.

https://github.com/kernelkit/infix
16 changes: 16 additions & 0 deletions package/libsrx/libsrx.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
################################################################################
#
# libsrx
#
################################################################################

LIBSRX_VERSION = 1.0.0
LIBSRX_SITE_METHOD = local
LIBSRX_SITE = $(BR2_EXTERNAL_INFIX_PATH)/src/libsrx
LIBSRX_LICENSE = BSD-3-Clause
LIBSRX_LICENSE_FILES = LICENSE
LIBSRX_INSTALL_STAGING = YES
LIBSRX_DEPENDENCIES = sysrepo
LIBSRX_AUTORECONF = YES

$(eval $(autotools-package))
11 changes: 2 additions & 9 deletions package/skeleton-init-finit/skeleton-init-finit.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ ifeq ($(BR2_PACKAGE_AVAHI_DAEMON),y)
define SKELETON_INIT_FINIT_SET_AVAHI
cp $(SKELETON_INIT_FINIT_AVAILABLE)/avahi.conf $(FINIT_D)/available/
cp $(SKELETON_INIT_FINIT_AVAILABLE)/avahi-dnsconfd.conf $(FINIT_D)/available/
ln -sf ../available/avahi.conf $(FINIT_D)/enabled/avahi.conf
endef
SKELETON_INIT_FINIT_POST_INSTALL_TARGET_HOOKS += SKELETON_INIT_FINIT_SET_AVAHI
endif
Expand Down Expand Up @@ -103,7 +102,6 @@ endif
ifeq ($(BR2_PACKAGE_LLDPD),y)
define SKELETON_INIT_FINIT_SET_LLDPD
cp $(SKELETON_INIT_FINIT_AVAILABLE)/lldpd.conf $(FINIT_D)/available/
ln -sf ../available/lldpd.conf $(FINIT_D)/enabled/lldpd.conf
endef
SKELETON_INIT_FINIT_POST_INSTALL_TARGET_HOOKS += SKELETON_INIT_FINIT_SET_LLDPD
endif
Expand All @@ -118,15 +116,13 @@ endif
ifeq ($(BR2_PACKAGE_NETSNMP),y)
define SKELETON_INIT_FINIT_SET_NETSNMP
cp $(SKELETON_INIT_FINIT_AVAILABLE)/snmpd.conf $(FINIT_D)/available/
ln -sf ../available/snmpd.conf $(FINIT_D)/enabled/snmpd.conf
endef
SKELETON_INIT_FINIT_POST_INSTALL_TARGET_HOOKS += SKELETON_INIT_FINIT_SET_NETSNMP
endif

ifeq ($(BR2_PACKAGE_NGINX),y)
define SKELETON_INIT_FINIT_SET_NGINX
cp $(SKELETON_INIT_FINIT_AVAILABLE)/nginx.conf $(FINIT_D)/available/
ln -sf ../available/nginx.conf $(FINIT_D)/enabled/nginx.conf
endef
SKELETON_INIT_FINIT_POST_INSTALL_TARGET_HOOKS += SKELETON_INIT_FINIT_SET_NGINX
endif
Expand Down Expand Up @@ -215,8 +211,7 @@ endif
# SSDP Responder
ifeq ($(BR2_PACKAGE_SSDP_RESPONDER),y)
define SKELETON_INIT_FINIT_SET_SSDP_RESPONDER
cp $(SKELETON_INIT_FINIT_AVAILABLE)/ssdpd.conf $(FINIT_D)/available/
ln -sf ../available/ssdpd.conf $(FINIT_D)/enabled/ssdpd.conf
cp $(SKELETON_INIT_FINIT_AVAILABLE)/ssdp-responder.conf $(FINIT_D)/available/
endef
SKELETON_INIT_FINIT_POST_INSTALL_TARGET_HOOKS += SKELETON_INIT_FINIT_SET_SSDP_RESPONDER
endif
Expand Down Expand Up @@ -252,11 +247,9 @@ endef
SKELETON_INIT_FINIT_POST_INSTALL_TARGET_HOOKS += SKELETON_INIT_FINIT_SET_WATCHDOGD
endif

# Enable gdbserver when running in Qemu mode
ifeq ($(QEMU_GDB),y)
ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),y)
define SKELETON_INIT_FINIT_SET_GDBSERVER
cp $(SKELETON_INIT_FINIT_AVAILABLE)/gdbserver.conf $(FINIT_D)/available/
ln -sf ../available/gdbserver.conf $(FINIT_D)/enabled/gdbserver.conf
endef
SKELETON_INIT_FINIT_POST_INSTALL_TARGET_HOOKS += SKELETON_INIT_FINIT_SET_GDBSERVER
endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
service [2345789] avahi-daemon -s -- Avahi mDNS-SD daemon
service [2345789] name:mdns avahi-daemon -s -- Avahi mDNS-SD daemon
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
service [2345] name:ssdp ssdpd -r 5 -i 30 -ns -- SSDP Responder

This file was deleted.

1 change: 1 addition & 0 deletions package/statd/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ config BR2_PACKAGE_STATD
select BR2_PACKAGE_JANSSON
select BR2_PACKAGE_LIBEV
select BR2_PACKAGE_SYSREPO
select BR2_PACKAGE_LIBSRX
help
Operational Status Daemon. Responsible for handling sysrepo
operational run-time info. Such as interface state and address.
Expand Down
3 changes: 2 additions & 1 deletion package/statd/statd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
# statd
#
################################################################################

STATD_VERSION = 1.0
STATD_LICENSE = MIT
STATD_SITE_METHOD = local
STATD_SITE = $(BR2_EXTERNAL_INFIX_PATH)/src/statd
STATD_DEPENDENCIES = sysrepo libev jansson
STATD_DEPENDENCIES = sysrepo libev libsrx jansson

define STATD_BUILD_CMDS
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
Expand Down
13 changes: 13 additions & 0 deletions patches/netcalc/2.1.6/colorize-over-pipes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff -ruN netcalc-2.1.6.orig/src/netcalc.c netcalc-2.1.6/src/netcalc.c
--- netcalc-2.1.6.orig/src/netcalc.c 2020-06-07 00:07:47.000000000 +0200
+++ netcalc-2.1.6/src/netcalc.c 2023-07-17 20:46:27.798167801 +0200
@@ -615,9 +615,6 @@
if (!abox_start)
err(1, "Fatal error");

- if (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO))
- colorize = 0;
-
if (split_errv4 || split_errv6 || range_err) {
nothing:
warnx("No (valid) commands received, nothing to do.");
17 changes: 17 additions & 0 deletions patches/tcpdump/silence.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff -ruN tcpdump-4.99.4.orig/tcpdump.c tcpdump-4.99.4/tcpdump.c
--- tcpdump-4.99.4.orig/tcpdump.c 2023-04-07 20:30:58.000000000 +0200
+++ tcpdump-4.99.4/tcpdump.c 2023-07-17 18:08:51.322519509 +0200
@@ -2535,12 +2535,7 @@
* to a file from the -V file). Print a message to
* the standard error on UN*X.
*/
- if (!ndo->ndo_vflag && !WFileName) {
- (void)fprintf(stderr,
- "%s: verbose output suppressed, use -v[v]... for full protocol decode\n",
- program_name);
- } else
- (void)fprintf(stderr, "%s: ", program_name);
+ (void)fprintf(stderr, "%s: ", program_name);
dlt = pcap_datalink(pd);
dlt_name = pcap_datalink_val_to_name(dlt);
(void)fprintf(stderr, "listening on %s", device);
1 change: 0 additions & 1 deletion src/confd/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

9 changes: 5 additions & 4 deletions src/confd/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SUBDIRS = src yang
DISTCLEANFILES = *~ *.d
ACLOCAL_AMFLAGS = -I m4
dist_bin_SCRIPTS= sysrepo-bootstrap.sh
SUBDIRS = src yang
dist_doc_DATA = README.md LICENSE
pkglibexec_SCRIPTS = confd-bootstrap.sh
DISTCLEANFILES = *~ *.d
ACLOCAL_AMFLAGS = -I m4
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ sysrepoctl -s $SEARCH \
-i infix-if-type@2023-08-21.yang -g wheel -p 0660 \
-i infix-interfaces@2023-08-21.yang -g wheel -p 0660 \
-e vlan-filtering \
-i ieee802-dot1ab-lldp@2022-03-15.yang -g wheel -p 0660 \
-i infix-lldp@2023-08-23.yang -g wheel -p 0660 \
-i infix-dhcp-client@2023-05-22.yang -g wheel -p 0660 \
-i infix-shell-type@2023-08-21.yang -g wheel -p 0660 \
-i infix-system@2023-08-15.yang -g wheel -p 0660 \
-i infix-services@2023-08-22.yang -g wheel -p 0660 \
-I "${INIT_DATA}"
rc=$?

Expand Down
8 changes: 3 additions & 5 deletions src/confd/configure.ac
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
AC_PREREQ(2.61)
AC_INIT([confd], [1.0.0],
[https://github.com/kernelkit/infix/issues])
AC_INIT([confd], [1.0.0], [https://github.com/kernelkit/infix/issues])
AM_INIT_AUTOMAKE(1.11 foreign subdir-objects)
AM_SILENT_RULES(yes)

LT_INIT

AC_CONFIG_FILES([
Makefile
src/Makefile
src/confd/Makefile
yang/Makefile
])

AC_PROG_CC
AC_PROG_INSTALL
LT_INIT

AC_CONFIG_LIBOBJ_DIR(lib)
AC_REPLACE_FUNCS(vasprintf)
Expand All @@ -38,6 +35,7 @@ PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.50 gio-2.0 gio-unix-2.0])
PKG_CHECK_MODULES([jansson], [jansson >= 2.0.0])
PKG_CHECK_MODULES([libite], [libite >= 2.5.0])
PKG_CHECK_MODULES([sysrepo], [sysrepo >= 2.2.36])
PKG_CHECK_MODULES([libsrx], [libsrx >= 1.0.0])

# Plugin installation path for sysrepo-plugind
PKG_CHECK_VAR([srpdplugindir], [sysrepo], [SRPD_PLUGINS_PATH])
Expand Down
52 changes: 50 additions & 2 deletions src/confd/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
AUTOMAKE_OPTIONS = subdir-objects
CFLAGS += -Wall -Wextra -Werror -Wno-unused-parameter
AM_CPPFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE -D_GNU_SOURCE -DYANG_PATH_=\"$(YANGDIR)\"

SUBDIRS = confd
plugindir = $(srpdplugindir)
plugin_LTLIBRARIES = confd-plugin.la

confd_plugin_la_LDFLAGS = -module -avoid-version -shared

confd_plugin_la_CFLAGS = \
$(augeas_CFLAGS) \
$(glib_CFLAGS) \
$(jansson_CFLAGS) \
$(libite_CFLAGS) \
$(sysrepo_CFLAGS) \
$(libsrx_CFLAGS) \
$(CFLAGS)

confd_plugin_la_LIBADD = \
$(augeas_LIBS) \
$(glib_LIBS) \
$(jansson_LIBS) \
$(libite_LIBS) \
$(sysrepo_LIBS) \
$(libsrx_LIBS)

confd_plugin_la_SOURCES = \
core.c core.h \
dagger.c dagger.h \
ietf-interfaces.c \
ietf-system.c \
infix-dhcp.c \
infix-services.c \
infix-factory.c \
infix-system-software.c

rauc_installer_sources = \
rauc-installer.c rauc-installer.h

BUILT_SOURCES = $(rauc_installer_sources)
EXTRA_DIST = de.pengutronix.rauc.Installer.xml

$(rauc_installer_sources): de.pengutronix.rauc.Installer.xml
$(AM_V_GEN) gdbus-codegen \
--generate-c-code rauc-installer \
--c-generate-autocleanup all \
--c-namespace Rauc \
--interface-prefix de.pengutronix.rauc. \
$<

nodist_confd_plugin_la_SOURCES = \
$(rauc_installer_sources)
57 changes: 0 additions & 57 deletions src/confd/src/confd/Makefile.am

This file was deleted.

8 changes: 6 additions & 2 deletions src/confd/src/confd/core.c → src/confd/src/core.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* SPDX-License-Identifier: BSD-3-Clause */

#include <srx/srx_module.h>
#include <srx/common.h>

#include "core.h"
#include "../lib/srx_module.h"
#include "../lib/common.h"

static struct confd confd;

Expand Down Expand Up @@ -116,6 +117,9 @@ int sr_plugin_init_cb(sr_session_ctx_t *session, void **priv)
if (rc)
goto err;
rc = infix_system_sw_init(&confd);
if (rc)
goto err;
rc = infix_services_init(&confd);
if (rc)
goto err;

Expand Down
Loading