diff options
author | Simon Rettberg | 2013-06-27 19:57:45 +0200 |
---|---|---|
committer | Simon Rettberg | 2013-06-27 19:57:45 +0200 |
commit | 4cbda53c050966e2ae9965c1e9742f06ca3eee77 (patch) | |
tree | ee9aab46e6d1f6c47950228ca0a1c9a783d5670a /remote/rootfs | |
parent | [kdm] Add empty branding logo to prevent kdm from showing a black box if no b... (diff) | |
download | tm-scripts-4cbda53c050966e2ae9965c1e9742f06ca3eee77.tar.gz tm-scripts-4cbda53c050966e2ae9965c1e9742f06ca3eee77.tar.xz tm-scripts-4cbda53c050966e2ae9965c1e9742f06ca3eee77.zip |
[rootfs-stage32] Add rdns tool for reverse DNS lookups
Diffstat (limited to 'remote/rootfs')
-rw-r--r-- | remote/rootfs/rootfs-stage32/rdns.c | 28 | ||||
-rw-r--r-- | remote/rootfs/rootfs-stage32/rootfs-stage32.build | 4 |
2 files changed, 32 insertions, 0 deletions
diff --git a/remote/rootfs/rootfs-stage32/rdns.c b/remote/rootfs/rootfs-stage32/rdns.c new file mode 100644 index 00000000..218f7400 --- /dev/null +++ b/remote/rootfs/rootfs-stage32/rdns.c @@ -0,0 +1,28 @@ +#include <stdio.h> +#include <errno.h> +#include <netdb.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +int main(int argc, char *argv[]) +{ + if (argc != 2) { + fprintf(stderr,"usage: %s <IPADDRESS>\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/remote/rootfs/rootfs-stage32/rootfs-stage32.build b/remote/rootfs/rootfs-stage32/rootfs-stage32.build index d3cddcd9..bd018adc 100644 --- a/remote/rootfs/rootfs-stage32/rootfs-stage32.build +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.build @@ -25,6 +25,10 @@ build() { perror "${BIN} not found on the system! Please install it." fi done + # 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." + REQUIRED_BINARIES+=" rdns" pinfo "Searching libraries from config file in system... (could take some time)" for LIB in ${REQUIRED_LIBRARIES} |