From 8a090d4aff93d1ba69d7d4d8d89795270e85a4d6 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 7 Aug 2019 11:34:35 +0200 Subject: [rdns] move rdns to its own module --- core/modules/dhcpc-busybox/module.conf | 4 +++- core/modules/rdns/module.build | 15 +++++++++++++++ core/modules/rdns/module.conf | 4 ++++ core/modules/rdns/rdns.c | 28 ++++++++++++++++++++++++++++ core/rootfs/rootfs-stage32/module.build | 3 --- core/rootfs/rootfs-stage32/module.conf | 1 - core/rootfs/rootfs-stage32/rdns.c | 28 ---------------------------- 7 files changed, 50 insertions(+), 33 deletions(-) create mode 100644 core/modules/rdns/module.build create mode 100644 core/modules/rdns/module.conf create mode 100644 core/modules/rdns/rdns.c delete mode 100644 core/rootfs/rootfs-stage32/rdns.c diff --git a/core/modules/dhcpc-busybox/module.conf b/core/modules/dhcpc-busybox/module.conf index d5d021fa..d8961801 100644 --- a/core/modules/dhcpc-busybox/module.conf +++ b/core/modules/dhcpc-busybox/module.conf @@ -1,2 +1,4 @@ #!/bin/bash -# Nothing +REQUIRED_MODULES=" + rdns +" diff --git a/core/modules/rdns/module.build b/core/modules/rdns/module.build new file mode 100644 index 00000000..1469a09f --- /dev/null +++ b/core/modules/rdns/module.build @@ -0,0 +1,15 @@ +#!/bin/bash + +fetch_source() { + : +} + +build() { + mkdir -p "$MODULE_BUILD_DIR/opt/openslx/bin" + gcc -o "$MODULE_BUILD_DIR/opt/openslx/bin/rdns" "$MODULE_DIR/rdns.c" || perror "Compiling rdns failed." +} + +post_copy() { + : +} + diff --git a/core/modules/rdns/module.conf b/core/modules/rdns/module.conf new file mode 100644 index 00000000..049b374f --- /dev/null +++ b/core/modules/rdns/module.conf @@ -0,0 +1,4 @@ +#!/bin/bash +REQUIRED_BINARIES=" + rdns +" diff --git a/core/modules/rdns/rdns.c b/core/modules/rdns/rdns.c new file mode 100644 index 00000000..218f7400 --- /dev/null +++ b/core/modules/rdns/rdns.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + if (argc != 2) { + fprintf(stderr,"usage: %s \n", argv[0]); + return 1; + } + + struct hostent *he; + struct in_addr ipv4addr; + struct in6_addr ipv6addr; + + inet_pton(AF_INET, argv[1], &ipv4addr); + he = gethostbyaddr(&ipv4addr, sizeof ipv4addr, AF_INET); + if (he == NULL) return 2; + if (he->h_name == NULL) return 3; + printf("%s\n", he->h_name); + + return 0; +} + diff --git a/core/rootfs/rootfs-stage32/module.build b/core/rootfs/rootfs-stage32/module.build index fe843ce7..8f98fc6d 100644 --- a/core/rootfs/rootfs-stage32/module.build +++ b/core/rootfs/rootfs-stage32/module.build @@ -15,9 +15,6 @@ build() { local FILELIST="list_binaries_and_files" [ -e "${FILELIST}" ] && rm "${FILELIST}" - # Compile rdns - mkdir -p "$MODULE_BUILD_DIR/opt/openslx/bin" - gcc -o "$MODULE_BUILD_DIR/opt/openslx/bin/rdns" "$MODULE_DIR/rdns.c" || perror "Compiling rdns failed." # Get ldconfig mkdir -p "$MODULE_BUILD_DIR/sbin" local LOC=$(which ldconfig.real) diff --git a/core/rootfs/rootfs-stage32/module.conf b/core/rootfs/rootfs-stage32/module.conf index 4235b999..409af2ba 100644 --- a/core/rootfs/rootfs-stage32/module.conf +++ b/core/rootfs/rootfs-stage32/module.conf @@ -37,7 +37,6 @@ REQUIRED_BINARIES=" bc dirname mkdosfs - rdns find rpcbind rpc.statd diff --git a/core/rootfs/rootfs-stage32/rdns.c b/core/rootfs/rootfs-stage32/rdns.c deleted file mode 100644 index 218f7400..00000000 --- a/core/rootfs/rootfs-stage32/rdns.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - if (argc != 2) { - fprintf(stderr,"usage: %s \n", argv[0]); - return 1; - } - - struct hostent *he; - struct in_addr ipv4addr; - struct in6_addr ipv6addr; - - inet_pton(AF_INET, argv[1], &ipv4addr); - he = gethostbyaddr(&ipv4addr, sizeof ipv4addr, AF_INET); - if (he == NULL) return 2; - if (he->h_name == NULL) return 3; - printf("%s\n", he->h_name); - - return 0; -} - -- cgit v1.2.3-55-g7522