aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2021-04-18 14:08:08 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2021-04-18 14:16:42 +0000
commit9e644c23000c2f5028b235f6263d17ffb24d3605 (patch)
tree846286d2c178f8c442c7bd711ceb0a50a9c06f9e /usr.bin
parent136f6b6c0cc1343a7637c3250ff9dd0eced4b4d0 (diff)
downloadsrc-9e644c23000c2f5028b235f6263d17ffb24d3605.tar.gz
src-9e644c23000c2f5028b235f6263d17ffb24d3605.zip
tcp: add support for TCP over UDP
Adding support for TCP over UDP allows communication with TCP stacks which can be implemented in userspace without requiring special priviledges or specific support by the OS. This is joint work with rrs. Reviewed by: rrs Sponsored by: Netflix, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29469
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/netstat/inet.c4
-rw-r--r--usr.bin/sockstat/sockstat.16
-rw-r--r--usr.bin/sockstat/sockstat.c13
3 files changed, 16 insertions, 7 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 95b0d8931b26..49478c4a9247 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -664,6 +664,10 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
"{N:(for} {:received-ack-bytes/%ju} {N:/byte%s})\n");
p(tcps_rcvdupack, "\t\t{:received-duplicate-acks/%ju} "
"{N:/duplicate ack%s}\n");
+ p(tcps_tunneled_pkts, "\t\t{:received-udp-tunneled-pkts/%ju} "
+ "{N:/UDP tunneled pkt%s}\n");
+ p(tcps_tunneled_errs, "\t\t{:received-bad-udp-tunneled-pkts/%ju} "
+ "{N:/UDP tunneled pkt cnt with error%s}\n");
p(tcps_rcvacktoomuch, "\t\t{:received-acks-for-unsent-data/%ju} "
"{N:/ack%s for unsent data}\n");
p2(tcps_rcvpack, tcps_rcvbyte, "\t\t"
diff --git a/usr.bin/sockstat/sockstat.1 b/usr.bin/sockstat/sockstat.1
index 8521c50348c9..f602ad467f9f 100644
--- a/usr.bin/sockstat/sockstat.1
+++ b/usr.bin/sockstat/sockstat.1
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 30, 2020
+.Dd March 28, 2021
.Dt SOCKSTAT 1
.Os
.Sh NAME
@@ -98,7 +98,7 @@ Display the protocol state, if applicable.
This is currently only implemented for SCTP and TCP.
.It Fl U
Display the remote UDP encapsulation port number, if applicable.
-This is currently only implemented for SCTP.
+This is currently only implemented for SCTP and TCP.
.It Fl u
Show
.Dv AF_LOCAL
@@ -163,7 +163,7 @@ The address the foreign end of the socket is bound to (see
.It Li ENCAPS
The remote UDP encapsulation port number if
.Fl U
-is specified (only for SCTP).
+is specified (only for SCTP or TCP).
.It Li PATH STATE
The path state if
.Fl s
diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c
index 26f31d96b8e0..109b254b7438 100644
--- a/usr.bin/sockstat/sockstat.c
+++ b/usr.bin/sockstat/sockstat.c
@@ -710,6 +710,8 @@ gather_inet(int proto)
sockaddr(&faddr->address, sock->family,
&xip->in6p_faddr, xip->inp_fport);
}
+ if (proto == IPPROTO_TCP)
+ faddr->encaps_port = xtp->xt_encaps_port;
laddr->next = NULL;
faddr->next = NULL;
sock->laddr = laddr;
@@ -1087,10 +1089,13 @@ displaysock(struct sock *s, int pos)
}
if (opt_U) {
if (faddr != NULL &&
- s->proto == IPPROTO_SCTP &&
- s->state != SCTP_CLOSED &&
- s->state != SCTP_BOUND &&
- s->state != SCTP_LISTEN) {
+ ((s->proto == IPPROTO_SCTP &&
+ s->state != SCTP_CLOSED &&
+ s->state != SCTP_BOUND &&
+ s->state != SCTP_LISTEN) ||
+ (s->proto == IPPROTO_TCP &&
+ s->state != TCPS_CLOSED &&
+ s->state != TCPS_LISTEN))) {
while (pos < offset)
pos += xprintf(" ");
pos += xprintf("%u",