From fa0d38dea94808e9ea3cdceb00defbb7aadb162b Mon Sep 17 00:00:00 2001 From: Amin Ben Romdhane <amin.benromdhane@iopsys.eu> Date: Fri, 17 Jan 2025 11:48:43 +0100 Subject: [PATCH] Define a config flag for each Object exposed by libnetmngr --- src/Makefile | 47 +++++++++++++++++++++++++++++++++++------------ src/net_plugin.c | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 13 deletions(-) diff --git a/src/Makefile b/src/Makefile index 68223b7..e89425a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,15 +1,38 @@ -LIBNETMNGR := libnetmngr.so -LIBIFACESTACK := libinterface_stack.so - -LIBNETMNGROBJS := net_plugin.o \ - gre.o \ - ip.o \ - routing.o \ - ppp.o \ - routeradvertisement.o \ - ipv6rd.o \ - common.o - +LIBNETMNGR = libnetmngr.so +LIBIFACESTACK = libinterface_stack.so + +LIBNETMNGROBJS = net_plugin.o common.o + +ifeq ($(NETMNGR_GRE_OBJ),y) +LIBNETMNGROBJS += gre.o +PROG_CFLAGS += -DNETMNGR_GRE_OBJ +endif + +ifeq ($(NETMNGR_IP_OBJ),y) +LIBNETMNGROBJS += ip.o +PROG_CFLAGS += -DNETMNGR_IP_OBJ +endif + +ifeq ($(NETMNGR_ROUTING_OBJ),y) +LIBNETMNGROBJS += routing.o +PROG_CFLAGS += -DNETMNGR_ROUTING_OBJ +endif + +ifeq ($(NETMNGR_PPP_OBJ),y) +LIBNETMNGROBJS += ppp.o +PROG_CFLAGS += -DNETMNGR_PPP_OBJ +endif + +ifeq ($(NETMNGR_ROUTER_ADVERTISEMENT_OBJ),y) +LIBNETMNGROBJS += routeradvertisement.o +PROG_CFLAGS += -DNETMNGR_ROUTER_ADVERTISEMENT_OBJ +endif + +ifeq ($(NETMNGR_IPV6RD_OBJ),y) +LIBNETMNGROBJS += ipv6rd.o +PROG_CFLAGS += -DNETMNGR_IPV6RD_OBJ +endif + LIBIFACESTACKOBJS := interfacestack.o LIB_CFLAGS = $(CFLAGS) -Wall -Werror -fstrict-aliasing -g diff --git a/src/net_plugin.c b/src/net_plugin.c index b8bab34..0584f43 100644 --- a/src/net_plugin.c +++ b/src/net_plugin.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 iopsys Software Solutions AB + * Copyright (C) 2024-2025 iopsys Software Solutions AB * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 2.1 @@ -8,20 +8,58 @@ * Author: Amin Ben Romdhane <amin.benromdhane@iopsys.eu> */ +#include <libbbfdm-api/dmapi.h> + +#ifdef NETMNGR_IP_OBJ #include "ip.h" +#endif + +#ifdef NETMNGR_GRE_OBJ #include "gre.h" +#endif + +#ifdef NETMNGR_PPP_OBJ #include "ppp.h" +#endif + +#ifdef NETMNGR_ROUTING_OBJ #include "routing.h" +#endif + +#ifdef NETMNGR_ROUTER_ADVERTISEMENT_OBJ #include "routeradvertisement.h" +#endif + +#ifdef NETMNGR_IPV6RD_OBJ #include "ipv6rd.h" +#endif DM_MAP_OBJ tDynamicObj[] = { /* parentobj, nextobject, parameter */ + +#ifdef NETMNGR_IP_OBJ {"Device.", tDeviceIPObj, NULL}, +#endif + +#ifdef NETMNGR_GRE_OBJ {"Device.", tDeviceGREObj, NULL}, +#endif + +#ifdef NETMNGR_PPP_OBJ {"Device.", tDevicePPPObj, NULL}, +#endif + +#ifdef NETMNGR_ROUTING_OBJ {"Device.", tDeviceRoutingObj, NULL}, +#endif + +#ifdef NETMNGR_ROUTER_ADVERTISEMENT_OBJ {"Device.", tDeviceRouterAdvertisementObj, NULL}, +#endif + +#ifdef NETMNGR_IPV6RD_OBJ {"Device.", tDeviceIPv6rdObj, NULL}, +#endif + {0} }; -- GitLab