From a22e5bb83ae87cf48c24a2653363727e9bd07b12 Mon Sep 17 00:00:00 2001 From: Jose Alonso Cardenas Marquez Date: Wed, 6 Jan 2021 08:42:12 +0000 Subject: - New port: security/gvm-libs This is the libraries module for the Greenbone Vulnerability Management Solution. It is used for the Greenbone Security Manager appliances and provides various functionalities to support the integrated service daemons. WWW: https://github.com/greenbone/gvm-libs --- security/gvm-libs/files/patch-base_networking.c | 87 +++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 security/gvm-libs/files/patch-base_networking.c (limited to 'security/gvm-libs/files/patch-base_networking.c') diff --git a/security/gvm-libs/files/patch-base_networking.c b/security/gvm-libs/files/patch-base_networking.c new file mode 100644 index 000000000000..d493408701cb --- /dev/null +++ b/security/gvm-libs/files/patch-base_networking.c @@ -0,0 +1,87 @@ +--- base/networking.c 2020-12-30 23:53:55.170376000 -0500 ++++ base/networking.c 2020-12-31 00:06:29.941646000 -0500 +@@ -30,28 +30,30 @@ + #include /* for errno, EAFNOSUPPORT */ + #include + #include /* for ifaddrs, freeifaddrs, getifaddrs */ ++#include + #include /* for IFNAMSIZ */ ++#include + #include /* for uint32_t, uint8_t */ + #include /* for atoi, strtol */ + #include /* for memcpy, bzero, strchr, strlen, strcmp, strncpy */ + #include /* for AF_INET, AF_INET6, AF_UNSPEC, sockaddr_storage */ + #include /* for close */ + +-#ifdef __FreeBSD__ +-#include +-#define s6_addr32 __u6_addr.__u6_addr32 +-#endif ++//#ifdef __FreeBSD__ ++//#include ++//#define s6_addr32 __u6_addr.__u6_addr32 ++//#endif + + /* Global variables */ + + /* Source interface name eg. eth1. */ +-char global_source_iface[IFNAMSIZ] = {'\0'}; ++char global_source_iface[IFNAMSIZ]; + + /* Source IPv4 address. */ +-struct in_addr global_source_addr = {.s_addr = 0}; ++struct in_addr global_source_addr; + + /* Source IPv6 address. */ +-struct in6_addr global_source_addr6 = {.s6_addr32 = {0, 0, 0, 0}}; ++struct in6_addr global_source_addr6; + + /* Source Interface/Address related functions. */ + +@@ -244,10 +246,19 @@ + if (ip4 == NULL || ip6 == NULL) + return; + +- ip6->s6_addr32[0] = 0; +- ip6->s6_addr32[1] = 0; +- ip6->s6_addr32[2] = htonl (0xffff); +- memcpy (&ip6->s6_addr32[3], ip4, sizeof (struct in_addr)); ++ ip6->s6_addr[0] = 0; ++ ip6->s6_addr[1] = 0; ++ ip6->s6_addr[2] = 0; ++ ip6->s6_addr[3] = 0; ++ ip6->s6_addr[4] = 0; ++ ip6->s6_addr[5] = 0; ++ ip6->s6_addr[6] = 0; ++ ip6->s6_addr[7] = 0; ++ ip6->s6_addr[8] = 0; ++ ip6->s6_addr[9] = 0; ++ ip6->s6_addr[10] = 0xff; ++ ip6->s6_addr[11] = 0xff; ++ memcpy (&ip6->s6_addr[12], ip4, sizeof (struct in_addr)); + } + + /** +@@ -262,7 +273,7 @@ + if (!addr6) + return; + if (IN6_IS_ADDR_V4MAPPED (addr6)) +- inet_ntop (AF_INET, &addr6->s6_addr32[3], str, INET6_ADDRSTRLEN); ++ inet_ntop (AF_INET, &addr6->s6_addr[12], str, INET6_ADDRSTRLEN); + else + inet_ntop (AF_INET6, addr6, str, INET6_ADDRSTRLEN); + } +@@ -808,11 +819,11 @@ + if (IN6_IS_ADDR_V4MAPPED (&addr6)) + { + /* addr is 0.0.0.0 */ +- if (addr6_p->s6_addr32[3] == 0) ++ if (addr6_p->s6_addr[12] == 0) + return 1; + + /* addr starts with 127.0.0.1 */ +- if ((addr6_p->s6_addr32[3] & htonl (0xFF000000)) ++ if ((addr6_p->s6_addr[12] & htonl (0xFF000000)) + == htonl (0x7F000000)) + return 1; + } -- cgit v1.2.3