mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Kylie McClain <somasissounds@gmail.com>
To: musl@lists.openwall.com
Subject: [PATCH] netinet/tcp: Add TCPOPT, TCPOLEN constants
Date: Fri, 1 Jan 2016 21:18:44 -0500	[thread overview]
Message-ID: <CAOji9TAkBkxq=a2ejrB2yiY6cYG9dU6Gd24d6vH28mz2cpqo+A@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 780 bytes --]

Hi, this is a patch to add TCPOPT and TCPOLEN constants to
netinet/tcp.h.

This was discussed in IRC a little, but upon me finishing it
it seemed to get lost in the noise. As such I've submitted it
here so that it won't get lost.

These constants are used by programs such as iptables and are
expected to be defined in the libc's tcp.h; glibc and BSD libcs
all have them exposed by default. However, they are not part of
tcp.h's reserved namespace, therefore it has been hidden behind
_BSD_SOURCE (which is the same as _DEFAULT_SOURCE internally)
so that the behavior is the same across other C libraries and
doesn't require patches to programs, but still manages to be
standards conforming if need be.

I've attached it since I don't trust gmail to not mess up patch
formatting.

[-- Attachment #2: 0001-netinet-tcp-Add-TCPOPT-TCPOLEN-constants.patch --]
[-- Type: application/octet-stream, Size: 1324 bytes --]

From dcbbbe36ba5046effd2e475a3e54b89623d0f6f7 Mon Sep 17 00:00:00 2001
From: Kylie McClain <somasis@exherbo.org>
Date: Wed, 30 Dec 2015 17:24:02 -0500
Subject: [PATCH] netinet/tcp: Add TCPOPT, TCPOLEN constants

Programs such as iptables depend on these constants, which can also
be found defined in other libcs.

Since only TCP_* is reserved as part of tcp.h's namespace, we hide
them behind _BSD_SOURCE (and therefore _DEFAULT_SOURCE) to expose
them by default, but keep it standard conforming.
---
 include/netinet/tcp.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h
index 52358c7..1eb2449 100644
--- a/include/netinet/tcp.h
+++ b/include/netinet/tcp.h
@@ -28,6 +28,20 @@
 #define TCP_TIMESTAMP    24
 #define TCP_NOTSENT_LOWAT 25
 
+#ifdef defined(_BSD_SOURCE)
+#define TCPOPT_EOL              0
+#define TCPOPT_NOP              1
+#define TCPOPT_MAXSEG           2
+#define TCPOPT_WINDOW           3
+#define TCPOPT_SACK_PERMITTED   4
+#define TCPOPT_SACK             5
+#define TCPOPT_TIMESTAMP        8
+#define TCPOLEN_SACK_PERMITTED  2
+#define TCPOLEN_WINDOW          3
+#define TCPOLEN_MAXSEG          4
+#define TCPOLEN_TIMESTAMP       10
+#endif
+
 #define TCP_ESTABLISHED  1
 #define TCP_SYN_SENT     2
 #define TCP_SYN_RECV     3
-- 
2.6.4


             reply	other threads:[~2016-01-02  2:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-02  2:18 Kylie McClain [this message]
2016-01-02 19:15 ` Shiz
2016-01-03  4:24   ` Rich Felker
2016-01-03  6:18     ` Kylie McClain
2016-01-04  2:48 Kylie McClain
2016-01-17 22:37 ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOji9TAkBkxq=a2ejrB2yiY6cYG9dU6Gd24d6vH28mz2cpqo+A@mail.gmail.com' \
    --to=somasissounds@gmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).