From: Alberto Leiva Popper Date: Tue, 19 Oct 2021 17:01:12 +0000 (-0500) Subject: Reorganize imports in common and address modules X-Git-Tag: 1.5.2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43a5ebebaa83901311ae01569a0a7ce269064cb3;p=thirdparty%2FFORT-validator.git Reorganize imports in common and address modules Was throwing a compilation warning in FreeBSD. --- diff --git a/src/address.c b/src/address.c index 6b5cf8b6..3316ae4a 100644 --- a/src/address.c +++ b/src/address.c @@ -1,11 +1,9 @@ #include "address.h" -#include -#include -#include /* inet_ntop */ -#include /* AF_INET, AF_INET6 (needed in OpenBSD) */ -#include /* AF_INET, AF_INET6 (needed in OpenBSD) */ -#include "common.h" +#include /* strtoul() */ +#include /* memset(), memcpy() */ +#include /* inet_ntop(), htonl() */ + #include "log.h" #include "thread_var.h" @@ -515,6 +513,18 @@ ipv6_covered(struct in6_addr *f_addr, uint8_t f_len, struct in6_addr *son_addr) return true; } +char const * +addr2str4(struct in_addr const *addr, char *buffer) +{ + return inet_ntop(AF_INET, addr, buffer, INET_ADDRSTRLEN); +} + +char const * +addr2str6(struct in6_addr const *addr, char *buffer) +{ + return inet_ntop(AF_INET6, addr, buffer, INET6_ADDRSTRLEN); +} + /** * buffer must length INET6_ADDRSTRLEN. */ diff --git a/src/address.h b/src/address.h index 53585ec4..8fbf7a71 100644 --- a/src/address.h +++ b/src/address.h @@ -51,6 +51,8 @@ int ipv6_prefix_validate(struct ipv6_prefix *); bool ipv4_covered(struct in_addr *, uint8_t, struct in_addr *); bool ipv6_covered(struct in6_addr *, uint8_t, struct in6_addr *); +char const *addr2str4(struct in_addr const *, char *); +char const *addr2str6(struct in6_addr const *, char *); void sockaddr2str(struct sockaddr_storage *, char *buffer); #endif /* SRC_ADDRESS_H_ */ diff --git a/src/common.c b/src/common.c index f49bb744..918e4117 100644 --- a/src/common.c +++ b/src/common.c @@ -1,14 +1,13 @@ #include "common.h" -#include -#include -#include -#include -#include -#include -#include /* AF_INET, AF_INET6 (needed in OpenBSD) */ -#include /* AF_INET, AF_INET6 (needed in OpenBSD) */ -#include +#include /* readdir(), closedir() */ +#include /* realpath() */ +#include /* malloc(), free(), realloc(), realpath() */ +#include /* remove() */ +#include /* strdup(), strrchr(), strcmp(), strcat(), etc */ +#include /* stat(), rmdir() */ +#include /* stat(), mkdir() */ +#include /* stat(), closedir(), mkdir() */ #include "config.h" #include "log.h" @@ -198,18 +197,6 @@ valid_file_or_dir(char const *location, bool check_file, bool check_dir, return result; } -char const * -addr2str4(struct in_addr const *addr, char *buffer) -{ - return inet_ntop(AF_INET, addr, buffer, INET_ADDRSTRLEN); -} - -char const * -addr2str6(struct in6_addr const *addr, char *buffer) -{ - return inet_ntop(AF_INET6, addr, buffer, INET6_ADDRSTRLEN); -} - static int dir_exists(char const *path, bool *result) { diff --git a/src/common.h b/src/common.h index 1c92c41e..cf21ccc5 100644 --- a/src/common.h +++ b/src/common.h @@ -4,7 +4,6 @@ #include #include #include -#include /* "I think that this is not supposed to be implemented." */ #define ENOTSUPPORTED 3172 @@ -54,9 +53,6 @@ int process_file_or_dir(char const *, char const *, bool, process_file_cb, typedef int (*pr_errno_cb)(int, const char *, ...); bool valid_file_or_dir(char const *, bool, bool, pr_errno_cb); -char const *addr2str4(struct in_addr const *, char *); -char const *addr2str6(struct in6_addr const *, char *); - int create_dir_recursive(char const *); int delete_dir_recursive_bottom_up(char const *); diff --git a/src/object/certificate.c b/src/object/certificate.c index 7f7ecea1..ca52f7a5 100644 --- a/src/object/certificate.c +++ b/src/object/certificate.c @@ -1839,19 +1839,16 @@ static int get_certificate_type(X509 *cert, bool is_ta, enum cert_type *result) { if (is_ta) { - /* Note: It looks weird if we log the type here. */ *result = TA; return 0; } if (X509_check_ca(cert) == 1) { - pr_val_debug("Type: CA"); *result = CA; return 0; } if (has_bgpsec_router_eku(cert)) { - pr_val_debug("Type: BGPsec EE"); *result = BGPSEC; return 0; }