[PATCH rtems-lwip v1 5/8] sebhbsd: Adapt source
Kinsey Moore
kinsey.moore at oarcorp.com
Tue Aug 23 19:47:38 UTC 2022
Add the tweaks necessary for this to compile on lwIP.
---
sebhbsd/freebsd/contrib/ntp/include/config.h | 11 +++++++++++
sebhbsd/freebsd/contrib/ntp/include/ntp_net.h | 3 +++
sebhbsd/freebsd/contrib/ntp/ntpd/ntp_io.c | 8 ++++++++
3 files changed, 22 insertions(+)
diff --git a/sebhbsd/freebsd/contrib/ntp/include/config.h b/sebhbsd/freebsd/contrib/ntp/include/config.h
index 0cd7aba..d0251a1 100644
--- a/sebhbsd/freebsd/contrib/ntp/include/config.h
+++ b/sebhbsd/freebsd/contrib/ntp/include/config.h
@@ -339,7 +339,9 @@
#define GETSOCKNAME_SOCKLEN_TYPE socklen_t
/* Do we have a routing socket (rt_msghdr or rtattr)? */
+#ifndef __rtems__
#define HAS_ROUTING_SOCKET 1
+#endif
/* via __adjtimex */
/* #undef HAVE_ADJTIMEX */
@@ -1153,8 +1155,10 @@
/* Do we have the TIO serial stuff? */
/* #undef HAVE_TIO_SERIAL_STUFF */
+#ifndef __rtems__
/* Are TrustedBSD MAC policy privileges available? */
#define HAVE_TRUSTEDBSD_MAC 1
+#endif
/* Define to 1 if the system has the type `uint16_t'. */
#define HAVE_UINT16_T 1
@@ -1468,6 +1472,9 @@
/* wildcard socket needs REUSEADDR to bind interface addresses */
/* #undef OS_NEEDS_REUSEADDR_FOR_IFADDRBIND */
+#ifdef __rtems__
+#define OS_NEEDS_REUSEADDR_FOR_IFADDRBIND
+#endif
/* Do we need to override the system's idea of HZ? */
#define OVERRIDE_HZ 1
@@ -1680,7 +1687,11 @@ typedef unsigned int uintptr_t;
/* configure --enable-ipv6 */
#define WANT_IPV6 1
+#ifdef __rtems__
+#include <machine/endian.h>
+#else
#include <machine/_endian.h>
+#endif
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
diff --git a/sebhbsd/freebsd/contrib/ntp/include/ntp_net.h b/sebhbsd/freebsd/contrib/ntp/include/ntp_net.h
index 0577402..3a7a9a1 100644
--- a/sebhbsd/freebsd/contrib/ntp/include/ntp_net.h
+++ b/sebhbsd/freebsd/contrib/ntp/include/ntp_net.h
@@ -29,6 +29,9 @@ typedef union {
struct sockaddr sa;
struct sockaddr_in sa4;
struct sockaddr_in6 sa6;
+#ifdef __rtems__
+ struct sockaddr_storage storage;
+#endif
} sockaddr_u;
/*
diff --git a/sebhbsd/freebsd/contrib/ntp/ntpd/ntp_io.c b/sebhbsd/freebsd/contrib/ntp/ntpd/ntp_io.c
index f572255..eea40ed 100644
--- a/sebhbsd/freebsd/contrib/ntp/ntpd/ntp_io.c
+++ b/sebhbsd/freebsd/contrib/ntp/ntpd/ntp_io.c
@@ -1115,7 +1115,11 @@ create_wildcards(
wildif->flags = INT_UP | INT_WILDCARD;
wildif->ignore_packets = (ACTION_DROP == action);
+#ifdef __rtems__
+ wildif->fd = open_socket(&wildif->sin, 0, 0, wildif);
+#else
wildif->fd = open_socket(&wildif->sin, 0, 1, wildif);
+#endif
if (wildif->fd != INVALID_SOCKET) {
wildipv6 = wildif;
@@ -1166,7 +1170,11 @@ create_wildcards(
SET_ADDR4N(&wildif->bcast, INADDR_ANY);
SET_PORT(&wildif->bcast, port);
#endif /* MCAST */
+#ifdef __rtems__
+ wildif->fd = open_socket(&wildif->sin, 0, 0, wildif);
+#else
wildif->fd = open_socket(&wildif->sin, 0, 1, wildif);
+#endif
if (wildif->fd != INVALID_SOCKET) {
wildipv4 = wildif;
--
2.30.2
More information about the devel
mailing list