mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-26 02:17:34 +09:00
Issue #2058 - add patches from dbsoft to fix Mac and FreeBSD builds
This commit is contained in:
parent
0e0bd83fe2
commit
21c624222f
1 changed files with 24 additions and 25 deletions
|
|
@ -32,7 +32,7 @@
|
||||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
#if defined(__FreeBSD__)
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 366426 2020-10-04 15:37:34Z tuexen $");
|
__FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 366426 2020-10-04 15:37:34Z tuexen $");
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -50,7 +50,8 @@ __FBSDID("$FreeBSD: head/sys/netinet/sctp_bsd_addr.c 366426 2020-10-04 15:37:34Z
|
||||||
#include <netinet/sctp_asconf.h>
|
#include <netinet/sctp_asconf.h>
|
||||||
#include <netinet/sctp_sysctl.h>
|
#include <netinet/sctp_sysctl.h>
|
||||||
#include <netinet/sctp_indata.h>
|
#include <netinet/sctp_indata.h>
|
||||||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
#include <sys/unistd.h>
|
#include <sys/unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -78,8 +79,8 @@ MALLOC_DEFINE(SCTP_M_MCORE, "sctp_mcore", "sctp mcore queue");
|
||||||
|
|
||||||
/* Global NON-VNET structure that controls the iterator */
|
/* Global NON-VNET structure that controls the iterator */
|
||||||
struct iterator_control sctp_it_ctl;
|
struct iterator_control sctp_it_ctl;
|
||||||
#if !(defined(__FreeBSD__) && !defined(__Userspace__))
|
|
||||||
|
|
||||||
|
#if !defined(__FreeBSD__)
|
||||||
static void
|
static void
|
||||||
sctp_cleanup_itqueue(void)
|
sctp_cleanup_itqueue(void)
|
||||||
{
|
{
|
||||||
|
|
@ -129,7 +130,7 @@ sctp_iterator_thread(void *v SCTP_UNUSED)
|
||||||
#endif
|
#endif
|
||||||
SCTP_IPI_ITERATOR_WQ_LOCK();
|
SCTP_IPI_ITERATOR_WQ_LOCK();
|
||||||
/* In FreeBSD this thread never terminates. */
|
/* In FreeBSD this thread never terminates. */
|
||||||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
#if defined(__FreeBSD__)
|
||||||
for (;;) {
|
for (;;) {
|
||||||
#else
|
#else
|
||||||
while ((sctp_it_ctl.iterator_flags & SCTP_ITERATOR_MUST_EXIT) == 0) {
|
while ((sctp_it_ctl.iterator_flags & SCTP_ITERATOR_MUST_EXIT) == 0) {
|
||||||
|
|
@ -138,7 +139,7 @@ sctp_iterator_thread(void *v SCTP_UNUSED)
|
||||||
msleep(&sctp_it_ctl.iterator_running,
|
msleep(&sctp_it_ctl.iterator_running,
|
||||||
#if defined(__FreeBSD__)
|
#if defined(__FreeBSD__)
|
||||||
&sctp_it_ctl.ipi_iterator_wq_mtx,
|
&sctp_it_ctl.ipi_iterator_wq_mtx,
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__) || defined(__Userspace_os_Darwin)
|
||||||
sctp_it_ctl.ipi_iterator_wq_mtx,
|
sctp_it_ctl.ipi_iterator_wq_mtx,
|
||||||
#endif
|
#endif
|
||||||
0, "waiting_for_work", 0);
|
0, "waiting_for_work", 0);
|
||||||
|
|
@ -149,14 +150,14 @@ sctp_iterator_thread(void *v SCTP_UNUSED)
|
||||||
pthread_cond_wait(&sctp_it_ctl.iterator_wakeup, &sctp_it_ctl.ipi_iterator_wq_mtx);
|
pthread_cond_wait(&sctp_it_ctl.iterator_wakeup, &sctp_it_ctl.ipi_iterator_wq_mtx);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !(defined(__FreeBSD__) && !defined(__Userspace__))
|
#if !defined(__FreeBSD__)
|
||||||
if (sctp_it_ctl.iterator_flags & SCTP_ITERATOR_MUST_EXIT) {
|
if (sctp_it_ctl.iterator_flags & SCTP_ITERATOR_MUST_EXIT) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
sctp_iterator_worker();
|
sctp_iterator_worker();
|
||||||
}
|
}
|
||||||
#if !(defined(__FreeBSD__) && !defined(__Userspace__))
|
#if !defined(__FreeBSD__)
|
||||||
/* Now this thread needs to be terminated */
|
/* Now this thread needs to be terminated */
|
||||||
sctp_cleanup_itqueue();
|
sctp_cleanup_itqueue();
|
||||||
sctp_it_ctl.iterator_flags |= SCTP_ITERATOR_EXITED;
|
sctp_it_ctl.iterator_flags |= SCTP_ITERATOR_EXITED;
|
||||||
|
|
@ -251,7 +252,7 @@ sctp_is_desired_interface_type(struct ifnet *ifn)
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
/* check the interface type to see if it's one we care about */
|
/* check the interface type to see if it's one we care about */
|
||||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
#if defined(__APPLE__)
|
||||||
switch(ifnet_type(ifn)) {
|
switch(ifnet_type(ifn)) {
|
||||||
#else
|
#else
|
||||||
switch (ifn->if_type) {
|
switch (ifn->if_type) {
|
||||||
|
|
@ -277,7 +278,7 @@ sctp_is_desired_interface_type(struct ifnet *ifn)
|
||||||
case IFT_GIF:
|
case IFT_GIF:
|
||||||
case IFT_L2VLAN:
|
case IFT_L2VLAN:
|
||||||
case IFT_STF:
|
case IFT_STF:
|
||||||
#if !(defined(__APPLE__) && !defined(__Userspace__))
|
#if !defined(__APPLE__)
|
||||||
case IFT_IP:
|
case IFT_IP:
|
||||||
case IFT_IPOVERCDLC:
|
case IFT_IPOVERCDLC:
|
||||||
case IFT_IPOVERCLAW:
|
case IFT_IPOVERCLAW:
|
||||||
|
|
@ -293,29 +294,21 @@ sctp_is_desired_interface_type(struct ifnet *ifn)
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
|
||||||
|
|
||||||
|
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||||
int
|
int
|
||||||
sctp_is_vmware_interface(struct ifnet *ifn)
|
sctp_is_vmware_interface(struct ifnet *ifn)
|
||||||
{
|
{
|
||||||
return (strncmp(ifnet_name(ifn), "vmnet", 5) == 0);
|
return (strncmp(ifnet_name(ifn), "vmnet", 5) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) && defined(__Userspace__)
|
#if defined(_WIN32)
|
||||||
#ifdef MALLOC
|
|
||||||
#undef MALLOC
|
|
||||||
#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
|
|
||||||
#endif
|
|
||||||
#ifdef FREE
|
|
||||||
#undef FREE
|
|
||||||
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
|
|
||||||
#endif
|
|
||||||
static void
|
static void
|
||||||
sctp_init_ifns_for_vrf(int vrfid)
|
sctp_init_ifns_for_vrf(int vrfid)
|
||||||
{
|
{
|
||||||
#if defined(INET) || defined(INET6)
|
#if defined(INET) || defined(INET6)
|
||||||
|
struct ifaddrs *ifa;
|
||||||
struct sctp_ifa *sctp_ifa;
|
struct sctp_ifa *sctp_ifa;
|
||||||
DWORD Err, AdapterAddrsSize;
|
DWORD Err, AdapterAddrsSize;
|
||||||
PIP_ADAPTER_ADDRESSES pAdapterAddrs, pAdapt;
|
PIP_ADAPTER_ADDRESSES pAdapterAddrs, pAdapt;
|
||||||
|
|
@ -341,7 +334,8 @@ sctp_init_ifns_for_vrf(int vrfid)
|
||||||
/* Get actual adapter information */
|
/* Get actual adapter information */
|
||||||
if ((Err = GetAdaptersAddresses(AF_INET, 0, NULL, pAdapterAddrs, &AdapterAddrsSize)) != ERROR_SUCCESS) {
|
if ((Err = GetAdaptersAddresses(AF_INET, 0, NULL, pAdapterAddrs, &AdapterAddrsSize)) != ERROR_SUCCESS) {
|
||||||
SCTP_PRINTF("GetAdaptersV4Addresses() failed with error code %d\n", Err);
|
SCTP_PRINTF("GetAdaptersV4Addresses() failed with error code %d\n", Err);
|
||||||
FREE(pAdapterAddrs);
|
if (pAdapterAddrs)
|
||||||
|
GlobalFree(pAdapterAddrs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Enumerate through each returned adapter and save its information */
|
/* Enumerate through each returned adapter and save its information */
|
||||||
|
|
@ -366,7 +360,8 @@ sctp_init_ifns_for_vrf(int vrfid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FREE(pAdapterAddrs);
|
if (pAdapterAddrs)
|
||||||
|
GlobalFree(pAdapterAddrs);
|
||||||
#endif
|
#endif
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
AdapterAddrsSize = 0;
|
AdapterAddrsSize = 0;
|
||||||
|
|
@ -386,7 +381,8 @@ sctp_init_ifns_for_vrf(int vrfid)
|
||||||
/* Get actual adapter information */
|
/* Get actual adapter information */
|
||||||
if ((Err = GetAdaptersAddresses(AF_INET6, 0, NULL, pAdapterAddrs, &AdapterAddrsSize)) != ERROR_SUCCESS) {
|
if ((Err = GetAdaptersAddresses(AF_INET6, 0, NULL, pAdapterAddrs, &AdapterAddrsSize)) != ERROR_SUCCESS) {
|
||||||
SCTP_PRINTF("GetAdaptersV6Addresses() failed with error code %d\n", Err);
|
SCTP_PRINTF("GetAdaptersV6Addresses() failed with error code %d\n", Err);
|
||||||
FREE(pAdapterAddrs);
|
if (pAdapterAddrs)
|
||||||
|
GlobalFree(pAdapterAddrs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Enumerate through each returned adapter and save its information */
|
/* Enumerate through each returned adapter and save its information */
|
||||||
|
|
@ -408,7 +404,8 @@ sctp_init_ifns_for_vrf(int vrfid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FREE(pAdapterAddrs);
|
if (pAdapterAddrs)
|
||||||
|
GlobalFree(pAdapterAddrs);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#elif defined(__Userspace__)
|
#elif defined(__Userspace__)
|
||||||
|
|
@ -476,6 +473,7 @@ sctp_init_ifns_for_vrf(int vrfid)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__) && !defined(__Userspace__)
|
#if defined(__APPLE__) && !defined(__Userspace__)
|
||||||
static void
|
static void
|
||||||
sctp_init_ifns_for_vrf(int vrfid)
|
sctp_init_ifns_for_vrf(int vrfid)
|
||||||
|
|
@ -554,6 +552,7 @@ sctp_init_ifns_for_vrf(int vrfid)
|
||||||
ifnet_list_free(ifnetlist);
|
ifnet_list_free(ifnetlist);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
#if defined(__FreeBSD__) && !defined(__Userspace__)
|
||||||
static void
|
static void
|
||||||
sctp_init_ifns_for_vrf(int vrfid)
|
sctp_init_ifns_for_vrf(int vrfid)
|
||||||
|
|
@ -574,7 +573,7 @@ sctp_init_ifns_for_vrf(int vrfid)
|
||||||
|
|
||||||
IFNET_RLOCK();
|
IFNET_RLOCK();
|
||||||
NET_EPOCH_ENTER(et);
|
NET_EPOCH_ENTER(et);
|
||||||
CK_STAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_link) {
|
CK_TAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_list) {
|
||||||
if (sctp_is_desired_interface_type(ifn) == 0) {
|
if (sctp_is_desired_interface_type(ifn) == 0) {
|
||||||
/* non desired type */
|
/* non desired type */
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue