diff --git a/src/Makefile b/src/Makefile index 68223b7076048302fc447fce605cddb9add55c65..e89425ab638a09a1a25b94f7735d3e507591a570 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 b8bab34a4506d7359b53eefd6f19bea3f8d64549..0584f43cb1c2028530ee059f1f07fca9d06839a8 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} };