diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2017-11-09 16:09:51 +0100 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2017-11-09 16:09:51 +0100 |
commit | fd80621fea5cafcdca3f7fe762fede374a66e4b2 (patch) | |
tree | 0487f909a06e82a11533a8e1f5eda6638ad8cee7 | |
parent | cf29925b29a4e4e38ab88573f12ec075eacb3d22 (diff) |
dhcpv4: make DHCPv4 support compiletime configurable
Make DHCPv4 support compile time configurable; avoids DHCPv4 functionality
overlap with other packages.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/config.c | 4 | ||||
-rw-r--r-- | src/odhcpd.c | 2 | ||||
-rw-r--r-- | src/odhcpd.h | 6 |
4 files changed, 16 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 839f47f..380d633 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,12 @@ if(${UBUS}) set(EXT_LINK ${EXT_LINK} ubus) endif(${UBUS}) -add_executable(odhcpd src/odhcpd.c src/config.c src/router.c src/dhcpv6.c src/ndp.c src/dhcpv6-ia.c src/dhcpv4.c src/netlink.c ${EXT_SRC}) +if(${DHCPV4_SUPPORT}) + add_definitions(-DDHCPV4_SUPPORT) + set(EXT_SRC ${EXT_SRC} src/dhcpv4.c) +endif(${DHCPV4_SUPPORT}) + +add_executable(odhcpd src/odhcpd.c src/config.c src/router.c src/dhcpv6.c src/ndp.c src/dhcpv6-ia.c src/netlink.c ${EXT_SRC}) target_link_libraries(odhcpd resolv ubox uci ${libnl} ${EXT_LINK}) # Installation diff --git a/src/config.c b/src/config.c index 7e23eb2..bb885d0 100644 --- a/src/config.c +++ b/src/config.c @@ -239,7 +239,9 @@ static void close_interface(struct interface *iface) router_setup_interface(iface, false); dhcpv6_setup_interface(iface, false); ndp_setup_interface(iface, false); +#ifdef DHCPV4_SUPPORT dhcpv4_setup_interface(iface, false); +#endif clean_interface(iface); free(iface->addr4); @@ -846,7 +848,9 @@ void odhcpd_reload(void) router_setup_interface(i, !i->ignore || i->ra != MODE_DISABLED); dhcpv6_setup_interface(i, !i->ignore || i->dhcpv6 != MODE_DISABLED); ndp_setup_interface(i, !i->ignore || i->ndp != MODE_DISABLED); +#ifdef DHCPV4_SUPPORT dhcpv4_setup_interface(i, !i->ignore || i->dhcpv4 != MODE_DISABLED); +#endif } else close_interface(i); } diff --git a/src/odhcpd.c b/src/odhcpd.c index 4972aa2..13697b7 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -110,8 +110,10 @@ int main(int argc, char **argv) if (ndp_init()) return 4; +#ifdef DHCPV4_SUPPORT if (dhcpv4_init()) return 4; +#endif odhcpd_run(); return 0; diff --git a/src/odhcpd.h b/src/odhcpd.h index a49ab57..45badd3 100644 --- a/src/odhcpd.h +++ b/src/odhcpd.h @@ -315,12 +315,14 @@ void netlink_dump_addr_table(const bool v6); int netlink_init(void); int router_init(void); int dhcpv6_init(void); -int dhcpv4_init(void); int ndp_init(void); +#ifdef DHCPV4_SUPPORT +int dhcpv4_init(void); +int dhcpv4_setup_interface(struct interface *iface, bool enable); +#endif int router_setup_interface(struct interface *iface, bool enable); int dhcpv6_setup_interface(struct interface *iface, bool enable); int ndp_setup_interface(struct interface *iface, bool enable); -int dhcpv4_setup_interface(struct interface *iface, bool enable); void odhcpd_reload(void); |