Discussion:
[PATCH 03/44] Add MAP_EXCL flag for mmap(2). It should be combined with MAP_FIXED, and prevents the request from deleting existing mappings in the region, failing instead.
Sebastian Huber
2018-08-09 06:08:55 UTC
Permalink
From: kib <***@FreeBSD.org>

Reviewed by: alc
Discussed with: jhb
Tested by: markj, pho (previous version, as part of the bigger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
---
newlib/libc/sys/rtems/include/sys/mman.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index 6c757c8ba..a13e3d161 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -89,6 +89,7 @@
/*
* Extended flags
*/
+#define MAP_EXCL 0x00004000 /* for MAP_FIXED, fail if address is used */
#define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */
#define MAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */
#ifdef __LP64__
--
2.13.7
Sebastian Huber
2018-08-09 06:08:53 UTC
Permalink
From: kib <***@FreeBSD.org>

Do not allow implicit extension of the underlying memory segment past
the limit set by ftruncate(2) by either of the syscalls. Read and
write returns short i/o, lseek(2) fails with EINVAL when resulting
offset does not fit into the limit.

Discussed with: alc
Tested by: pho
Sponsored by: The FreeBSD Foundation
---
newlib/libc/sys/rtems/include/sys/mman.h | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index e7e5cf46b..536bfd562 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -190,6 +190,10 @@ typedef __size_t size_t;
#endif

#if defined(_KERNEL) || defined(_WANT_FILE)
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/queue.h>
+#include <sys/rangelock.h>
#include <vm/vm.h>

struct file;
@@ -215,6 +219,9 @@ struct shmfd {

struct label *shm_label; /* MAC label */
const char *shm_path;
+
+ struct rangelock shm_rl;
+ struct mtx shm_mtx;
};
#endif
--
2.13.7
Sebastian Huber
2018-08-09 06:08:54 UTC
Permalink
From: jhb <***@FreeBSD.org>

To facilitate this, add a new parameter to vm_map_find() that specifies an
optional maximum virtual address. While here, fix several callers of
vm_map_find() to use a VMFS_* constant for the findspace argument instead of
TRUE and FALSE.

Reviewed by: alc
Approved by: re (kib)
---
newlib/libc/sys/rtems/include/sys/mman.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index 536bfd562..6c757c8ba 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -91,6 +91,9 @@
*/
#define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */
#define MAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */
+#ifdef __LP64__
+#define MAP_32BIT 0x00080000 /* map in the low 2GB of address space */
+#endif

/*
* Request specific alignment (n == log2 of the desired alignment).
--
2.13.7
Sebastian Huber
2018-08-09 06:08:56 UTC
Permalink
From: jhb <***@FreeBSD.org>

Differential Revision: https://reviews.freebsd.org/D775
Reviewed by: kib, glebius (earlier version)
---
newlib/libc/sys/rtems/include/sys/mman.h | 1 -
1 file changed, 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index a13e3d161..f0e01b696 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -234,7 +234,6 @@ int shm_mmap(struct shmfd *shmfd, vm_size_t objsize, vm_ooffset_t foff,
vm_object_t *obj);
int shm_map(struct file *fp, size_t size, off_t offset, void **memp);
int shm_unmap(struct file *fp, void *mem, size_t size);
-void shm_path(struct shmfd *shmfd, char *path, size_t size);

#else /* !_KERNEL */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:04 UTC
Permalink
From: kib <***@FreeBSD.org>

Guard, requested by the MAP_GUARD mmap(2) flag, prevents the reuse of
the allocated address space, but does not allow instantiation of the
pages in the range. It is useful for more explicit support for usual
two-stage reserve then commit allocators, since it prevents accidental
instantiation of the mapping, e.g. by mprotect(2).

Use guards to reimplement stack grow code. Explicitely track stack
grow area with the guard, including the stack guard page. On stack
grow, trivial shift of the guard map entry and stack map entry limits
makes the stack expansion. Move the code to detect stack grow and
call vm_map_growstack(), from vm_fault() into vm_map_lookup().

As result, it is impossible to get random mapping to occur in the
stack grow area, or to overlap the stack guard page.

Enable stack guard page by default.

Reviewed by: alc, markj
Man page update reviewed by: alc, bjk, emaste, markj, pho
Tested by: pho, Qualys
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D11306 (man pages)
---
newlib/libc/sys/rtems/include/sys/mman.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index 8aeed87bc..c099e2242 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -90,6 +90,7 @@
/*
* Extended flags
*/
+#define MAP_GUARD 0x00002000 /* reserve but don't map address range */
#define MAP_EXCL 0x00004000 /* for MAP_FIXED, fail if address is used */
#define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */
#define MAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:22 UTC
Permalink
From: jeff <***@FreeBSD.org>

Add a new "interleave" allocation policy which stripes pages across
domains with a stride or width keeping contiguity within a multi-page
region.

Move the kernel to the dedicated numbered cpuset #2 making it possible
to assign kernel threads and memory policy separately from user. This
also eliminates the need for the complicated interrupt binding code.

Add a sysctl API for viewing and manipulating domainsets. Refactor some
of the cpuset_t manipulation code using the generic bitset type so that
it can be used for both. This probably belongs in a dedicated subr file.

Attempt to improve the include situation.

Reviewed by: kib
Discussed with: jhb (cpuset parts)
Tested by: pho (before review feedback)
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14839
---
newlib/libc/sys/rtems/include/sys/_bitset.h | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/sys/_bitset.h b/newlib/libc/sys/rtems/include/sys/_bitset.h
index df8dcab19..bf3f1bea2 100644
--- a/newlib/libc/sys/rtems/include/sys/_bitset.h
+++ b/newlib/libc/sys/rtems/include/sys/_bitset.h
@@ -57,4 +57,10 @@ struct t { \
*/
#define BITSET_DEFINE_VAR(t) BITSET_DEFINE(t, 1)

+/*
+ * Define a default type that can be used while manually specifying size
+ * to every call.
+ */
+BITSET_DEFINE(bitset, 1);
+
#endif /* !_SYS__BITSET_H_ */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:29 UTC
Permalink
From: rrs <***@FreeBSD.org>

Once built into your kernel, you can select this stack by either
socket option with the name of the stack is "rack" or by setting
the global sysctl so the default is rack.

Note that any connection that does not support SACK will be kicked
back to the "default" base FreeBSD stack (currently known as "default").

To build this into your kernel you will need to enable in your
kernel:
makeoptions WITH_EXTRA_TCP_STACKS=1
options TCPHPTS

Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D15525
---
newlib/libc/sys/rtems/include/netinet/tcp.h | 56 +++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/netinet/tcp.h b/newlib/libc/sys/rtems/include/netinet/tcp.h
index f599c9583..577308cda 100644
--- a/newlib/libc/sys/rtems/include/netinet/tcp.h
+++ b/newlib/libc/sys/rtems/include/netinet/tcp.h
@@ -176,6 +176,7 @@ struct tcphdr {
device */
#define TCP_CONGESTION 64 /* get/set congestion control algorithm */
#define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */
+#define TCP_DELACK 72 /* socket option for delayed ack */
#define TCP_KEEPINIT 128 /* N, time to establish connection */
#define TCP_KEEPIDLE 256 /* L,N,X start keeplives after this period */
#define TCP_KEEPINTVL 512 /* L,N interval between keepalives */
@@ -184,6 +185,61 @@ struct tcphdr {
#define TCP_PCAP_OUT 2048 /* number of output packets to keep */
#define TCP_PCAP_IN 4096 /* number of input packets to keep */
#define TCP_FUNCTION_BLK 8192 /* Set the tcp function pointers to the specified stack */
+/* Options for Rack and BBR */
+#define TCP_RACK_PROP 1051 /* RACK proportional rate reduction (bool) */
+#define TCP_RACK_TLP_REDUCE 1052 /* RACK TLP cwnd reduction (bool) */
+#define TCP_RACK_PACE_REDUCE 1053 /* RACK Pacing reduction factor (divisor) */
+#define TCP_RACK_PACE_MAX_SEG 1054 /* Max segments in a pace */
+#define TCP_RACK_PACE_ALWAYS 1055 /* Use the always pace method */
+#define TCP_RACK_PROP_RATE 1056 /* The proportional reduction rate */
+#define TCP_RACK_PRR_SENDALOT 1057 /* Allow PRR to send more than one seg */
+#define TCP_RACK_MIN_TO 1058 /* Minimum time between rack t-o's in ms */
+#define TCP_RACK_EARLY_RECOV 1059 /* Should recovery happen early (bool) */
+#define TCP_RACK_EARLY_SEG 1060 /* If early recovery max segments */
+#define TCP_RACK_REORD_THRESH 1061 /* RACK reorder threshold (shift amount) */
+#define TCP_RACK_REORD_FADE 1062 /* Does reordering fade after ms time */
+#define TCP_RACK_TLP_THRESH 1063 /* RACK TLP theshold i.e. srtt+(srtt/N) */
+#define TCP_RACK_PKT_DELAY 1064 /* RACK added ms i.e. rack-rtt + reord + N */
+#define TCP_RACK_TLP_INC_VAR 1065 /* Does TLP include rtt variance in t-o */
+#define TCP_RACK_SESS_CWV 1066 /* Enable RFC7611 cwnd validation on sess */
+#define TCP_BBR_IWINTSO 1067 /* Initial TSO window for BBRs first sends */
+#define TCP_BBR_RECFORCE 1068 /* Enter recovery force out a segment disregard pacer */
+#define TCP_BBR_STARTUP_PG 1069 /* Startup pacing gain */
+#define TCP_BBR_DRAIN_PG 1070 /* Drain pacing gain */
+#define TCP_BBR_RWND_IS_APP 1071 /* Rwnd limited is considered app limited */
+#define TCP_BBR_PROBE_RTT_INT 1072 /* How long in useconds between probe-rtt */
+#define TCP_BBR_ONE_RETRAN 1073 /* Is only one segment allowed out during retran */
+#define TCP_BBR_STARTUP_LOSS_EXIT 1074 /* Do we exit a loss during startup if not 20% incr */
+#define TCP_BBR_USE_LOWGAIN 1075 /* lower the gain in PROBE_BW enable */
+#define TCP_BBR_LOWGAIN_THRESH 1076 /* How many cycles do we stay in lowgain */
+#define TCP_BBR_LOWGAIN_HALF 1077 /* Do we halfstep lowgain down */
+#define TCP_BBR_LOWGAIN_FD 1078 /* Do we force a drain when lowgain in place */
+#define TCP_BBR_USEDEL_RATE 1079 /* Enable use of delivery rate for loss recovery */
+#define TCP_BBR_MIN_RTO 1080 /* Min RTO in milliseconds */
+#define TCP_BBR_MAX_RTO 1081 /* Max RTO in milliseconds */
+#define TCP_BBR_REC_OVER_HPTS 1082 /* Recovery override htps settings 0/1/3 */
+#define TCP_BBR_UNLIMITED 1083 /* Does BBR, in non-recovery not use cwnd */
+#define TCP_BBR_DRAIN_INC_EXTRA 1084 /* Does the 3/4 drain target include the extra gain */
+#define TCP_BBR_STARTUP_EXIT_EPOCH 1085 /* what epoch gets us out of startup */
+#define TCP_BBR_PACE_PER_SEC 1086
+#define TCP_BBR_PACE_DEL_TAR 1087
+#define TCP_BBR_PACE_SEG_MAX 1088
+#define TCP_BBR_PACE_SEG_MIN 1089
+#define TCP_BBR_PACE_CROSS 1090
+#define TCP_RACK_IDLE_REDUCE_HIGH 1092 /* Reduce the highest cwnd seen to IW on idle */
+#define TCP_RACK_IDLE_REDUCE_HIGH 1092 /* Reduce the highest cwnd seen to IW on idle */
+#define TCP_RACK_MIN_PACE 1093 /* Do we enforce rack min pace time */
+#define TCP_RACK_MIN_PACE_SEG 1094 /* If so what is the seg threshould */
+#define TCP_RACK_TLP_USE 1095
+#define TCP_BBR_ACK_COMP_ALG 1096 /* Not used */
+#define TCP_BBR_EXTRA_GAIN 1097
+#define TCP_BBR_RACK_RTT_USE 1098 /* what RTT should we use 0, 1, or 2? */
+#define TCP_BBR_RETRAN_WTSO 1099
+#define TCP_DATA_AFTER_CLOSE 1100
+#define TCP_BBR_PROBE_RTT_GAIN 1101
+#define TCP_BBR_PROBE_RTT_LEN 1102
+
+
/* Start of reserved space for third-party user-settable options. */
#define TCP_VENDOR SO_VENDOR
--
2.13.7
Eric Blake
2018-08-09 13:10:02 UTC
Permalink
Whoa, that's a long subject line.

In git, remember to put a blank line between your summary (which should
be around 60-70 characters) and the explanation. A much better subject
line would be:

tcp: add defines for use by Rack stack
Post by Sebastian Huber
Once built into your kernel, you can select this stack by either
socket option with the name of the stack is "rack" or by setting
the global sysctl so the default is rack.
Note that any connection that does not support SACK will be kicked
back to the "default" base FreeBSD stack (currently known as "default").
To build this into your kernel you will need to enable in your
makeoptions WITH_EXTRA_TCP_STACKS=1
options TCPHPTS
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D15525
---
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
Sebastian Huber
2018-08-09 13:11:46 UTC
Permalink
Post by Eric Blake
Whoa, that's a long subject line.
In git, remember to put a blank line between your summary (which
should be around 60-70 characters) and the explanation.  A much better
tcp: add defines for use by Rack stack
Sorry, I kept the FreeBSD commit messages as is. Most FreeBSD developers
try to write nice messages, but not all.
--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : ***@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
Sebastian Huber
2018-08-09 06:09:33 UTC
Permalink
This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <***@embedded-brains.de>
---
newlib/libc/sys/rtems/include/netinet6/in6.h | 170 ++-------------------------
1 file changed, 7 insertions(+), 163 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/netinet6/in6.h b/newlib/libc/sys/rtems/include/netinet6/in6.h
index 461d55795..ddf2207b8 100644
--- a/newlib/libc/sys/rtems/include/netinet6/in6.h
+++ b/newlib/libc/sys/rtems/include/netinet6/in6.h
@@ -103,11 +103,6 @@ struct in6_addr {
};

#define s6_addr __u6_addr.__u6_addr8
-#ifdef _KERNEL /* XXX nonstandard */
-#define s6_addr8 __u6_addr.__u6_addr8
-#define s6_addr16 __u6_addr.__u6_addr16
-#define s6_addr32 __u6_addr.__u6_addr32
-#endif

#define INET6_ADDRSTRLEN 46

@@ -132,56 +127,6 @@ struct sockaddr_in6 {
};

/*
- * Local definition for masks
- */
-#ifdef _KERNEL /* XXX nonstandard */
-#define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
-#define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
-#define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
-#define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
- 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
-#define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
-#endif
-
-#ifdef _KERNEL
-extern const struct sockaddr_in6 sa6_any;
-
-extern const struct in6_addr in6mask0;
-extern const struct in6_addr in6mask32;
-extern const struct in6_addr in6mask64;
-extern const struct in6_addr in6mask96;
-extern const struct in6_addr in6mask128;
-#endif /* _KERNEL */
-
-/*
- * Macros started with IPV6_ADDR is KAME local
- */
-#ifdef _KERNEL /* XXX nonstandard */
-#if _BYTE_ORDER == _BIG_ENDIAN
-#define IPV6_ADDR_INT32_ONE 1
-#define IPV6_ADDR_INT32_TWO 2
-#define IPV6_ADDR_INT32_MNL 0xff010000
-#define IPV6_ADDR_INT32_MLL 0xff020000
-#define IPV6_ADDR_INT32_SMP 0x0000ffff
-#define IPV6_ADDR_INT16_ULL 0xfe80
-#define IPV6_ADDR_INT16_USL 0xfec0
-#define IPV6_ADDR_INT16_MLL 0xff02
-#elif _BYTE_ORDER == _LITTLE_ENDIAN
-#define IPV6_ADDR_INT32_ONE 0x01000000
-#define IPV6_ADDR_INT32_TWO 0x02000000
-#define IPV6_ADDR_INT32_MNL 0x000001ff
-#define IPV6_ADDR_INT32_MLL 0x000002ff
-#define IPV6_ADDR_INT32_SMP 0xffff0000
-#define IPV6_ADDR_INT16_ULL 0x80fe
-#define IPV6_ADDR_INT16_USL 0xc0fe
-#define IPV6_ADDR_INT16_MLL 0x02ff
-#endif
-#endif
-
-/*
* Definition of some useful macros to handle IP6 addresses
*/
#if __BSD_VISIBLE
@@ -223,15 +168,10 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
* does not supply memcmp(). For userland memcmp() is preferred as it is
* in ANSI standard.
*/
-#ifdef _KERNEL
-#define IN6_ARE_ADDR_EQUAL(a, b) \
- (bcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
-#else
#if __BSD_VISIBLE
#define IN6_ARE_ADDR_EQUAL(a, b) \
(memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
#endif
-#endif

/*
* Unspecified
@@ -273,14 +213,7 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
* KAME Scope Values
*/

-#ifdef _KERNEL /* XXX nonstandard */
-#define IPV6_ADDR_SCOPE_NODELOCAL 0x01
-#define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
-#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02
-#define IPV6_ADDR_SCOPE_SITELOCAL 0x05
-#define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
-#define IPV6_ADDR_SCOPE_GLOBAL 0x0e
-#else
+#ifndef _KERNEL
#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01
#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02
@@ -303,35 +236,14 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
*/
#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)

-#ifdef _KERNEL /* XXX nonstandard */
-#define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
-#else
+#ifndef _KERNEL
#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
#endif

/*
* Multicast Scope
*/
-#ifdef _KERNEL /* refers nonstandard items */
-#define IN6_IS_ADDR_MC_NODELOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) && \
- (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
-#define IN6_IS_ADDR_MC_INTFACELOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) && \
- (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL))
-#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) && \
- (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
-#define IN6_IS_ADDR_MC_SITELOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) && \
- (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
-#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) && \
- (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
-#define IN6_IS_ADDR_MC_GLOBAL(a) \
- (IN6_IS_ADDR_MULTICAST(a) && \
- (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
-#else
+#ifndef _KERNEL
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
@@ -349,28 +261,6 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
#endif

-#ifdef _KERNEL /* nonstandard */
-/*
- * KAME Scope
- */
-#define IN6_IS_SCOPE_LINKLOCAL(a) \
- ((IN6_IS_ADDR_LINKLOCAL(a)) || \
- (IN6_IS_ADDR_MC_LINKLOCAL(a)))
-#define IN6_IS_SCOPE_EMBED(a) \
- ((IN6_IS_ADDR_LINKLOCAL(a)) || \
- (IN6_IS_ADDR_MC_LINKLOCAL(a)) || \
- (IN6_IS_ADDR_MC_INTFACELOCAL(a)))
-
-#define IFA6_IS_DEPRECATED(a) \
- ((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \
- (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \
- (a)->ia6_lifetime.ia6t_pltime)
-#define IFA6_IS_INVALID(a) \
- ((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \
- (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \
- (a)->ia6_lifetime.ia6t_vltime)
-#endif /* _KERNEL */
-
/*
* IP6 route structure
*/
@@ -391,11 +281,6 @@ struct route_in6 {
};
#endif

-#ifdef _KERNEL
-#define MTAG_ABI_IPV6 1444287380 /* IPv6 ABI */
-#define IPV6_TAG_DIRECT 0 /* direct-dispatch IPv6 */
-#endif /* _KERNEL */
-
/*
* Options for use with [gs]etsockopt at the IPV6 level.
* First word of comment is data type; bool is stored in int.
@@ -417,16 +302,6 @@ struct route_in6 {
#define IPV6_LEAVE_GROUP 13 /* ipv6_mreq; leave a group membership */
#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */
-/* RFC2292 options */
-#ifdef _KERNEL
-#define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */
-#define IPV6_2292HOPLIMIT 20 /* bool; hop limit */
-#define IPV6_2292NEXTHOP 21 /* bool; next hop addr */
-#define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */
-#define IPV6_2292DSTOPTS 23 /* bool; destinaion option */
-#define IPV6_2292RTHDR 24 /* bool; routing header */
-#define IPV6_2292PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */
-#endif

#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */
#define IPV6_V6ONLY 27 /* bool; make AF_INET6 sockets v6 only */
@@ -452,9 +327,6 @@ struct route_in6 {
#define IPV6_RECVRTHDR 38 /* bool; recv routing header */
#define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */
#define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */
-#ifdef _KERNEL
-#define IPV6_RECVRTHDRDSTOPTS 41 /* bool; recv dst option before rthdr */
-#endif

#define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */
#define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */
@@ -660,38 +532,6 @@ struct ip6_mtuinfo {
#define M_RTALERT_MLD M_PROTO8
#define M_FRAGMENTED M_PROTO9 /* contained fragment header */

-#ifdef _KERNEL
-struct cmsghdr;
-struct ip6_hdr;
-
-int in6_cksum_pseudo(struct ip6_hdr *, uint32_t, uint8_t, uint16_t);
-int in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t);
-int in6_cksum_partial(struct mbuf *, u_int8_t, u_int32_t, u_int32_t,
- u_int32_t);
-int in6_localaddr(struct in6_addr *);
-int in6_localip(struct in6_addr *);
-int in6_ifhasaddr(struct ifnet *, struct in6_addr *);
-int in6_addrscope(const struct in6_addr *);
-char *ip6_sprintf(char *, const struct in6_addr *);
-struct in6_ifaddr *in6_ifawithifp(struct ifnet *, struct in6_addr *);
-extern void in6_if_up(struct ifnet *);
-struct sockaddr;
-extern u_char ip6_protox[];
-
-void in6_sin6_2_sin(struct sockaddr_in *sin,
- struct sockaddr_in6 *sin6);
-void in6_sin_2_v4mapsin6(struct sockaddr_in *sin,
- struct sockaddr_in6 *sin6);
-void in6_sin6_2_sin_in_sock(struct sockaddr *nam);
-void in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam);
-extern void addrsel_policy_init(void);
-
-#define satosin6(sa) ((struct sockaddr_in6 *)(sa))
-#define sin6tosa(sin6) ((struct sockaddr *)(sin6))
-#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa))
-
-#endif /* _KERNEL */
-
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
@@ -748,4 +588,8 @@ __END_DECLS

#endif /* __BSD_VISIBLE */

+#ifdef _KERNEL
+/* Header file provided outside of Newlib */
+#include <machine/_kernel_in6.h>
+#endif
#endif /* !_NETINET6_IN6_H_ */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:06 UTC
Permalink
From: des <***@FreeBSD.org>

---
newlib/libc/sys/rtems/include/netinet/in.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/include/netinet/in.h b/newlib/libc/sys/rtems/include/netinet/in.h
index 1a3e752fe..390cf8cd3 100644
--- a/newlib/libc/sys/rtems/include/netinet/in.h
+++ b/newlib/libc/sys/rtems/include/netinet/in.h
@@ -289,7 +289,7 @@ __END_DECLS
* if you trust the remote host to restrict these ports.
*
* The default range of ports and the high range can be changed by
- * sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto)
+ * sysctl(3). (net.inet.ip.portrange.{hi,low,}{first,last})
*
* Changing those values has bad security implications if you are
* using a stateless firewall that is allowing packets outside of that
--
2.13.7
Sebastian Huber
2018-08-09 06:09:07 UTC
Permalink
From: sephe <***@FreeBSD.org>

It will be needed by hn(4) to configure its RSS key and hash
type/function in the transparent VF mode in order to match VF's
RSS settings. The description of the transparent VF mode and
the RSS hash value issue are here:
https://svnweb.freebsd.org/base?view=revision&revision=322299
https://svnweb.freebsd.org/base?view=revision&revision=322485

These are generic enough to promise two independent IOCs instead
of abusing SIOCGDRVSPEC.

Setting RSS key and hash type/function is a different story,
which probably requires more discussion.

Comment about UDP_{IPV4,IPV6,IPV6_EX} were only in the patch
in the review request; these hash types are standardized now.

Reviewed by: gallatin
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D12174
---
newlib/libc/sys/rtems/include/net/if.h | 36 ++++++++++++++++++++++++++++++
newlib/libc/sys/rtems/include/sys/sockio.h | 4 ++++
2 files changed, 40 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/net/if.h b/newlib/libc/sys/rtems/include/net/if.h
index a059e3f47..40f5095e2 100644
--- a/newlib/libc/sys/rtems/include/net/if.h
+++ b/newlib/libc/sys/rtems/include/net/if.h
@@ -526,6 +526,42 @@ struct ifi2creq {
uint8_t data[8]; /* read buffer */
};

+/*
+ * RSS hash.
+ */
+
+#define RSS_FUNC_NONE 0 /* RSS disabled */
+#define RSS_FUNC_PRIVATE 1 /* non-standard */
+#define RSS_FUNC_TOEPLITZ 2
+
+#define RSS_TYPE_IPV4 0x00000001
+#define RSS_TYPE_TCP_IPV4 0x00000002
+#define RSS_TYPE_IPV6 0x00000004
+#define RSS_TYPE_IPV6_EX 0x00000008
+#define RSS_TYPE_TCP_IPV6 0x00000010
+#define RSS_TYPE_TCP_IPV6_EX 0x00000020
+#define RSS_TYPE_UDP_IPV4 0x00000040
+#define RSS_TYPE_UDP_IPV6 0x00000080
+#define RSS_TYPE_UDP_IPV6_EX 0x00000100
+
+#define RSS_KEYLEN 128
+
+struct ifrsskey {
+ char ifrk_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ uint8_t ifrk_func; /* RSS_FUNC_ */
+ uint8_t ifrk_spare0;
+ uint16_t ifrk_keylen;
+ uint8_t ifrk_key[RSS_KEYLEN];
+};
+
+struct ifrsshash {
+ char ifrh_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ uint8_t ifrh_func; /* RSS_FUNC_ */
+ uint8_t ifrh_spare0;
+ uint16_t ifrh_spare1;
+ uint32_t ifrh_types; /* RSS_TYPE_ */
+};
+
#endif /* __BSD_VISIBLE */

#ifdef _KERNEL
diff --git a/newlib/libc/sys/rtems/include/sys/sockio.h b/newlib/libc/sys/rtems/include/sys/sockio.h
index 0fb01eebd..185e46cba 100644
--- a/newlib/libc/sys/rtems/include/sys/sockio.h
+++ b/newlib/libc/sys/rtems/include/sys/sockio.h
@@ -134,4 +134,8 @@
#define SIOCGIFGMEMB _IOWR('i', 138, struct ifgroupreq) /* get members */
#define SIOCGIFXMEDIA _IOWR('i', 139, struct ifmediareq) /* get net xmedia */

+#define SIOCGIFRSSKEY _IOWR('i', 150, struct ifrsskey)/* get RSS key */
+#define SIOCGIFRSSHASH _IOWR('i', 151, struct ifrsshash)/* get the current RSS
+ type/func settings */
+
#endif /* !_SYS_SOCKIO_H_ */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:03 UTC
Permalink
From: glebius <***@FreeBSD.org>

o Separate fields of struct socket that belong to listening from
fields that belong to normal dataflow, and unionize them. This
shrinks the structure a bit.
- Take out selinfo's from the socket buffers into the socket. The
first reason is to support braindamaged scenario when a socket is
added to kevent(2) and then listen(2) is cast on it. The second
reason is that there is future plan to make socket buffers pluggable,
so that for a dataflow socket a socket buffer can be changed, and
in this case we also want to keep same selinfos through the lifetime
of a socket.
- Remove struct struct so_accf. Since now listening stuff no longer
affects struct socket size, just move its fields into listening part
of the union.
- Provide sol_upcall field and enforce that so_upcall_set() may be called
only on a dataflow socket, which has buffers, and for listening sockets
provide solisten_upcall_set().

o Remove ACCEPT_LOCK() global.
- Add a mutex to socket, to be used instead of socket buffer lock to lock
fields of struct socket that don't belong to a socket buffer.
- Allow to acquire two socket locks, but the first one must belong to a
listening socket.
- Make soref()/sorele() to use atomic(9). This allows in some situations
to do soref() without owning socket lock. There is place for improvement
here, it is possible to make sorele() also to lock optionally.
- Most protocols aren't touched by this change, except UNIX local sockets.
See below for more information.

o Reduce copy-and-paste in kernel modules that accept connections from
listening sockets: provide function solisten_dequeue(), and use it in
the following modules: ctl(4), iscsi(4), ng_btsocket(4), ng_ksocket(4),
infiniband, rpc.

o UNIX local sockets.
- Removal of ACCEPT_LOCK() global uncovered several races in the UNIX
local sockets. Most races exist around spawning a new socket, when we
are connecting to a local listening socket. To cover them, we need to
hold locks on both PCBs when spawning a third one. This means holding
them across sonewconn(). This creates a LOR between pcb locks and
unp_list_lock.
- To fix the new LOR, abandon the global unp_list_lock in favor of global
unp_link_lock. Indeed, separating these two locks didn't provide us any
extra parralelism in the UNIX sockets.
- Now call into uipc_attach() may happen with unp_link_lock hold if, we
are accepting, or without unp_link_lock in case if we are just creating
a socket.
- Another problem in UNIX sockets is that uipc_close() basicly did nothing
for a listening socket. The vnode remained opened for connections. This
is fixed by removing vnode in uipc_close(). Maybe the right way would be
to do it for all sockets (not only listening), simply move the vnode
teardown from uipc_detach() to uipc_close()?

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D9770
---
newlib/libc/sys/rtems/include/sys/socket.h | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/sys/socket.h b/newlib/libc/sys/rtems/include/sys/socket.h
index cec6a2418..87d0f33e6 100644
--- a/newlib/libc/sys/rtems/include/sys/socket.h
+++ b/newlib/libc/sys/rtems/include/sys/socket.h
@@ -111,7 +111,15 @@ typedef __uintptr_t uintptr_t;
*/
#define SOCK_CLOEXEC 0x10000000
#define SOCK_NONBLOCK 0x20000000
-#endif
+#ifdef _KERNEL
+/*
+ * Flags for accept1(), kern_accept4() and solisten_dequeue, in addition
+ * to SOCK_CLOEXEC and SOCK_NONBLOCK.
+ */
+#define ACCEPT4_INHERIT 0x1
+#define ACCEPT4_COMPAT 0x2
+#endif /* _KERNEL */
+#endif /* __BSD_VISIBLE */

/*
* Option flags per-socket.
@@ -704,9 +712,5 @@ void so_sowwakeup(struct socket *so);
void so_lock(struct socket *so);
void so_unlock(struct socket *so);

-void so_listeners_apply_all(struct socket *so, void (*func)(struct socket *, void *), void *arg);
-
-#endif
-
-
+#endif /* _KERNEL */
#endif /* !_SYS_SOCKET_H_ */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:31 UTC
Permalink
The __XSI_VISIBLE is not enabled by default in Newlib. This is an
incompatiblity between FreeBSD and glibc.

Signed-off-by: Sebastian Huber <***@embedded-brains.de>
---
newlib/libc/sys/rtems/include/sys/_termios.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/sys/_termios.h b/newlib/libc/sys/rtems/include/sys/_termios.h
index 7c3bf53e0..38b52bf0e 100644
--- a/newlib/libc/sys/rtems/include/sys/_termios.h
+++ b/newlib/libc/sys/rtems/include/sys/_termios.h
@@ -93,7 +93,7 @@
#define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */
#define IXON 0x00000200 /* enable output flow control */
#define IXOFF 0x00000400 /* enable input flow control */
-#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
+#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
#define IXANY 0x00000800 /* any char will restart after stop */
#endif
#if __BSD_VISIBLE
@@ -104,7 +104,7 @@
* Output flags - software output processing
*/
#define OPOST 0x00000001 /* enable following output processing */
-#if __XSI_VISIBLE
+#if __BSD_VISIBLE || __XSI_VISIBLE
#define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */
#endif
#if __BSD_VISIBLE
@@ -113,7 +113,7 @@
#define TAB3 0x00000004 /* expand tabs to spaces */
#define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */
#endif
-#if __XSI_VISIBLE
+#if __BSD_VISIBLE || __XSI_VISIBLE
#define OCRNL 0x00000010 /* map CR to NL on output */
#define ONOCR 0x00000020 /* no CR output at column 0 */
#define ONLRET 0x00000040 /* NL performs CR function */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:36 UTC
Permalink
This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <***@embedded-brains.de>
---
newlib/libc/sys/rtems/include/sys/socket.h | 57 ++----------------------------
1 file changed, 3 insertions(+), 54 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/sys/socket.h b/newlib/libc/sys/rtems/include/sys/socket.h
index b73d4dd5c..dd9e43862 100644
--- a/newlib/libc/sys/rtems/include/sys/socket.h
+++ b/newlib/libc/sys/rtems/include/sys/socket.h
@@ -113,14 +113,6 @@ typedef __uintptr_t uintptr_t;
*/
#define SOCK_CLOEXEC 0x10000000
#define SOCK_NONBLOCK 0x20000000
-#ifdef _KERNEL
-/*
- * Flags for accept1(), kern_accept4() and solisten_dequeue, in addition
- * to SOCK_CLOEXEC and SOCK_NONBLOCK.
- */
-#define ACCEPT4_INHERIT 0x1
-#define ACCEPT4_COMPAT 0x2
-#endif /* _KERNEL */
#endif /* __BSD_VISIBLE */

/*
@@ -454,9 +446,6 @@ struct msghdr {
#define MSG_NBIO 0x00004000 /* FIONBIO mode, used by fifofs */
#define MSG_COMPAT 0x00008000 /* used in sendit() */
#endif
-#ifdef _KERNEL
-#define MSG_SOCALLBCK 0x00010000 /* for use by socket callbacks - soreceive (TCP) */
-#endif
#if __POSIX_VISIBLE >= 200809
#define MSG_NOSIGNAL 0x00020000 /* do not generate SIGPIPE on EOF */
#endif
@@ -464,9 +453,6 @@ struct msghdr {
#define MSG_CMSG_CLOEXEC 0x00040000 /* make received fds close-on-exec */
#define MSG_WAITFORONE 0x00080000 /* for recvmmsg() */
#endif
-#ifdef _KERNEL
-#define MSG_MORETOCOME 0x00100000 /* additional data pending */
-#endif

/*
* Header for ancillary data objects in msg_control buffer.
@@ -554,10 +540,6 @@ struct sockcred {
#define CMSG_LEN(l) (_ALIGN(sizeof(struct cmsghdr)) + (l))
#endif

-#ifdef _KERNEL
-#define CMSG_ALIGN(n) _ALIGN(n)
-#endif
-
/* "Socket"-level control message types: */
#define SCM_RIGHTS 0x01 /* access rights (array of int) */
#if __BSD_VISIBLE
@@ -638,10 +620,6 @@ struct sf_hdtr {
#define SF_NOCACHE 0x00000010
#define SF_FLAGS(rh, flags) (((rh) << 16) | (flags))

-#ifdef _KERNEL
-#define SF_READAHEAD(flags) ((flags) >> 16)
-#endif /* _KERNEL */
-
/*
* Sendmmsg/recvmmsg specific structure(s)
*/
@@ -695,36 +673,7 @@ __END_DECLS
#endif /* !_KERNEL */

#ifdef _KERNEL
-struct socket;
-
-struct tcpcb *so_sototcpcb(struct socket *so);
-struct inpcb *so_sotoinpcb(struct socket *so);
-struct sockbuf *so_sockbuf_snd(struct socket *);
-struct sockbuf *so_sockbuf_rcv(struct socket *);
-
-int so_state_get(const struct socket *);
-void so_state_set(struct socket *, int);
-
-int so_options_get(const struct socket *);
-void so_options_set(struct socket *, int);
-
-int so_error_get(const struct socket *);
-void so_error_set(struct socket *, int);
-
-int so_linger_get(const struct socket *);
-void so_linger_set(struct socket *, int);
-
-struct protosw *so_protosw_get(const struct socket *);
-void so_protosw_set(struct socket *, struct protosw *);
-
-void so_sorwakeup_locked(struct socket *so);
-void so_sowwakeup_locked(struct socket *so);
-
-void so_sorwakeup(struct socket *so);
-void so_sowwakeup(struct socket *so);
-
-void so_lock(struct socket *so);
-void so_unlock(struct socket *so);
-
-#endif /* _KERNEL */
+/* Header file provided outside of Newlib */
+#include <machine/_kernel_socket.h>
+#endif
#endif /* !_SYS_SOCKET_H_ */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:34 UTC
Permalink
This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <***@embedded-brains.de>
---
newlib/libc/sys/rtems/include/netinet/in.h | 30 ++++--------------------------
1 file changed, 4 insertions(+), 26 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/netinet/in.h b/newlib/libc/sys/rtems/include/netinet/in.h
index 1a431d1ab..11f32627f 100644
--- a/newlib/libc/sys/rtems/include/netinet/in.h
+++ b/newlib/libc/sys/rtems/include/netinet/in.h
@@ -640,32 +640,6 @@ int getsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,

#endif /* __BSD_VISIBLE */

-#ifdef _KERNEL
-
-struct ifnet; struct mbuf; /* forward declarations for Standard C */
-struct in_ifaddr;
-
-int in_broadcast(struct in_addr, struct ifnet *);
-int in_ifaddr_broadcast(struct in_addr, struct in_ifaddr *);
-int in_canforward(struct in_addr);
-int in_localaddr(struct in_addr);
-int in_localip(struct in_addr);
-int in_ifhasaddr(struct ifnet *, struct in_addr);
-int inet_aton(const char *, struct in_addr *); /* in libkern */
-char *inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */
-char *inet_ntop(int, const void *, char *, socklen_t); /* in libkern */
-int inet_pton(int af, const char *, void *); /* in libkern */
-void in_ifdetach(struct ifnet *);
-
-#define in_hosteq(s, t) ((s).s_addr == (t).s_addr)
-#define in_nullhost(x) ((x).s_addr == INADDR_ANY)
-#define in_allhosts(x) ((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP))
-
-#define satosin(sa) ((struct sockaddr_in *)(sa))
-#define sintosa(sin) ((struct sockaddr *)(sin))
-#define ifatoia(ifa) ((struct in_ifaddr *)(ifa))
-#endif /* _KERNEL */
-
/* INET6 stuff */
#if __POSIX_VISIBLE >= 200112
#define __KAME_NETINET_IN_H_INCLUDED_
@@ -673,4 +647,8 @@ void in_ifdetach(struct ifnet *);
#undef __KAME_NETINET_IN_H_INCLUDED_
#endif

+#ifdef _KERNEL
+/* Header file provided outside of Newlib */
+#include <machine/_kernel_in.h>
+#endif
#endif /* !_NETINET_IN_H_*/
--
2.13.7
Sebastian Huber
2018-08-09 06:09:35 UTC
Permalink
This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <***@embedded-brains.de>
---
newlib/libc/sys/rtems/include/net/if.h | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/net/if.h b/newlib/libc/sys/rtems/include/net/if.h
index b2e264176..54bb9094d 100644
--- a/newlib/libc/sys/rtems/include/net/if.h
+++ b/newlib/libc/sys/rtems/include/net/if.h
@@ -579,13 +579,6 @@ struct ifrsshash {

#endif /* __BSD_VISIBLE */

-#ifdef _KERNEL
-#ifdef MALLOC_DECLARE
-MALLOC_DECLARE(M_IFADDR);
-MALLOC_DECLARE(M_IFMADDR);
-#endif
-#endif
-
#ifndef _KERNEL
struct if_nameindex {
unsigned int if_index; /* 1, 2, ... */
@@ -599,4 +592,8 @@ struct if_nameindex *if_nameindex(void);
unsigned int if_nametoindex(const char *);
__END_DECLS
#endif
+#ifdef _KERNEL
+/* Header file provided outside of Newlib */
+#include <machine/_kernel_if.h>
+#endif
#endif /* !_NET_IF_H_ */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:30 UTC
Permalink
Signed-off-by: Sebastian Huber <***@embedded-brains.de>
---
newlib/libc/sys/rtems/include/arpa/inet.h | 2 +-
newlib/libc/sys/rtems/include/net/if.h | 2 +-
newlib/libc/sys/rtems/include/netdb.h | 2 +-
newlib/libc/sys/rtems/include/netinet/in.h | 2 +-
newlib/libc/sys/rtems/include/netinet/tcp.h | 2 +-
newlib/libc/sys/rtems/include/netinet6/in6.h | 2 +-
newlib/libc/sys/rtems/include/sys/_bitset.h | 2 +-
newlib/libc/sys/rtems/include/sys/_cpuset.h | 2 +-
newlib/libc/sys/rtems/include/sys/_iovec.h | 2 +-
newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h | 2 +-
newlib/libc/sys/rtems/include/sys/_termios.h | 2 +-
newlib/libc/sys/rtems/include/sys/_uio.h | 2 +-
newlib/libc/sys/rtems/include/sys/bitset.h | 2 +-
newlib/libc/sys/rtems/include/sys/filio.h | 2 +-
newlib/libc/sys/rtems/include/sys/ioctl.h | 2 +-
newlib/libc/sys/rtems/include/sys/mman.h | 2 +-
newlib/libc/sys/rtems/include/sys/socket.h | 2 +-
newlib/libc/sys/rtems/include/sys/sockio.h | 2 +-
newlib/libc/sys/rtems/include/sys/syslog.h | 2 +-
newlib/libc/sys/rtems/include/sys/ttycom.h | 2 +-
newlib/libc/sys/rtems/include/sys/ttydefaults.h | 2 +-
newlib/libc/sys/rtems/include/sys/uio.h | 2 +-
newlib/libc/sys/rtems/include/sys/un.h | 2 +-
newlib/libc/sys/rtems/include/termios.h | 2 +-
24 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/arpa/inet.h b/newlib/libc/sys/rtems/include/arpa/inet.h
index fdcb4c9b4..e54ea099b 100644
--- a/newlib/libc/sys/rtems/include/arpa/inet.h
+++ b/newlib/libc/sys/rtems/include/arpa/inet.h
@@ -54,7 +54,7 @@
/*%
* @(#)inet.h 8.1 (Berkeley) 6/2/93
* $Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp $
- * $FreeBSD: head/include/arpa/inet.h 269867 2014-08-12 12:36:06Z ume $
+ * $FreeBSD: head/include/arpa/inet.h 326695 2017-12-08 15:57:29Z pfg $
*/

#ifndef _ARPA_INET_H_
diff --git a/newlib/libc/sys/rtems/include/net/if.h b/newlib/libc/sys/rtems/include/net/if.h
index 0cd082f28..b2e264176 100644
--- a/newlib/libc/sys/rtems/include/net/if.h
+++ b/newlib/libc/sys/rtems/include/net/if.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)if.h 8.1 (Berkeley) 6/10/93
- * $FreeBSD: head/sys/net/if.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/sys/net/if.h 333502 2018-05-11 20:08:28Z mmacy $
*/

#ifndef _NET_IF_H_
diff --git a/newlib/libc/sys/rtems/include/netdb.h b/newlib/libc/sys/rtems/include/netdb.h
index 86d4938fb..3a42485aa 100644
--- a/newlib/libc/sys/rtems/include/netdb.h
+++ b/newlib/libc/sys/rtems/include/netdb.h
@@ -53,7 +53,7 @@
/*
* @(#)netdb.h 8.1 (Berkeley) 6/2/93
* From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $
- * $FreeBSD: head/include/netdb.h 303428 2016-07-28 10:05:41Z ed $
+ * $FreeBSD: head/include/netdb.h 326695 2017-12-08 15:57:29Z pfg $
*/

#ifndef _NETDB_H_
diff --git a/newlib/libc/sys/rtems/include/netinet/in.h b/newlib/libc/sys/rtems/include/netinet/in.h
index 479cb4f3a..1a431d1ab 100644
--- a/newlib/libc/sys/rtems/include/netinet/in.h
+++ b/newlib/libc/sys/rtems/include/netinet/in.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)in.h 8.3 (Berkeley) 1/3/94
- * $FreeBSD: head/sys/netinet/in.h 316715 2017-04-11 19:20:20Z ae $
+ * $FreeBSD: head/sys/netinet/in.h 326023 2017-11-20 19:43:44Z pfg $
*/

#ifndef _NETINET_IN_H_
diff --git a/newlib/libc/sys/rtems/include/netinet/tcp.h b/newlib/libc/sys/rtems/include/netinet/tcp.h
index 577308cda..c3ae655bd 100644
--- a/newlib/libc/sys/rtems/include/netinet/tcp.h
+++ b/newlib/libc/sys/rtems/include/netinet/tcp.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)tcp.h 8.1 (Berkeley) 6/10/93
- * $FreeBSD: head/sys/netinet/tcp.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/sys/netinet/tcp.h 334804 2018-06-07 18:18:13Z rrs $
*/

#ifndef _NETINET_TCP_H_
diff --git a/newlib/libc/sys/rtems/include/netinet6/in6.h b/newlib/libc/sys/rtems/include/netinet6/in6.h
index 37e1e93c0..461d55795 100644
--- a/newlib/libc/sys/rtems/include/netinet6/in6.h
+++ b/newlib/libc/sys/rtems/include/netinet6/in6.h
@@ -60,7 +60,7 @@
* SUCH DAMAGE.
*
* @(#)in.h 8.3 (Berkeley) 1/3/94
- * $FreeBSD: head/sys/netinet6/in6.h 314722 2017-03-06 04:01:58Z eri $
+ * $FreeBSD: head/sys/netinet6/in6.h 326876 2017-12-15 12:37:32Z ae $
*/

#ifndef __KAME_NETINET_IN_H_INCLUDED_
diff --git a/newlib/libc/sys/rtems/include/sys/_bitset.h b/newlib/libc/sys/rtems/include/sys/_bitset.h
index bf3f1bea2..007c4092b 100644
--- a/newlib/libc/sys/rtems/include/sys/_bitset.h
+++ b/newlib/libc/sys/rtems/include/sys/_bitset.h
@@ -28,7 +28,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: head/sys/sys/_bitset.h 299184 2016-05-06 16:41:23Z royger $
+ * $FreeBSD: head/sys/sys/_bitset.h 331723 2018-03-29 02:54:50Z jeff $
*/

#ifndef _SYS__BITSET_H_
diff --git a/newlib/libc/sys/rtems/include/sys/_cpuset.h b/newlib/libc/sys/rtems/include/sys/_cpuset.h
index 15936d997..83f654107 100644
--- a/newlib/libc/sys/rtems/include/sys/_cpuset.h
+++ b/newlib/libc/sys/rtems/include/sys/_cpuset.h
@@ -28,7 +28,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: head/sys/sys/_cpuset.h 299122 2016-05-05 15:43:26Z jhb $
+ * $FreeBSD: head/sys/sys/_cpuset.h 326256 2017-11-27 15:01:59Z pfg $
*/

#ifndef _SYS__CPUSET_H_
diff --git a/newlib/libc/sys/rtems/include/sys/_iovec.h b/newlib/libc/sys/rtems/include/sys/_iovec.h
index 31dd3c4cd..7170d2e7e 100644
--- a/newlib/libc/sys/rtems/include/sys/_iovec.h
+++ b/newlib/libc/sys/rtems/include/sys/_iovec.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)uio.h 8.5 (Berkeley) 2/22/94
- * $FreeBSD: head/sys/sys/_iovec.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/sys/sys/_iovec.h 326023 2017-11-20 19:43:44Z pfg $
*/

#ifndef _SYS__IOVEC_H_
diff --git a/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h b/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h
index 333136e3a..eec347d6a 100644
--- a/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h
+++ b/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)socket.h 8.4 (Berkeley) 2/21/94
- * $FreeBSD: head/sys/sys/_sockaddr_storage.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/sys/sys/_sockaddr_storage.h 326023 2017-11-20 19:43:44Z pfg $
*/

#ifndef _SYS__SOCKADDR_STORAGE_H_
diff --git a/newlib/libc/sys/rtems/include/sys/_termios.h b/newlib/libc/sys/rtems/include/sys/_termios.h
index 16928a813..7c3bf53e0 100644
--- a/newlib/libc/sys/rtems/include/sys/_termios.h
+++ b/newlib/libc/sys/rtems/include/sys/_termios.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)termios.h 8.3 (Berkeley) 3/28/94
- * $FreeBSD: head/sys/sys/_termios.h 318780 2017-05-24 09:25:13Z kib $
+ * $FreeBSD: head/sys/sys/_termios.h 326023 2017-11-20 19:43:44Z pfg $
*/

#ifndef _SYS__TERMIOS_H_
diff --git a/newlib/libc/sys/rtems/include/sys/_uio.h b/newlib/libc/sys/rtems/include/sys/_uio.h
index 18612ed73..6f22cd51b 100644
--- a/newlib/libc/sys/rtems/include/sys/_uio.h
+++ b/newlib/libc/sys/rtems/include/sys/_uio.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)uio.h 8.5 (Berkeley) 2/22/94
- * $FreeBSD$
+ * $FreeBSD: head/sys/sys/_uio.h 331621 2018-03-27 15:20:03Z brooks $
*/

#ifndef _SYS__UIO_H_
diff --git a/newlib/libc/sys/rtems/include/sys/bitset.h b/newlib/libc/sys/rtems/include/sys/bitset.h
index 2c55b600a..246cdbf7d 100644
--- a/newlib/libc/sys/rtems/include/sys/bitset.h
+++ b/newlib/libc/sys/rtems/include/sys/bitset.h
@@ -28,7 +28,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: head/sys/sys/bitset.h 320893 2017-07-11 12:35:44Z kib $
+ * $FreeBSD: head/sys/sys/bitset.h 326256 2017-11-27 15:01:59Z pfg $
*/

#ifndef _SYS_BITSET_H_
diff --git a/newlib/libc/sys/rtems/include/sys/filio.h b/newlib/libc/sys/rtems/include/sys/filio.h
index 60675fb50..b243a3e5d 100644
--- a/newlib/libc/sys/rtems/include/sys/filio.h
+++ b/newlib/libc/sys/rtems/include/sys/filio.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)filio.h 8.1 (Berkeley) 3/28/94
- * $FreeBSD: head/sys/sys/filio.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/sys/sys/filio.h 326023 2017-11-20 19:43:44Z pfg $
*/

#ifndef _SYS_FILIO_H_
diff --git a/newlib/libc/sys/rtems/include/sys/ioctl.h b/newlib/libc/sys/rtems/include/sys/ioctl.h
index f2217cfc1..4de7857cf 100644
--- a/newlib/libc/sys/rtems/include/sys/ioctl.h
+++ b/newlib/libc/sys/rtems/include/sys/ioctl.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)ioctl.h 8.6 (Berkeley) 3/28/94
- * $FreeBSD: head/sys/sys/ioctl.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/sys/sys/ioctl.h 326023 2017-11-20 19:43:44Z pfg $
*/

#ifndef _SYS_IOCTL_H_
diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index b2fad0e47..4996a66fc 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)mman.h 8.2 (Berkeley) 1/9/95
- * $FreeBSD$
+ * $FreeBSD: head/sys/sys/mman.h 326023 2017-11-20 19:43:44Z pfg $
*/

#ifndef _SYS_MMAN_H_
diff --git a/newlib/libc/sys/rtems/include/sys/socket.h b/newlib/libc/sys/rtems/include/sys/socket.h
index a1ffbbdcb..b73d4dd5c 100644
--- a/newlib/libc/sys/rtems/include/sys/socket.h
+++ b/newlib/libc/sys/rtems/include/sys/socket.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)socket.h 8.4 (Berkeley) 2/21/94
- * $FreeBSD: head/sys/sys/socket.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/sys/sys/socket.h 334719 2018-06-06 15:45:57Z sbruno $
*/

#ifndef _SYS_SOCKET_H_
diff --git a/newlib/libc/sys/rtems/include/sys/sockio.h b/newlib/libc/sys/rtems/include/sys/sockio.h
index 1ef52c456..786202a58 100644
--- a/newlib/libc/sys/rtems/include/sys/sockio.h
+++ b/newlib/libc/sys/rtems/include/sys/sockio.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)sockio.h 8.1 (Berkeley) 3/28/94
- * $FreeBSD: head/sys/sys/sockio.h 318160 2017-05-10 22:13:47Z rpokala $
+ * $FreeBSD: head/sys/sys/sockio.h 331622 2018-03-27 15:29:32Z kib $
*/

#ifndef _SYS_SOCKIO_H_
diff --git a/newlib/libc/sys/rtems/include/sys/syslog.h b/newlib/libc/sys/rtems/include/sys/syslog.h
index 7e4ac004a..4bd6c6b58 100644
--- a/newlib/libc/sys/rtems/include/sys/syslog.h
+++ b/newlib/libc/sys/rtems/include/sys/syslog.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)syslog.h 8.1 (Berkeley) 6/2/93
- * $FreeBSD: head/sys/sys/syslog.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/sys/sys/syslog.h 326023 2017-11-20 19:43:44Z pfg $
*/

#ifndef _SYS_SYSLOG_H_
diff --git a/newlib/libc/sys/rtems/include/sys/ttycom.h b/newlib/libc/sys/rtems/include/sys/ttycom.h
index 770985111..b5acbb91d 100644
--- a/newlib/libc/sys/rtems/include/sys/ttycom.h
+++ b/newlib/libc/sys/rtems/include/sys/ttycom.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)ttycom.h 8.1 (Berkeley) 3/28/94
- * $FreeBSD: head/sys/sys/ttycom.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/sys/sys/ttycom.h 326023 2017-11-20 19:43:44Z pfg $
*/

#ifndef _SYS_TTYCOM_H_
diff --git a/newlib/libc/sys/rtems/include/sys/ttydefaults.h b/newlib/libc/sys/rtems/include/sys/ttydefaults.h
index 63cca13b6..3516f4d65 100644
--- a/newlib/libc/sys/rtems/include/sys/ttydefaults.h
+++ b/newlib/libc/sys/rtems/include/sys/ttydefaults.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94
- * $FreeBSD: head/sys/sys/ttydefaults.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/sys/sys/ttydefaults.h 326023 2017-11-20 19:43:44Z pfg $
*/

/*
diff --git a/newlib/libc/sys/rtems/include/sys/uio.h b/newlib/libc/sys/rtems/include/sys/uio.h
index 60980a872..4aff08ead 100644
--- a/newlib/libc/sys/rtems/include/sys/uio.h
+++ b/newlib/libc/sys/rtems/include/sys/uio.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)uio.h 8.5 (Berkeley) 2/22/94
- * $FreeBSD: head/sys/sys/uio.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/sys/sys/uio.h 331621 2018-03-27 15:20:03Z brooks $
*/

#ifndef _SYS_UIO_H_
diff --git a/newlib/libc/sys/rtems/include/sys/un.h b/newlib/libc/sys/rtems/include/sys/un.h
index 976a81a63..4150ba581 100644
--- a/newlib/libc/sys/rtems/include/sys/un.h
+++ b/newlib/libc/sys/rtems/include/sys/un.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)un.h 8.3 (Berkeley) 2/19/95
- * $FreeBSD: head/sys/sys/un.h 314436 2017-02-28 23:42:47Z imp $
+ * $FreeBSD: head/sys/sys/un.h 326023 2017-11-20 19:43:44Z pfg $
*/

#ifndef _SYS_UN_H_
diff --git a/newlib/libc/sys/rtems/include/termios.h b/newlib/libc/sys/rtems/include/termios.h
index 5ada6cd31..a287cdd0e 100644
--- a/newlib/libc/sys/rtems/include/termios.h
+++ b/newlib/libc/sys/rtems/include/termios.h
@@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)termios.h 8.3 (Berkeley) 3/28/94
- * $FreeBSD: head/include/termios.h 318780 2017-05-24 09:25:13Z kib $
+ * $FreeBSD: head/include/termios.h 326024 2017-11-20 19:45:28Z pfg $
*/

#ifndef _TERMIOS_H_
--
2.13.7
Sebastian Huber
2018-08-09 06:09:20 UTC
Permalink
From: kib <***@FreeBSD.org>

According to 802.1Q-2014, VLAN tagged packets with VLAN id 0 should be
considered as untagged, and only PCP and DEI values from the VLAN tag
are meaningful. See for instance
https://www.cisco.com/c/en/us/td/docs/switches/connectedgrid/cg-switch-sw-master/software/configuration/guide/vlan0/b_vlan_0.html.

Make it possible to specify PCP value for outgoing packets on an
ethernet interface. When PCP is supplied, the tag is appended, VLAN
id set to 0, and PCP is filled by the supplied value. The code to do
VLAN tag encapsulation is refactored from the if_vlan.c and moved into
if_ethersubr.c.

Drivers might have issues with filtering VID 0 packets on
receive. This bug should be fixed for each driver.

Reviewed by: ae (previous version), hselasky, melifaro
Sponsored by: Mellanox Technologies
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D14702
---
newlib/libc/sys/rtems/include/net/if.h | 3 +++
newlib/libc/sys/rtems/include/sys/sockio.h | 3 +++
2 files changed, 6 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/net/if.h b/newlib/libc/sys/rtems/include/net/if.h
index b73c9f65f..d13e737fa 100644
--- a/newlib/libc/sys/rtems/include/net/if.h
+++ b/newlib/libc/sys/rtems/include/net/if.h
@@ -416,6 +416,7 @@ struct ifreq {
#define ifr_index ifr_ifru.ifru_index /* interface index */
#define ifr_fib ifr_ifru.ifru_fib /* interface fib */
#define ifr_vlan_pcp ifr_ifru.ifru_vlan_pcp /* VLAN priority */
+#define ifr_lan_pcp ifr_ifru.ifru_vlan_pcp /* VLAN priority */
};

#define _SIZEOF_ADDR_IFREQ(ifr) \
@@ -565,6 +566,8 @@ struct ifrsshash {
uint32_t ifrh_types; /* RSS_TYPE_ */
};

+#define IFNET_PCP_NONE 0xff /* PCP disabled */
+
#endif /* __BSD_VISIBLE */

#ifdef _KERNEL
diff --git a/newlib/libc/sys/rtems/include/sys/sockio.h b/newlib/libc/sys/rtems/include/sys/sockio.h
index a81a563a9..1ef52c456 100644
--- a/newlib/libc/sys/rtems/include/sys/sockio.h
+++ b/newlib/libc/sys/rtems/include/sys/sockio.h
@@ -140,4 +140,7 @@
#define SIOCGIFRSSHASH _IOWR('i', 151, struct ifrsshash)/* get the current RSS
type/func settings */

+#define SIOCGLANPCP _IOWR('i', 152, struct ifreq) /* Get (V)LAN PCP */
+#define SIOCSLANPCP _IOW('i', 153, struct ifreq) /* Set (V)LAN PCP */
+
#endif /* !_SYS_SOCKIO_H_ */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:23 UTC
Permalink
From: brooks <***@FreeBSD.org>

This fixes 32-bit compat (no ioctl command defintions are required
as struct ifreq is the same size). This is believed to be sufficent to
fully support ifconfig on 32-bit systems.

Reviewed by: kib
Obtained from: CheriBSD
MFC after: 1 week
Relnotes: yes
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14900
---
newlib/libc/sys/rtems/include/net/if.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/net/if.h b/newlib/libc/sys/rtems/include/net/if.h
index e9e639139..d88003bdd 100644
--- a/newlib/libc/sys/rtems/include/net/if.h
+++ b/newlib/libc/sys/rtems/include/net/if.h
@@ -412,7 +412,9 @@ struct ifreq {
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
#define ifr_phys ifr_ifru.ifru_phys /* physical wire */
#define ifr_media ifr_ifru.ifru_media /* physical media */
+#ifndef _KERNEL
#define ifr_data ifr_ifru.ifru_data /* for use by interface */
+#endif
#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */
#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */
#define ifr_index ifr_ifru.ifru_index /* interface index */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:27 UTC
Permalink
From: mmacy <***@FreeBSD.org>

Part 3 of many ...
The VPC framework relies heavily on cloning pseudo interfaces
(vmnics, vpc switch, vcpswitch port, hostif, vxlan if, etc).

This pulls in that piece. Some ancillary changes get pulled
in as a side effect.

Reviewed by: shurd@
Approved by: sbruno@
Sponsored by: Joyent, Inc.
Differential Revision: https://reviews.freebsd.org/D15347
---
newlib/libc/sys/rtems/include/net/if.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/net/if.h b/newlib/libc/sys/rtems/include/net/if.h
index 83a43284a..0cd082f28 100644
--- a/newlib/libc/sys/rtems/include/net/if.h
+++ b/newlib/libc/sys/rtems/include/net/if.h
@@ -162,6 +162,9 @@ struct if_data {
#define IFF_STATICARP 0x80000 /* (n) static ARP */
#define IFF_DYING 0x200000 /* (n) interface is winding down */
#define IFF_RENAMING 0x400000 /* (n) interface is being renamed */
+#define IFF_NOGROUP 0x800000 /* (n) interface is not part of any groups */
+
+
/*
* Old names for driver flags so that user space tools can continue to use
* the old (portable) names.
--
2.13.7
Sebastian Huber
2018-08-09 06:09:26 UTC
Permalink
From: sbruno <***@FreeBSD.org>

Submitted by: Johannes Lundberg <johalun0_gmail.com>
Sponsored by: Limelight Networks
---
newlib/libc/sys/rtems/include/sys/socket.h | 3 ---
1 file changed, 3 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/sys/socket.h b/newlib/libc/sys/rtems/include/sys/socket.h
index 19062c5ee..345eaa83f 100644
--- a/newlib/libc/sys/rtems/include/sys/socket.h
+++ b/newlib/libc/sys/rtems/include/sys/socket.h
@@ -147,9 +147,6 @@ typedef __uintptr_t uintptr_t;
#define SO_NO_OFFLOAD 0x4000 /* socket cannot be offloaded */
#define SO_NO_DDP 0x8000 /* disable direct data placement */

-// XXX: so_options was only 16 bit, now globally increased to 32 bit
-#define SO_REUSEPORT_LB 0x00010000 /* reuse with load balancing */
-
/*
* Additional options, not kept in so_options.
*/
--
2.13.7
Sebastian Huber
2018-08-09 06:09:32 UTC
Permalink
This helps to avoid Newlib updates due to FreeBSD kernel space changes.

Signed-off-by: Sebastian Huber <***@embedded-brains.de>
---
newlib/libc/sys/rtems/include/sys/uio.h | 60 ++++-----------------------------
1 file changed, 6 insertions(+), 54 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/sys/uio.h b/newlib/libc/sys/rtems/include/sys/uio.h
index 4aff08ead..38d5ba9df 100644
--- a/newlib/libc/sys/rtems/include/sys/uio.h
+++ b/newlib/libc/sys/rtems/include/sys/uio.h
@@ -50,59 +50,7 @@ typedef __off_t off_t;
#define _OFF_T_DECLARED
#endif

-#ifdef _KERNEL
-
-struct uio {
- struct iovec *uio_iov; /* scatter/gather list */
- int uio_iovcnt; /* length of scatter/gather list */
- off_t uio_offset; /* offset in target object */
- ssize_t uio_resid; /* remaining bytes to process */
- enum uio_seg uio_segflg; /* address space */
- enum uio_rw uio_rw; /* operation */
- struct thread *uio_td; /* owner */
-};
-
-/*
- * Limits
- *
- * N.B.: UIO_MAXIOV must be no less than IOV_MAX from <sys/syslimits.h>
- * which in turn must be no less than _XOPEN_IOV_MAX from <limits.h>. If
- * we ever make this tunable (probably pointless), then IOV_MAX should be
- * removed from <sys/syslimits.h> and applications would be expected to use
- * sysconf(3) to find out the correct value, or else assume the worst
- * (_XOPEN_IOV_MAX). Perhaps UIO_MAXIOV should be simply defined as
- * IOV_MAX.
- */
-#define UIO_MAXIOV 1024 /* max 1K of iov's */
-
-struct vm_object;
-struct vm_page;
-struct bus_dma_segment;
-
-struct uio *cloneuio(struct uio *uiop);
-int copyinfrom(const void * __restrict src, void * __restrict dst,
- size_t len, int seg);
-int copyiniov(const struct iovec *iovp, u_int iovcnt, struct iovec **iov,
- int error);
-int copyinstrfrom(const void * __restrict src, void * __restrict dst,
- size_t len, size_t * __restrict copied, int seg);
-int copyinuio(const struct iovec *iovp, u_int iovcnt, struct uio **uiop);
-int copyout_map(struct thread *td, vm_offset_t *addr, size_t sz);
-int copyout_unmap(struct thread *td, vm_offset_t addr, size_t sz);
-int physcopyin(void *src, vm_paddr_t dst, size_t len);
-int physcopyout(vm_paddr_t src, void *dst, size_t len);
-int physcopyin_vlist(struct bus_dma_segment *src, off_t offset,
- vm_paddr_t dst, size_t len);
-int physcopyout_vlist(vm_paddr_t src, struct bus_dma_segment *dst,
- off_t offset, size_t len);
-int uiomove(void *cp, int n, struct uio *uio);
-int uiomove_frombuf(void *buf, int buflen, struct uio *uio);
-int uiomove_fromphys(struct vm_page *ma[], vm_offset_t offset, int n,
- struct uio *uio);
-int uiomove_nofault(void *cp, int n, struct uio *uio);
-int uiomove_object(struct vm_object *obj, off_t obj_size, struct uio *uio);
-
-#else /* !_KERNEL */
+#ifndef _KERNEL

__BEGIN_DECLS
ssize_t readv(int, const struct iovec *, int);
@@ -113,6 +61,10 @@ ssize_t pwritev(int, const struct iovec *, int, off_t);
#endif
__END_DECLS

-#endif /* _KERNEL */
+#endif /* !_KERNEL */

+#ifdef _KERNEL
+/* Header file provided outside of Newlib */
+#include <machine/_kernel_uio.h>
+#endif
#endif /* !_SYS_UIO_H_ */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:25 UTC
Permalink
From: sbruno <***@FreeBSD.org>

This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple
programs or threads to bind to the same port and incoming connections will be
load balanced using a hash function.

Most of the code was copied from a similar patch for DragonflyBSD.

However, in DragonflyBSD, load balancing is a global on/off setting and can not
be set per socket. This patch allows for simultaneous use of both the current
SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system.

Required changes to structures
Globally change so_options from 16 to 32 bit value to allow for more options.
Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets.

Limitations
As DragonflyBSD, a load balance group is limited to 256 pcbs
(256 programs or threads sharing the same socket).

Submitted by: Johannes Lundberg <***@gmail.com>
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D11003
---
newlib/libc/sys/rtems/include/sys/socket.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/sys/socket.h b/newlib/libc/sys/rtems/include/sys/socket.h
index 345eaa83f..19062c5ee 100644
--- a/newlib/libc/sys/rtems/include/sys/socket.h
+++ b/newlib/libc/sys/rtems/include/sys/socket.h
@@ -147,6 +147,9 @@ typedef __uintptr_t uintptr_t;
#define SO_NO_OFFLOAD 0x4000 /* socket cannot be offloaded */
#define SO_NO_DDP 0x8000 /* disable direct data placement */

+// XXX: so_options was only 16 bit, now globally increased to 32 bit
+#define SO_REUSEPORT_LB 0x00010000 /* reuse with load balancing */
+
/*
* Additional options, not kept in so_options.
*/
--
2.13.7
Sebastian Huber
2018-08-09 06:09:28 UTC
Permalink
From: sbruno <***@FreeBSD.org>

This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple
programs or threads to bind to the same port and incoming connections will be
load balanced using a hash function.

Most of the code was copied from a similar patch for DragonflyBSD.

However, in DragonflyBSD, load balancing is a global on/off setting and can not
be set per socket. This patch allows for simultaneous use of both the current
SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system.

Required changes to structures:
Globally change so_options from 16 to 32 bit value to allow for more options.
Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets.

Limitations:
As DragonflyBSD, a load balance group is limited to 256 pcbs (256 programs or
threads sharing the same socket).

This is a substantially different contribution as compared to its original
incarnation at svn r332894 and reverted at svn r332967. Thanks to rwatson@
for the substantive feedback that is included in this commit.

Submitted by: Johannes Lundberg <***@gmail.com>
Obtained from: DragonflyBSD
Relnotes: Yes
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D11003
---
newlib/libc/sys/rtems/include/sys/socket.h | 35 +++++++++++++++---------------
1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/sys/socket.h b/newlib/libc/sys/rtems/include/sys/socket.h
index 345eaa83f..a1ffbbdcb 100644
--- a/newlib/libc/sys/rtems/include/sys/socket.h
+++ b/newlib/libc/sys/rtems/include/sys/socket.h
@@ -126,26 +126,27 @@ typedef __uintptr_t uintptr_t;
/*
* Option flags per-socket.
*/
-#define SO_DEBUG 0x0001 /* turn on debugging info recording */
-#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
-#define SO_REUSEADDR 0x0004 /* allow local address reuse */
-#define SO_KEEPALIVE 0x0008 /* keep connections alive */
-#define SO_DONTROUTE 0x0010 /* just use interface addresses */
-#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
+#define SO_DEBUG 0x00000001 /* turn on debugging info recording */
+#define SO_ACCEPTCONN 0x00000002 /* socket has had listen() */
+#define SO_REUSEADDR 0x00000004 /* allow local address reuse */
+#define SO_KEEPALIVE 0x00000008 /* keep connections alive */
+#define SO_DONTROUTE 0x00000010 /* just use interface addresses */
+#define SO_BROADCAST 0x00000020 /* permit sending of broadcast msgs */
#if __BSD_VISIBLE
-#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
+#define SO_USELOOPBACK 0x00000040 /* bypass hardware when possible */
#endif
-#define SO_LINGER 0x0080 /* linger on close if data present */
-#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
+#define SO_LINGER 0x00000080 /* linger on close if data present */
+#define SO_OOBINLINE 0x00000100 /* leave received OOB data in line */
#if __BSD_VISIBLE
-#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */
-#define SO_TIMESTAMP 0x0400 /* timestamp received dgram traffic */
-#define SO_NOSIGPIPE 0x0800 /* no SIGPIPE from EPIPE */
-#define SO_ACCEPTFILTER 0x1000 /* there is an accept filter */
-#define SO_BINTIME 0x2000 /* timestamp received dgram traffic */
-#endif
-#define SO_NO_OFFLOAD 0x4000 /* socket cannot be offloaded */
-#define SO_NO_DDP 0x8000 /* disable direct data placement */
+#define SO_REUSEPORT 0x00000200 /* allow local address & port reuse */
+#define SO_TIMESTAMP 0x00000400 /* timestamp received dgram traffic */
+#define SO_NOSIGPIPE 0x00000800 /* no SIGPIPE from EPIPE */
+#define SO_ACCEPTFILTER 0x00001000 /* there is an accept filter */
+#define SO_BINTIME 0x00002000 /* timestamp received dgram traffic */
+#endif
+#define SO_NO_OFFLOAD 0x00004000 /* socket cannot be offloaded */
+#define SO_NO_DDP 0x00008000 /* disable direct data placement */
+#define SO_REUSEPORT_LB 0x00010000 /* reuse with load balancing */

/*
* Additional options, not kept in so_options.
--
2.13.7
Sebastian Huber
2018-08-09 06:08:57 UTC
Permalink
From: jhb <***@FreeBSD.org>

PR: 193961 (exp-run in ports)
Differential Revision: https://reviews.freebsd.org/D848
Reviewed by: kib
---
newlib/libc/sys/rtems/include/sys/mman.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index f0e01b696..53b656ceb 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -69,8 +69,8 @@
#define MAP_FIXED 0x0010 /* map addr must be exactly as requested */

#if __BSD_VISIBLE
-#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */
-#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */
+#define MAP_RESERVED0020 0x0020 /* previously unimplemented MAP_RENAME */
+#define MAP_RESERVED0040 0x0040 /* previously unimplemented MAP_NORESERVE */
#define MAP_RESERVED0080 0x0080 /* previously misimplemented MAP_INHERIT */
#define MAP_RESERVED0100 0x0100 /* previously unimplemented MAP_NOEXTEND */
#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:24 UTC
Permalink
From: brooks <***@FreeBSD.org>

Use an accessor to access ifgr_group and ifgr_groups.

Use an macro CASE_IOC_IFGROUPREQ(cmd) in place of case statements such
as "case SIOCAIFGROUP:". This avoids poluting the switch statements
with large numbers of #ifdefs.

Reviewed by: kib
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14960
---
newlib/libc/sys/rtems/include/net/if.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/net/if.h b/newlib/libc/sys/rtems/include/net/if.h
index d88003bdd..83a43284a 100644
--- a/newlib/libc/sys/rtems/include/net/if.h
+++ b/newlib/libc/sys/rtems/include/net/if.h
@@ -517,8 +517,10 @@ struct ifgroupreq {
char ifgru_group[IFNAMSIZ];
struct ifg_req *ifgru_groups;
} ifgr_ifgru;
+#ifndef _KERNEL
#define ifgr_group ifgr_ifgru.ifgru_group
#define ifgr_groups ifgr_ifgru.ifgru_groups
+#endif
};

/*
--
2.13.7
Sebastian Huber
2018-08-09 06:09:01 UTC
Permalink
From: imp <***@FreeBSD.org>

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <***@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96
---
newlib/libc/sys/rtems/include/sys/mman.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index 0894555fa..8897acb32 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
--
2.13.7
Sebastian Huber
2018-08-09 06:09:21 UTC
Permalink
From: brooks <***@FreeBSD.org>

Make all kernel accesses to ifru_buffer go via access functions
which take the process ABI into account and use an appropriate union
to access members in the correct place in struct ifreq.

Reviewed by: kib
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14846
---
newlib/libc/sys/rtems/include/net/if.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/net/if.h b/newlib/libc/sys/rtems/include/net/if.h
index d13e737fa..e9e639139 100644
--- a/newlib/libc/sys/rtems/include/net/if.h
+++ b/newlib/libc/sys/rtems/include/net/if.h
@@ -402,7 +402,9 @@ struct ifreq {
#define ifr_addr ifr_ifru.ifru_addr /* address */
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
+#ifndef _KERNEL
#define ifr_buffer ifr_ifru.ifru_buffer /* user supplied buffer with its length */
+#endif
#define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */
#define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */
#define ifr_jid ifr_ifru.ifru_jid /* jail/vnet */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:17 UTC
Permalink
From: brooks <***@FreeBSD.org>

These macros take an existing ioctl(2) command and replace the length
with the specified length or length of the specified type respectively.
These can be used to define commands for 32-bit compatibility with fewer
opportunities for cut-and-paste errors then a whole new definition.

Reviewed by: cem, kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14706
---
newlib/libc/sys/rtems/include/sys/ioccom.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/sys/ioccom.h b/newlib/libc/sys/rtems/include/sys/ioccom.h
index 34ea1e16d..2a8416c41 100644
--- a/newlib/libc/sys/rtems/include/sys/ioccom.h
+++ b/newlib/libc/sys/rtems/include/sys/ioccom.h
@@ -68,6 +68,10 @@ typedef unsigned long ioctl_command_t;
#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
/* this should be _IORW, but stdio got there first */
#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
+/* Replace length/type in an ioctl command. */
+#define _IOC_NEWLEN(ioc, len) \
+ (((~(IOCPARM_MASK << 16)) & (ioc)) | (((len) & IOCPARM_MASK) << 16))
+#define _IOC_NEWTYPE(ioc, type) _IOC_NEWLEN((ioc), sizeof(type))

#ifdef _KERNEL
--
2.13.7
Sebastian Huber
2018-08-09 06:09:16 UTC
Permalink
From: pkelsey <***@FreeBSD.org>

The names of some existing fastopen sysctls have changed (e.g.,
net.inet.tcp.fastopen.enabled -> net.inet.tcp.fastopen.server_enable).

Reviewed by: tuexen
MFC after: 1 month
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14047
---
newlib/libc/sys/rtems/include/netinet/tcp.h | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/netinet/tcp.h b/newlib/libc/sys/rtems/include/netinet/tcp.h
index 7eb4e9afd..4c1c9d430 100644
--- a/newlib/libc/sys/rtems/include/netinet/tcp.h
+++ b/newlib/libc/sys/rtems/include/netinet/tcp.h
@@ -101,8 +101,6 @@ struct tcphdr {
#define TCPOLEN_SIGNATURE 18
#define TCPOPT_FAST_OPEN 34
#define TCPOLEN_FAST_OPEN_EMPTY 2
-#define TCPOLEN_FAST_OPEN_MIN 6
-#define TCPOLEN_FAST_OPEN_MAX 18

/* Miscellaneous constants */
#define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */
@@ -152,6 +150,10 @@ struct tcphdr {
#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */
#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr))
/* max space left for options */
+
+#define TCP_FASTOPEN_MIN_COOKIE_LEN 4 /* Per RFC7413 */
+#define TCP_FASTOPEN_MAX_COOKIE_LEN 16 /* Per RFC7413 */
+#define TCP_FASTOPEN_PSK_LEN 16 /* Same as TCP_FASTOPEN_KEY_LEN */
#endif /* __BSD_VISIBLE */

/*
@@ -252,6 +254,16 @@ struct tcp_info {
/* Padding to grow without breaking ABI. */
u_int32_t __tcpi_pad[26]; /* Padding. */
};
+
+/*
+ * If this structure is provided when setting the TCP_FASTOPEN socket
+ * option, and the enable member is non-zero, a subsequent connect will use
+ * pre-shared key (PSK) mode using the provided key.
+ */
+struct tcp_fastopen {
+ int enable;
+ uint8_t psk[TCP_FASTOPEN_PSK_LEN];
+};
#endif
#define TCP_FUNCTION_NAME_LEN_MAX 32
--
2.13.7
Sebastian Huber
2018-08-09 06:09:18 UTC
Permalink
From: jtl <***@FreeBSD.org>

The TCP Blackbox Recorder allows you to capture events on a TCP connection
in a ring buffer. It stores metadata with the event. It optionally stores
the TCP header associated with an event (if the event is associated with a
packet) and also optionally stores information on the sockets.

It supports setting a log ID on a TCP connection and using this to correlate
multiple connections that share a common log ID.

You can log connections in different modes. If you are doing a coordinated
test with a particular connection, you may tell the system to put it in
mode 4 (continuous dump). Or, if you just want to monitor for errors, you
can put it in mode 1 (ring buffer) and dump all the ring buffers associated
with the connection ID when we receive an error signal for that connection
ID. You can set a default mode that will be applied to a particular ratio
of incoming connections. You can also manually set a mode using a socket
option.

This commit includes only basic probes. rrs@ has added quite an abundance
of probes in his TCP development work. He plans to commit those soon.

There are user-space programs which we plan to commit as ports. These read
the data from the log device and output pcapng files, and then let you
analyze the data (and metadata) in the pcapng files.

Reviewed by: gnn (previous version)
Obtained from: Netflix, Inc.
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D11085
---
newlib/libc/sys/rtems/include/netinet/tcp.h | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/netinet/tcp.h b/newlib/libc/sys/rtems/include/netinet/tcp.h
index 4c1c9d430..f599c9583 100644
--- a/newlib/libc/sys/rtems/include/netinet/tcp.h
+++ b/newlib/libc/sys/rtems/include/netinet/tcp.h
@@ -168,6 +168,12 @@ struct tcphdr {
#define TCP_NOOPT 8 /* don't use TCP options */
#define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */
#define TCP_INFO 32 /* retrieve tcp_info structure */
+#define TCP_LOG 34 /* configure event logging for connection */
+#define TCP_LOGBUF 35 /* retrieve event log for connection */
+#define TCP_LOGID 36 /* configure log ID to correlate connections */
+#define TCP_LOGDUMP 37 /* dump connection log events to device */
+#define TCP_LOGDUMPID 38 /* dump events from connections with same ID to
+ device */
#define TCP_CONGESTION 64 /* get/set congestion control algorithm */
#define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */
#define TCP_KEEPINIT 128 /* N, time to establish connection */
@@ -189,6 +195,9 @@ struct tcphdr {
#define TCPI_OPT_ECN 0x08
#define TCPI_OPT_TOE 0x10

+/* Maximum length of log ID. */
+#define TCP_LOG_ID_LEN 64
+
/*
* The TCP_INFO socket option comes from the Linux 2.6 TCP API, and permits
* the caller to query certain information about the state of a TCP
--
2.13.7
Sebastian Huber
2018-08-09 06:09:19 UTC
Permalink
From: brooks <***@FreeBSD.org>

Include _uio.h instead of uio.h in several headers to reduce header
polution.

Fix a few places that relied on header polution to get the uio.h header.

I have not moved struct uio as many more things that use it rely on
header polution to get other definitions from uio.h.

Reviewed by: cem, kib, markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14811
---
newlib/libc/sys/rtems/include/sys/_uio.h | 52 ++++++++++++++++++++++++++++++++
newlib/libc/sys/rtems/include/sys/uio.h | 12 +-------
2 files changed, 53 insertions(+), 11 deletions(-)
create mode 100644 newlib/libc/sys/rtems/include/sys/_uio.h

diff --git a/newlib/libc/sys/rtems/include/sys/_uio.h b/newlib/libc/sys/rtems/include/sys/_uio.h
new file mode 100644
index 000000000..18612ed73
--- /dev/null
+++ b/newlib/libc/sys/rtems/include/sys/_uio.h
@@ -0,0 +1,52 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1982, 1986, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)uio.h 8.5 (Berkeley) 2/22/94
+ * $FreeBSD$
+ */
+
+#ifndef _SYS__UIO_H_
+#define _SYS__UIO_H_
+
+#if __BSD_VISIBLE
+enum uio_rw {
+ UIO_READ,
+ UIO_WRITE
+};
+
+/* Segment flag values. */
+enum uio_seg {
+ UIO_USERSPACE, /* from user data space */
+ UIO_SYSSPACE, /* from system space */
+ UIO_NOCOPY /* don't copy, already in object */
+};
+#endif /* __BSD_VISIBLE */
+
+#endif /* !_SYS__UIO_H_ */
diff --git a/newlib/libc/sys/rtems/include/sys/uio.h b/newlib/libc/sys/rtems/include/sys/uio.h
index 6d3c3cce2..60980a872 100644
--- a/newlib/libc/sys/rtems/include/sys/uio.h
+++ b/newlib/libc/sys/rtems/include/sys/uio.h
@@ -38,6 +38,7 @@
#include <sys/cdefs.h>
#include <sys/_types.h>
#include <sys/_iovec.h>
+#include <sys/_uio.h>

#ifndef _SSIZE_T_DECLARED
typedef __ssize_t ssize_t;
@@ -49,17 +50,6 @@ typedef __off_t off_t;
#define _OFF_T_DECLARED
#endif

-#if __BSD_VISIBLE
-enum uio_rw { UIO_READ, UIO_WRITE };
-
-/* Segment flag values. */
-enum uio_seg {
- UIO_USERSPACE, /* from user data space */
- UIO_SYSSPACE, /* from system space */
- UIO_NOCOPY /* don't copy, already in object */
-};
-#endif
-
#ifdef _KERNEL

struct uio {
--
2.13.7
Sebastian Huber
2018-08-09 06:09:15 UTC
Permalink
From: "***@FreeBSD.org" <***@FreeBSD.org>

Introduce M_FRAGMENTED mbuf flag, and set it after IPv6 fragment reassembly
is completed. Then check the presence of this flag in correspondig ND6
handling routines.

PR: 224247
MFC after: 2 weeks
---
newlib/libc/sys/rtems/include/netinet6/in6.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/newlib/libc/sys/rtems/include/netinet6/in6.h b/newlib/libc/sys/rtems/include/netinet6/in6.h
index 99ac803b8..37e1e93c0 100644
--- a/newlib/libc/sys/rtems/include/netinet6/in6.h
+++ b/newlib/libc/sys/rtems/include/netinet6/in6.h
@@ -658,6 +658,7 @@ struct ip6_mtuinfo {
#define M_LOOP M_PROTO6
#define M_AUTHIPDGM M_PROTO7
#define M_RTALERT_MLD M_PROTO8
+#define M_FRAGMENTED M_PROTO9 /* contained fragment header */

#ifdef _KERNEL
struct cmsghdr;
--
2.13.7
Sebastian Huber
2018-08-09 06:09:13 UTC
Permalink
From: glebius <***@FreeBSD.org>

---
newlib/libc/sys/rtems/include/net/if.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/include/net/if.h b/newlib/libc/sys/rtems/include/net/if.h
index 463bdf4a2..b73c9f65f 100644
--- a/newlib/libc/sys/rtems/include/net/if.h
+++ b/newlib/libc/sys/rtems/include/net/if.h
@@ -234,7 +234,7 @@ struct if_data {
#define IFCAP_TOE4 0x04000 /* interface can offload TCP */
#define IFCAP_TOE6 0x08000 /* interface can offload TCP6 */
#define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */
-#define IFCAP_POLLING_NOCOUNT 0x20000 /* polling ticks cannot be fragmented */
+/* available 0x20000 */
#define IFCAP_VLAN_HWTSO 0x40000 /* can do IFCAP_TSO on VLANs */
#define IFCAP_LINKSTATE 0x80000 /* the runtime link state is dynamic */
#define IFCAP_NETMAP 0x100000 /* netmap mode supported/enabled */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:14 UTC
Permalink
From: pfg <***@FreeBSD.org>

---
newlib/libc/sys/rtems/include/arpa/inet.h | 2 +-
newlib/libc/sys/rtems/include/netdb.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/arpa/inet.h b/newlib/libc/sys/rtems/include/arpa/inet.h
index 14cd24e36..fdcb4c9b4 100644
--- a/newlib/libc/sys/rtems/include/arpa/inet.h
+++ b/newlib/libc/sys/rtems/include/arpa/inet.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-License-Identifier: (BSD-3-Clause AND ISC)
*
* ++Copyright++ 1983, 1993
* -
diff --git a/newlib/libc/sys/rtems/include/netdb.h b/newlib/libc/sys/rtems/include/netdb.h
index 0e64a9c02..86d4938fb 100644
--- a/newlib/libc/sys/rtems/include/netdb.h
+++ b/newlib/libc/sys/rtems/include/netdb.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-License-Identifier: (BSD-3-Clause AND ISC)
*
* Copyright (c) 1980, 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
--
2.13.7
Sebastian Huber
2018-08-09 06:09:12 UTC
Permalink
From: pfg <***@FreeBSD.org>

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
---
newlib/libc/sys/rtems/include/sys/_bitset.h | 2 ++
newlib/libc/sys/rtems/include/sys/_cpuset.h | 2 ++
newlib/libc/sys/rtems/include/sys/bitset.h | 2 ++
3 files changed, 6 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/sys/_bitset.h b/newlib/libc/sys/rtems/include/sys/_bitset.h
index 8d8a4c220..df8dcab19 100644
--- a/newlib/libc/sys/rtems/include/sys/_bitset.h
+++ b/newlib/libc/sys/rtems/include/sys/_bitset.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2008, Jeffrey Roberson <***@freebsd.org>
* All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/sys/_cpuset.h b/newlib/libc/sys/rtems/include/sys/_cpuset.h
index dc4e61f9b..15936d997 100644
--- a/newlib/libc/sys/rtems/include/sys/_cpuset.h
+++ b/newlib/libc/sys/rtems/include/sys/_cpuset.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2008, Jeffrey Roberson <***@freebsd.org>
* All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/sys/bitset.h b/newlib/libc/sys/rtems/include/sys/bitset.h
index 931daf900..2c55b600a 100644
--- a/newlib/libc/sys/rtems/include/sys/bitset.h
+++ b/newlib/libc/sys/rtems/include/sys/bitset.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2008, Jeffrey Roberson <***@freebsd.org>
* All rights reserved.
*
--
2.13.7
Sebastian Huber
2018-08-09 06:09:10 UTC
Permalink
From: pfg <***@FreeBSD.org>

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
---
newlib/libc/sys/rtems/include/net/if.h | 2 ++
newlib/libc/sys/rtems/include/netinet/in.h | 2 ++
newlib/libc/sys/rtems/include/netinet/tcp.h | 2 ++
newlib/libc/sys/rtems/include/netinet6/in6.h | 2 ++
newlib/libc/sys/rtems/include/sys/_iovec.h | 2 ++
newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h | 2 ++
newlib/libc/sys/rtems/include/sys/_termios.h | 2 ++
newlib/libc/sys/rtems/include/sys/filio.h | 2 ++
newlib/libc/sys/rtems/include/sys/ioccom.h | 2 ++
newlib/libc/sys/rtems/include/sys/ioctl.h | 2 ++
newlib/libc/sys/rtems/include/sys/mman.h | 2 ++
newlib/libc/sys/rtems/include/sys/socket.h | 2 ++
newlib/libc/sys/rtems/include/sys/sockio.h | 2 ++
newlib/libc/sys/rtems/include/sys/syslog.h | 2 ++
newlib/libc/sys/rtems/include/sys/ttycom.h | 2 ++
newlib/libc/sys/rtems/include/sys/ttydefaults.h | 2 ++
newlib/libc/sys/rtems/include/sys/uio.h | 2 ++
newlib/libc/sys/rtems/include/sys/un.h | 2 ++
18 files changed, 36 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/net/if.h b/newlib/libc/sys/rtems/include/net/if.h
index 04f828e44..463bdf4a2 100644
--- a/newlib/libc/sys/rtems/include/net/if.h
+++ b/newlib/libc/sys/rtems/include/net/if.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/netinet/in.h b/newlib/libc/sys/rtems/include/netinet/in.h
index 390cf8cd3..479cb4f3a 100644
--- a/newlib/libc/sys/rtems/include/netinet/in.h
+++ b/newlib/libc/sys/rtems/include/netinet/in.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/netinet/tcp.h b/newlib/libc/sys/rtems/include/netinet/tcp.h
index 4fd597f36..7eb4e9afd 100644
--- a/newlib/libc/sys/rtems/include/netinet/tcp.h
+++ b/newlib/libc/sys/rtems/include/netinet/tcp.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/netinet6/in6.h b/newlib/libc/sys/rtems/include/netinet6/in6.h
index f9207e847..99ac803b8 100644
--- a/newlib/libc/sys/rtems/include/netinet6/in6.h
+++ b/newlib/libc/sys/rtems/include/netinet6/in6.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/sys/_iovec.h b/newlib/libc/sys/rtems/include/sys/_iovec.h
index 7f53bb220..31dd3c4cd 100644
--- a/newlib/libc/sys/rtems/include/sys/_iovec.h
+++ b/newlib/libc/sys/rtems/include/sys/_iovec.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h b/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h
index 97af76c4e..333136e3a 100644
--- a/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h
+++ b/newlib/libc/sys/rtems/include/sys/_sockaddr_storage.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/sys/_termios.h b/newlib/libc/sys/rtems/include/sys/_termios.h
index eb55bb377..16928a813 100644
--- a/newlib/libc/sys/rtems/include/sys/_termios.h
+++ b/newlib/libc/sys/rtems/include/sys/_termios.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1988, 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/sys/filio.h b/newlib/libc/sys/rtems/include/sys/filio.h
index 471235a88..60675fb50 100644
--- a/newlib/libc/sys/rtems/include/sys/filio.h
+++ b/newlib/libc/sys/rtems/include/sys/filio.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
diff --git a/newlib/libc/sys/rtems/include/sys/ioccom.h b/newlib/libc/sys/rtems/include/sys/ioccom.h
index 2c0e9ee71..34ea1e16d 100644
--- a/newlib/libc/sys/rtems/include/sys/ioccom.h
+++ b/newlib/libc/sys/rtems/include/sys/ioccom.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/sys/ioctl.h b/newlib/libc/sys/rtems/include/sys/ioctl.h
index 5eeeb049a..f2217cfc1 100644
--- a/newlib/libc/sys/rtems/include/sys/ioctl.h
+++ b/newlib/libc/sys/rtems/include/sys/ioctl.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index c099e2242..b2fad0e47 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/sys/socket.h b/newlib/libc/sys/rtems/include/sys/socket.h
index 7c42eb5ce..345eaa83f 100644
--- a/newlib/libc/sys/rtems/include/sys/socket.h
+++ b/newlib/libc/sys/rtems/include/sys/socket.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/sys/sockio.h b/newlib/libc/sys/rtems/include/sys/sockio.h
index 185e46cba..a81a563a9 100644
--- a/newlib/libc/sys/rtems/include/sys/sockio.h
+++ b/newlib/libc/sys/rtems/include/sys/sockio.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/sys/syslog.h b/newlib/libc/sys/rtems/include/sys/syslog.h
index 8a3738daa..7e4ac004a 100644
--- a/newlib/libc/sys/rtems/include/sys/syslog.h
+++ b/newlib/libc/sys/rtems/include/sys/syslog.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/sys/ttycom.h b/newlib/libc/sys/rtems/include/sys/ttycom.h
index dec86206c..770985111 100644
--- a/newlib/libc/sys/rtems/include/sys/ttycom.h
+++ b/newlib/libc/sys/rtems/include/sys/ttycom.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
diff --git a/newlib/libc/sys/rtems/include/sys/ttydefaults.h b/newlib/libc/sys/rtems/include/sys/ttydefaults.h
index 29464d03a..63cca13b6 100644
--- a/newlib/libc/sys/rtems/include/sys/ttydefaults.h
+++ b/newlib/libc/sys/rtems/include/sys/ttydefaults.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
diff --git a/newlib/libc/sys/rtems/include/sys/uio.h b/newlib/libc/sys/rtems/include/sys/uio.h
index a01492ade..6d3c3cce2 100644
--- a/newlib/libc/sys/rtems/include/sys/uio.h
+++ b/newlib/libc/sys/rtems/include/sys/uio.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/sys/un.h b/newlib/libc/sys/rtems/include/sys/un.h
index df6d78381..976a81a63 100644
--- a/newlib/libc/sys/rtems/include/sys/un.h
+++ b/newlib/libc/sys/rtems/include/sys/un.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
--
2.13.7
Sebastian Huber
2018-08-09 06:09:11 UTC
Permalink
From: pfg <***@FreeBSD.org>

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
---
newlib/libc/sys/rtems/include/arpa/inet.h | 4 +++-
newlib/libc/sys/rtems/include/netdb.h | 2 ++
newlib/libc/sys/rtems/include/termios.h | 2 ++
3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/include/arpa/inet.h b/newlib/libc/sys/rtems/include/arpa/inet.h
index 91e3a828a..14cd24e36 100644
--- a/newlib/libc/sys/rtems/include/arpa/inet.h
+++ b/newlib/libc/sys/rtems/include/arpa/inet.h
@@ -1,4 +1,6 @@
-/*
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* ++Copyright++ 1983, 1993
* -
* Copyright (c) 1983, 1993
diff --git a/newlib/libc/sys/rtems/include/netdb.h b/newlib/libc/sys/rtems/include/netdb.h
index ff7a7ab63..0e64a9c02 100644
--- a/newlib/libc/sys/rtems/include/netdb.h
+++ b/newlib/libc/sys/rtems/include/netdb.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1980, 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/newlib/libc/sys/rtems/include/termios.h b/newlib/libc/sys/rtems/include/termios.h
index 0e8918e3e..5ada6cd31 100644
--- a/newlib/libc/sys/rtems/include/termios.h
+++ b/newlib/libc/sys/rtems/include/termios.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
* Copyright (c) 1988, 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
--
2.13.7
Sebastian Huber
2018-08-09 06:09:02 UTC
Permalink
From: delphij <***@FreeBSD.org>

INHERIT_ZERO is an OpenBSD feature.

When a page is marked as such, it would be zeroed
upon fork().

This would be used in new arc4random(3) functions.

PR: 182610
Reviewed by: kib (earlier version)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D427
---
newlib/libc/sys/rtems/include/sys/mman.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index 8897acb32..8aeed87bc 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -43,6 +43,7 @@
#define INHERIT_SHARE 0
#define INHERIT_COPY 1
#define INHERIT_NONE 2
+#define INHERIT_ZERO 3
#endif

/*
--
2.13.7
Sebastian Huber
2018-08-09 06:09:05 UTC
Permalink
From: kib <***@FreeBSD.org>

They are defined by XSI or newer SUS.
This is a follow-up to r318780.

Reported by: jbeich
Obtained from: DragonflyBSD commit e08b3836c962
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
---
newlib/libc/sys/rtems/include/sys/_termios.h | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/sys/_termios.h b/newlib/libc/sys/rtems/include/sys/_termios.h
index 2fb401416..eb55bb377 100644
--- a/newlib/libc/sys/rtems/include/sys/_termios.h
+++ b/newlib/libc/sys/rtems/include/sys/_termios.h
@@ -91,8 +91,10 @@
#define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */
#define IXON 0x00000200 /* enable output flow control */
#define IXOFF 0x00000400 /* enable input flow control */
-#if __BSD_VISIBLE
+#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809
#define IXANY 0x00000800 /* any char will restart after stop */
+#endif
+#if __BSD_VISIBLE
#define IMAXBEL 0x00002000 /* ring bell on input queue full */
#endif

@@ -100,12 +102,16 @@
* Output flags - software output processing
*/
#define OPOST 0x00000001 /* enable following output processing */
-#if __BSD_VISIBLE
+#if __XSI_VISIBLE
#define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */
+#endif
+#if __BSD_VISIBLE
#define TABDLY 0x00000004 /* tab delay mask */
#define TAB0 0x00000000 /* no tab delay and expansion */
#define TAB3 0x00000004 /* expand tabs to spaces */
#define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */
+#endif
+#if __XSI_VISIBLE
#define OCRNL 0x00000010 /* map CR to NL on output */
#define ONOCR 0x00000020 /* no CR output at column 0 */
#define ONLRET 0x00000040 /* NL performs CR function */
--
2.13.7
Sebastian Huber
2018-08-09 06:09:08 UTC
Permalink
From: kib <***@FreeBSD.org>

The rcv_tstmp field overlaps the place of Ln header length indicators,
not used by received packets. The basic pkthdr rearrangement change
in sys/mbuf.h was provided by gallatin.

There are two accompanying M_ flags: M_TSTMP means that there is the
timestamp (and it was generated by hardware).

Another flag M_TSTMP_HPREC indicates that the timestamp is
high-precision. Practically M_TSTMP_HPREC means that hardware
provided additional precision comparing with the stamps when the flag
is not set. E.g., for ConnectX all packets are stamped by hardware
when PCIe transaction to write out the completion descriptor is
performed, but PTP packet are stamped on port. For Intel cards, when
PTP assist is enabled, only PTP packets are stamped in the limited
number of registers, so if Intel cards ever start support this
mechanism, they would always set M_TSTMP | M_TSTMP_HPREC if hardware
timestamp is present for the given packet.

Add IFCAP_HWRXTSTMP interface capability to indicate the support for
hardware rx timestamping, and ifconfig(8) command to toggle it.

Based on the patch by: gallatin
Reviewed by: gallatin (previous version), hselasky
Sponsored by: Mellanox Technologies
MFC after: 2 weeks (? mbuf KBI issue)
X-Differential revision: https://reviews.freebsd.org/D12638
---
newlib/libc/sys/rtems/include/net/if.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/newlib/libc/sys/rtems/include/net/if.h b/newlib/libc/sys/rtems/include/net/if.h
index 40f5095e2..04f828e44 100644
--- a/newlib/libc/sys/rtems/include/net/if.h
+++ b/newlib/libc/sys/rtems/include/net/if.h
@@ -240,6 +240,7 @@ struct if_data {
#define IFCAP_TXCSUM_IPV6 0x400000 /* can offload checksum on IPv6 TX */
#define IFCAP_HWSTATS 0x800000 /* manages counters internally */
#define IFCAP_TXRTLMT 0x1000000 /* hardware supports TX rate limiting */
+#define IFCAP_HWRXTSTMP 0x2000000 /* hardware rx timestamping */

#define IFCAP_HWCSUM_IPV6 (IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6)
--
2.13.7
Sebastian Huber
2018-08-09 06:08:58 UTC
Permalink
From: jhb <***@FreeBSD.org>

The vm_mmap() function is now split up into two functions. A new
vm_mmap_object() function handles the "back half" of vm_mmap() and accepts
a referenced VM object to map rather than a (handle, handle_type) tuple.
vm_mmap() is now reduced to converting a (handle, handle_type) tuple to a
a VM object and then calling vm_mmap_object() to handle the actual mapping.
The vm_mmap() function remains for use by other parts of the kernel
(e.g. device drivers and exec) but now only supports mapping vnodes,
character devices, and anonymous memory.

The mmap() system call invokes vm_mmap_object() directly with a NULL object
for anonymous mappings. For mappings using a file descriptor, the
descriptors fo_mmap() hook is invoked instead. The fo_mmap() hook is
responsible for performing type-specific checks and adjustments to
arguments as well as possibly modifying mapping parameters such as flags
or the object offset. The fo_mmap() hook routines then call
vm_mmap_object() to handle the actual mapping.

The fo_mmap() hook is optional. If it is not set, then fo_mmap() will
fail with ENODEV. A fo_mmap() hook is implemented for regular files,
character devices, and shared memory objects (created via shm_open()).

While here, consistently use the VM_PROT_* constants for the vm_prot_t
type for the 'prot' variable passed to vm_mmap() and vm_mmap_object()
as well as the vm_mmap_vnode() and vm_mmap_cdev() helper routines.
Previously some places were using the mmap()-specific PROT_* constants
instead. While this happens to work because PROT_xx == VM_PROT_xx,
using VM_PROT_* is more correct.

Differential Revision: https://reviews.freebsd.org/D2658
Reviewed by: alc (glanced over), kib
MFC after: 1 month
Sponsored by: Chelsio
---
newlib/libc/sys/rtems/include/sys/mman.h | 2 --
1 file changed, 2 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index 53b656ceb..19d992e83 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -230,8 +230,6 @@ struct shmfd {
#endif

#ifdef _KERNEL
-int shm_mmap(struct shmfd *shmfd, vm_size_t objsize, vm_ooffset_t foff,
- vm_object_t *obj);
int shm_map(struct file *fp, size_t size, off_t offset, void **memp);
int shm_unmap(struct file *fp, void *mem, size_t size);
--
2.13.7
Sebastian Huber
2018-08-09 06:09:09 UTC
Permalink
From: kib <***@FreeBSD.org>

Provide new control message SCM_TIME_INFO to supply information about
timestamp. Currently it indicates that the timestamp was
hardware-assisted and high-precision, for software timestamps the
message is not returned. Reserved fields are added to ABI to report
additional info about it, it is expected that raw hardware clock value
might be useful for some applications.

Reviewed by: gallatin (previous version), hselasky
Sponsored by: Mellanox Technologies
MFC after: 2 weeks
X-Differential revision: https://reviews.freebsd.org/D12638
---
newlib/libc/sys/rtems/include/sys/socket.h | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/sys/socket.h b/newlib/libc/sys/rtems/include/sys/socket.h
index 87d0f33e6..7c42eb5ce 100644
--- a/newlib/libc/sys/rtems/include/sys/socket.h
+++ b/newlib/libc/sys/rtems/include/sys/socket.h
@@ -563,6 +563,17 @@ struct sockcred {
#define SCM_BINTIME 0x04 /* timestamp (struct bintime) */
#define SCM_REALTIME 0x05 /* timestamp (struct timespec) */
#define SCM_MONOTONIC 0x06 /* timestamp (struct timespec) */
+#define SCM_TIME_INFO 0x07 /* timestamp info */
+
+struct sock_timestamp_info {
+ __uint32_t st_info_flags;
+ __uint32_t st_info_pad0;
+ __uint64_t st_info_rsv[7];
+};
+
+#define ST_INFO_HW 0x0001 /* SCM_TIMESTAMP was hw */
+#define ST_INFO_HW_HPREC 0x0002 /* SCM_TIMESTAMP was hw-assisted
+ on entrance */
#endif

#if __BSD_VISIBLE
--
2.13.7
Sebastian Huber
2018-08-09 06:08:59 UTC
Permalink
From: kib <***@FreeBSD.org>

Reviewed by: vangyzen (previous version)
Discussed with: deischen, emaste, jhb, rwatson,
Martin Simmons <***@lispworks.com>
Tested by: pho
Sponsored by: The FreeBSD Foundation
---
newlib/libc/sys/rtems/include/sys/mman.h | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index 19d992e83..1fce96074 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -233,6 +233,13 @@ struct shmfd {
int shm_map(struct file *fp, size_t size, off_t offset, void **memp);
int shm_unmap(struct file *fp, void *mem, size_t size);

+int shm_access(struct shmfd *shmfd, struct ucred *ucred, int flags);
+struct shmfd *shm_alloc(struct ucred *ucred, mode_t mode);
+struct shmfd *shm_hold(struct shmfd *shmfd);
+void shm_drop(struct shmfd *shmfd);
+int shm_dotruncate(struct shmfd *shmfd, off_t length);
+
+extern struct fileops shm_ops;
#else /* !_KERNEL */

__BEGIN_DECLS
--
2.13.7
Sebastian Huber
2018-08-09 06:09:00 UTC
Permalink
From: "***@FreeBSD.org" <***@FreeBSD.org>

Our mprotect() function seems to take a "const void *" address to the
pages whose permissions need to be adjusted. POSIX uses "void *". Simply
stick to the POSIX one to prevent us from writing unportable code.

PR: 211423 (exp-run)
Tested by: antoine@ (Thanks!)
---
newlib/libc/sys/rtems/include/sys/mman.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index 1fce96074..0894555fa 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -258,7 +258,7 @@ int mlock(const void *, size_t);
#define _MMAP_DECLARED
void * mmap(void *, size_t, int, int, int, off_t);
#endif
-int mprotect(const void *, size_t, int);
+int mprotect(void *, size_t, int);
int msync(void *, size_t, int);
int munlock(const void *, size_t);
int munmap(void *, size_t);
--
2.13.7
Eric Blake
2018-08-09 13:12:09 UTC
Permalink
This is an RTEMS-specific patch set. It is a preparation to update the libbsd
(a port of FreeBSD code to RTEMS, e.g. the network stack) to new FreeBSD
baseline.
1. It updates several header files imported from FreeBSD using the commits from
FreeBSD.
2. It removes the kernel space content from some files and includes a
<machine/_kernel_*.h> file instead. This allows to use the Newlib provided
header files with different FreeBSD baselines.
Follow the RFC6980 and silently ignore following IPv6 NDP messages
that had the IPv6 fragmentation header: o Neighbor Solicitation o
Neighbor Advertisement o Router Solicitation o Router Advertisement
o Redirect
...
Garbage collect IFCAP_POLLING_NOCOUNT. It wasn't used since very
beginning of polling(4). The module always ignored return value from
driver polling handler.
Add a mmap flag (MAP_32BIT) on 64-bit platforms to request that a
mapping use an address in the first 2GB of the process's address
space. This flag should have the same semantics as the same flag on
Linux.
Add a new fo_fill_kinfo fileops method to add type-specific
information to struct kinfo_file. - Move the various fill_*_info()
methods out of kern_descrip.c and into the various file type
implementations. - Rework the support for kinfo_ofile to generate a
suitable kinfo_file object for each file and then convert that to a
kinfo_ofile structure rather than keeping a second, different set of
code that directly manipulates type-specific file information. -
Remove the shm_path() and ksem_info() layering violations.
Retire the unimplemented MAP_RENAME and MAP_NORESERVE flags to
mmap(2). Older binaries are still permitted to use these flags.
Add a new file operations hook for mmap operations. File type-specific
logic is now placed in the mmap hook implementation rather than
requiring it to be placed in sys/vm/vm_mmap.c. This hook allows new
file types to support mmap() as well as potentially allowing mmap()
for existing file types that do not currently support any mapping.
Add the "TCP Blackbox Recorder" which we discussed at the developer
summits at BSDCan and BSDCam in 2017.
Implement read(2)/write(2) and neccessary lseek(2) for posix shmfd.
Add MAC framework entries for posix shm read and write.
Add MAP_EXCL flag for mmap(2). It should be combined with MAP_FIXED,
and prevents the request from deleting existing mappings in the
region, failing instead.
Implement process-shared locks support for libthr.so.3, without
breaking the ABI. Special value is stored in the lock pointer to
indicate shared lock, and offline page in the shared memory is
allocated to store the actual lock.
...
Add a place for a driver to report rx timestamps in nanoseconds from
boot for the received packets.
Use hardware timestamps to report packet timestamps for SO_TIMESTAMP
and other similar socket options.
This is an implementation of the client side of TCP Fast Open (TFO)
[RFC7413]. It also includes a pre-shared key mode of operation in
which the server requires the client to be in possession of a shared
secret in order to successfully open TFO connections with that
server.
This commit brings in a new refactored TCP stack called Rack. Rack
includes the following features: - A different SACK processing
scheme (the old sack structures are not used). - RACK (Recent
acknowledgment) where counting dup-acks is no longer done instead
time is used to knwo when to retransmit. (see the I-D) - TLP (Tail
Loss Probe) where we will probe for tail-losses to attempt to try
not to take a retransmit time-out. (see the I-D) - Burst mitigation
using TCPHTPS - PRR (partial rate reduction) see the RFC.
Please reformat the commit messages to have a SHORT summary (60-70
characters), then a blank line, then the rest of the description, rather
than diving right in to description that git then uses as the overlong
subject line.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
Sebastian Huber
2018-08-09 13:13:23 UTC
Permalink
Post by Eric Blake
This is an RTEMS-specific patch set. It is a preparation to update the libbsd
(a port of FreeBSD code to RTEMS, e.g. the network stack) to new FreeBSD
baseline.
1. It updates several header files imported from FreeBSD using the commits from
    FreeBSD.
2. It removes the kernel space content from some files and includes a
    <machine/_kernel_*.h> file instead.  This allows to use the
Newlib provided
    header files with different FreeBSD baselines.
   Follow the RFC6980 and silently ignore following IPv6 NDP messages
     that had the IPv6 fragmentation header: o Neighbor Solicitation o
     Neighbor Advertisement o Router Solicitation o Router Advertisement
     o Redirect
...
   Garbage collect IFCAP_POLLING_NOCOUNT. It wasn't used since very
     beginning of polling(4). The module always ignored return value
from
     driver polling handler.
   Add a mmap flag (MAP_32BIT) on 64-bit platforms to request that a
     mapping use an address in the first 2GB of the process's address
     space. This flag should have the same semantics as the same flag on
     Linux.
   Add a new fo_fill_kinfo fileops method to add type-specific
     information to struct kinfo_file. - Move the various fill_*_info()
     methods out of kern_descrip.c and into the various file type
     implementations. - Rework the support for kinfo_ofile to generate a
     suitable kinfo_file object for each file and then convert that to a
     kinfo_ofile structure rather than keeping a second, different
set of
     code that directly manipulates type-specific file information. -
     Remove the shm_path() and ksem_info() layering violations.
   Retire the unimplemented MAP_RENAME and MAP_NORESERVE flags to
     mmap(2). Older binaries are still permitted to use these flags.
   Add a new file operations hook for mmap operations. File
type-specific
     logic is now placed in the mmap hook implementation rather than
     requiring it to be placed in sys/vm/vm_mmap.c. This hook allows new
     file types to support mmap() as well as potentially allowing mmap()
     for existing file types that do not currently support any mapping.
   Add the "TCP Blackbox Recorder" which we discussed at the developer
     summits at BSDCan and BSDCam in 2017.
   Implement read(2)/write(2) and neccessary lseek(2) for posix shmfd.
     Add MAC framework entries for posix shm read and write.
   Add MAP_EXCL flag for mmap(2). It should be combined with MAP_FIXED,
     and prevents the request from deleting existing mappings in the
     region, failing instead.
   Implement process-shared locks support for libthr.so.3, without
     breaking the ABI. Special value is stored in the lock pointer to
     indicate shared lock, and offline page in the shared memory is
     allocated to store the actual lock.
...
   Add a place for a driver to report rx timestamps in nanoseconds from
     boot for the received packets.
   Use hardware timestamps to report packet timestamps for SO_TIMESTAMP
     and other similar socket options.
   This is an implementation of the client side of TCP Fast Open (TFO)
     [RFC7413]. It also includes a pre-shared key mode of operation in
     which the server requires the client to be in possession of a
shared
     secret in order to successfully open TFO connections with that
     server.
   This commit brings in a new refactored TCP stack called Rack. Rack
     includes the following features: - A different SACK processing
     scheme (the old sack structures are not used). - RACK (Recent
     acknowledgment) where counting dup-acks is no longer done instead
     time is used to knwo when to retransmit. (see the I-D) - TLP (Tail
     Loss Probe) where we will probe for tail-losses to attempt to try
     not to take a retransmit time-out. (see the I-D) - Burst mitigation
     using TCPHTPS - PRR (partial rate reduction) see the RFC.
Please reformat the commit messages to have a SHORT summary (60-70
characters), then a blank line, then the rest of the description,
rather than diving right in to description that git then uses as the
overlong subject line.
I would like to keep the messages as is. This makes it easier to compare
upstream FreeBSD changes with changes imported to Newlib.
--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : ***@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
Gedare Bloom
2018-08-09 16:46:35 UTC
Permalink
On Thu, Aug 9, 2018 at 9:13 AM, Sebastian Huber
Post by Sebastian Huber
Post by Eric Blake
This is an RTEMS-specific patch set. It is a preparation to update the libbsd
(a port of FreeBSD code to RTEMS, e.g. the network stack) to new FreeBSD
baseline.
1. It updates several header files imported from FreeBSD using the commits from
FreeBSD.
2. It removes the kernel space content from some files and includes a
<machine/_kernel_*.h> file instead. This allows to use the Newlib provided
header files with different FreeBSD baselines.
Follow the RFC6980 and silently ignore following IPv6 NDP messages
that had the IPv6 fragmentation header: o Neighbor Solicitation o
Neighbor Advertisement o Router Solicitation o Router Advertisement
o Redirect
...
Garbage collect IFCAP_POLLING_NOCOUNT. It wasn't used since very
beginning of polling(4). The module always ignored return value from
driver polling handler.
Add a mmap flag (MAP_32BIT) on 64-bit platforms to request that a
mapping use an address in the first 2GB of the process's address
space. This flag should have the same semantics as the same flag on
Linux.
Add a new fo_fill_kinfo fileops method to add type-specific
information to struct kinfo_file. - Move the various fill_*_info()
methods out of kern_descrip.c and into the various file type
implementations. - Rework the support for kinfo_ofile to generate a
suitable kinfo_file object for each file and then convert that to a
kinfo_ofile structure rather than keeping a second, different set of
code that directly manipulates type-specific file information. -
Remove the shm_path() and ksem_info() layering violations.
Retire the unimplemented MAP_RENAME and MAP_NORESERVE flags to
mmap(2). Older binaries are still permitted to use these flags.
Add a new file operations hook for mmap operations. File type-specific
logic is now placed in the mmap hook implementation rather than
requiring it to be placed in sys/vm/vm_mmap.c. This hook allows new
file types to support mmap() as well as potentially allowing mmap()
for existing file types that do not currently support any mapping.
Add the "TCP Blackbox Recorder" which we discussed at the developer
summits at BSDCan and BSDCam in 2017.
Implement read(2)/write(2) and neccessary lseek(2) for posix shmfd.
Add MAC framework entries for posix shm read and write.
Add MAP_EXCL flag for mmap(2). It should be combined with MAP_FIXED,
and prevents the request from deleting existing mappings in the
region, failing instead.
Implement process-shared locks support for libthr.so.3, without
breaking the ABI. Special value is stored in the lock pointer to
indicate shared lock, and offline page in the shared memory is
allocated to store the actual lock.
...
Add a place for a driver to report rx timestamps in nanoseconds from
boot for the received packets.
Use hardware timestamps to report packet timestamps for SO_TIMESTAMP
and other similar socket options.
This is an implementation of the client side of TCP Fast Open (TFO)
[RFC7413]. It also includes a pre-shared key mode of operation in
which the server requires the client to be in possession of a shared
secret in order to successfully open TFO connections with that
server.
This commit brings in a new refactored TCP stack called Rack. Rack
includes the following features: - A different SACK processing
scheme (the old sack structures are not used). - RACK (Recent
acknowledgment) where counting dup-acks is no longer done instead
time is used to knwo when to retransmit. (see the I-D) - TLP (Tail
Loss Probe) where we will probe for tail-losses to attempt to try
not to take a retransmit time-out. (see the I-D) - Burst mitigation
using TCPHTPS - PRR (partial rate reduction) see the RFC.
Please reformat the commit messages to have a SHORT summary (60-70
characters), then a blank line, then the rest of the description, rather
than diving right in to description that git then uses as the overlong
subject line.
I would like to keep the messages as is. This makes it easier to compare
upstream FreeBSD changes with changes imported to Newlib.
In this case, since the commits come from a third party repository, we
would like to request inclusion of the commits in newlib without
modification. This allows us to more easily update to future versions
of the third party code, and provides a cleaner history/provenance of
the code.

Gedare Bloom
RTEMS Project
Post by Sebastian Huber
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
Richard Earnshaw (lists)
2018-08-09 17:24:40 UTC
Permalink
Post by Gedare Bloom
On Thu, Aug 9, 2018 at 9:13 AM, Sebastian Huber
Post by Sebastian Huber
Post by Eric Blake
This is an RTEMS-specific patch set. It is a preparation to update the libbsd
(a port of FreeBSD code to RTEMS, e.g. the network stack) to new FreeBSD
baseline.
1. It updates several header files imported from FreeBSD using the commits from
FreeBSD.
2. It removes the kernel space content from some files and includes a
<machine/_kernel_*.h> file instead. This allows to use the Newlib provided
header files with different FreeBSD baselines.
Follow the RFC6980 and silently ignore following IPv6 NDP messages
that had the IPv6 fragmentation header: o Neighbor Solicitation o
Neighbor Advertisement o Router Solicitation o Router Advertisement
o Redirect
...
Garbage collect IFCAP_POLLING_NOCOUNT. It wasn't used since very
beginning of polling(4). The module always ignored return value from
driver polling handler.
Add a mmap flag (MAP_32BIT) on 64-bit platforms to request that a
mapping use an address in the first 2GB of the process's address
space. This flag should have the same semantics as the same flag on
Linux.
Add a new fo_fill_kinfo fileops method to add type-specific
information to struct kinfo_file. - Move the various fill_*_info()
methods out of kern_descrip.c and into the various file type
implementations. - Rework the support for kinfo_ofile to generate a
suitable kinfo_file object for each file and then convert that to a
kinfo_ofile structure rather than keeping a second, different set of
code that directly manipulates type-specific file information. -
Remove the shm_path() and ksem_info() layering violations.
Retire the unimplemented MAP_RENAME and MAP_NORESERVE flags to
mmap(2). Older binaries are still permitted to use these flags.
Add a new file operations hook for mmap operations. File type-specific
logic is now placed in the mmap hook implementation rather than
requiring it to be placed in sys/vm/vm_mmap.c. This hook allows new
file types to support mmap() as well as potentially allowing mmap()
for existing file types that do not currently support any mapping.
Add the "TCP Blackbox Recorder" which we discussed at the developer
summits at BSDCan and BSDCam in 2017.
Implement read(2)/write(2) and neccessary lseek(2) for posix shmfd.
Add MAC framework entries for posix shm read and write.
Add MAP_EXCL flag for mmap(2). It should be combined with MAP_FIXED,
and prevents the request from deleting existing mappings in the
region, failing instead.
Implement process-shared locks support for libthr.so.3, without
breaking the ABI. Special value is stored in the lock pointer to
indicate shared lock, and offline page in the shared memory is
allocated to store the actual lock.
...
Add a place for a driver to report rx timestamps in nanoseconds from
boot for the received packets.
Use hardware timestamps to report packet timestamps for SO_TIMESTAMP
and other similar socket options.
This is an implementation of the client side of TCP Fast Open (TFO)
[RFC7413]. It also includes a pre-shared key mode of operation in
which the server requires the client to be in possession of a shared
secret in order to successfully open TFO connections with that
server.
This commit brings in a new refactored TCP stack called Rack. Rack
includes the following features: - A different SACK processing
scheme (the old sack structures are not used). - RACK (Recent
acknowledgment) where counting dup-acks is no longer done instead
time is used to knwo when to retransmit. (see the I-D) - TLP (Tail
Loss Probe) where we will probe for tail-losses to attempt to try
not to take a retransmit time-out. (see the I-D) - Burst mitigation
using TCPHTPS - PRR (partial rate reduction) see the RFC.
Please reformat the commit messages to have a SHORT summary (60-70
characters), then a blank line, then the rest of the description, rather
than diving right in to description that git then uses as the overlong
subject line.
I would like to keep the messages as is. This makes it easier to compare
upstream FreeBSD changes with changes imported to Newlib.
In this case, since the commits come from a third party repository, we
would like to request inclusion of the commits in newlib without
modification. This allows us to more easily update to future versions
of the third party code, and provides a cleaner history/provenance of
the code.
Surely *adding* one extra line (followed by one blank line) as a summary
at the head of the commit won't really interfere with such tracking.
We're not asking you to reformat any of the remaining text.

R.
Post by Gedare Bloom
Gedare Bloom
RTEMS Project
Post by Sebastian Huber
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
Corinna Vinschen
2018-08-09 20:33:47 UTC
Permalink
Post by Richard Earnshaw (lists)
Post by Gedare Bloom
On Thu, Aug 9, 2018 at 9:13 AM, Sebastian Huber
Post by Sebastian Huber
Post by Eric Blake
This is an RTEMS-specific patch set. It is a preparation to update the libbsd
(a port of FreeBSD code to RTEMS, e.g. the network stack) to new FreeBSD
baseline.
1. It updates several header files imported from FreeBSD using the commits from
FreeBSD.
2. It removes the kernel space content from some files and includes a
<machine/_kernel_*.h> file instead. This allows to use the Newlib provided
header files with different FreeBSD baselines.
Follow the RFC6980 and silently ignore following IPv6 NDP messages
that had the IPv6 fragmentation header: o Neighbor Solicitation o
Neighbor Advertisement o Router Solicitation o Router Advertisement
o Redirect
...
Garbage collect IFCAP_POLLING_NOCOUNT. It wasn't used since very
beginning of polling(4). The module always ignored return value from
driver polling handler.
Add a mmap flag (MAP_32BIT) on 64-bit platforms to request that a
mapping use an address in the first 2GB of the process's address
space. This flag should have the same semantics as the same flag on
Linux.
Add a new fo_fill_kinfo fileops method to add type-specific
information to struct kinfo_file. - Move the various fill_*_info()
methods out of kern_descrip.c and into the various file type
implementations. - Rework the support for kinfo_ofile to generate a
suitable kinfo_file object for each file and then convert that to a
kinfo_ofile structure rather than keeping a second, different set of
code that directly manipulates type-specific file information. -
Remove the shm_path() and ksem_info() layering violations.
Retire the unimplemented MAP_RENAME and MAP_NORESERVE flags to
mmap(2). Older binaries are still permitted to use these flags.
Add a new file operations hook for mmap operations. File type-specific
logic is now placed in the mmap hook implementation rather than
requiring it to be placed in sys/vm/vm_mmap.c. This hook allows new
file types to support mmap() as well as potentially allowing mmap()
for existing file types that do not currently support any mapping.
Add the "TCP Blackbox Recorder" which we discussed at the developer
summits at BSDCan and BSDCam in 2017.
Implement read(2)/write(2) and neccessary lseek(2) for posix shmfd.
Add MAC framework entries for posix shm read and write.
Add MAP_EXCL flag for mmap(2). It should be combined with MAP_FIXED,
and prevents the request from deleting existing mappings in the
region, failing instead.
Implement process-shared locks support for libthr.so.3, without
breaking the ABI. Special value is stored in the lock pointer to
indicate shared lock, and offline page in the shared memory is
allocated to store the actual lock.
...
Add a place for a driver to report rx timestamps in nanoseconds from
boot for the received packets.
Use hardware timestamps to report packet timestamps for SO_TIMESTAMP
and other similar socket options.
This is an implementation of the client side of TCP Fast Open (TFO)
[RFC7413]. It also includes a pre-shared key mode of operation in
which the server requires the client to be in possession of a shared
secret in order to successfully open TFO connections with that
server.
This commit brings in a new refactored TCP stack called Rack. Rack
includes the following features: - A different SACK processing
scheme (the old sack structures are not used). - RACK (Recent
acknowledgment) where counting dup-acks is no longer done instead
time is used to knwo when to retransmit. (see the I-D) - TLP (Tail
Loss Probe) where we will probe for tail-losses to attempt to try
not to take a retransmit time-out. (see the I-D) - Burst mitigation
using TCPHTPS - PRR (partial rate reduction) see the RFC.
Please reformat the commit messages to have a SHORT summary (60-70
characters), then a blank line, then the rest of the description, rather
than diving right in to description that git then uses as the overlong
subject line.
I would like to keep the messages as is. This makes it easier to compare
upstream FreeBSD changes with changes imported to Newlib.
In this case, since the commits come from a third party repository, we
would like to request inclusion of the commits in newlib without
modification. This allows us to more easily update to future versions
of the third party code, and provides a cleaner history/provenance of
the code.
Surely *adding* one extra line (followed by one blank line) as a summary
at the head of the commit won't really interfere with such tracking.
We're not asking you to reformat any of the remaining text.
R.
Right. I fully agree with Eric and Richard.

If you really need to keep track of the upstream patches, add a
"cherry-picked from" line and use the SHA-1 for tracking. That's much
better and easier than tracking via full text.


Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
Loading...