public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Sebastian Huber <sh@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] kernel: deprecate Internet Class A/B/C
Date: Mon, 11 Jul 2022 11:55:15 +0000 (GMT)	[thread overview]
Message-ID: <20220711115515.6660A385742A@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a9a87c19217336e3738d2fbff91468855c6a307c

commit a9a87c19217336e3738d2fbff91468855c6a307c
Author: Mike Karels <karels@FreeBSD.org>
Date:   Tue Oct 26 22:01:09 2021 -0500

    kernel: deprecate Internet Class A/B/C
    
    Hide historical Class A/B/C macros unless IN_HISTORICAL_NETS is defined;
    define it for user level.  Define IN_MULTICAST separately from IN_CLASSD,
    and use it in pf instead of IN_CLASSD.  Stop using class for setting
    default masks when not specified; instead, define new default mask
    (24 bits).  Warn when an Internet address is set without a mask.
    
    MFC after:      1 month
    Reviewed by:    cy
    Differential Revision: https://reviews.freebsd.org/D32708

Diff:
---
 newlib/libc/sys/rtems/include/netinet/in.h | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/newlib/libc/sys/rtems/include/netinet/in.h b/newlib/libc/sys/rtems/include/netinet/in.h
index 059f50d9b..4c692b6df 100644
--- a/newlib/libc/sys/rtems/include/netinet/in.h
+++ b/newlib/libc/sys/rtems/include/netinet/in.h
@@ -342,10 +342,15 @@ __END_DECLS
 #define	IPPORT_MAX		65535
 
 /*
- * Definitions of bits in internet address integers.
- * On subnets, the decomposition of addresses to host and net parts
- * is done according to subnet mask, not the masks here.
+ * Historical definitions of bits in internet address integers
+ * (pre-CIDR).  Class A/B/C are long obsolete, and now deprecated.
+ * Hide these definitions from the kernel unless IN_HISTORICAL_NETS
+ * is defined.  Provide the historical definitions to user level for now.
  */
+#ifndef _KERNEL
+#define IN_HISTORICAL_NETS
+#endif
+#ifdef IN_HISTORICAL_NETS
 #define	IN_CLASSA(i)		(((in_addr_t)(i) & 0x80000000) == 0)
 #define	IN_CLASSA_NET		0xff000000
 #define	IN_CLASSA_NSHIFT	24
@@ -362,12 +367,17 @@ __END_DECLS
 #define	IN_CLASSC_NET		0xffffff00
 #define	IN_CLASSC_NSHIFT	8
 #define	IN_CLASSC_HOST		0x000000ff
+#endif /* IN_HISTORICAL_NETS */
+
+#define	IN_NETMASK_DEFAULT	0xffffff00	/* mask when forced to guess */
 
-#define	IN_CLASSD(i)		(((in_addr_t)(i) & 0xf0000000) == 0xe0000000)
+#define	IN_MULTICAST(i)		(((in_addr_t)(i) & 0xf0000000) == 0xe0000000)
+#ifdef IN_HISTORICAL_NETS
+#define	IN_CLASSD(i)		IN_MULTICAST(i)
 #define	IN_CLASSD_NET		0xf0000000	/* These ones aren't really */
 #define	IN_CLASSD_NSHIFT	28		/* net and host fields, but */
 #define	IN_CLASSD_HOST		0x0fffffff	/* routing needn't know.    */
-#define	IN_MULTICAST(i)		IN_CLASSD(i)
+#endif /* IN_HISTORICAL_NETS */
 
 #define	IN_EXPERIMENTAL(i)	(((in_addr_t)(i) & 0xf0000000) == 0xf0000000)
 #define	IN_BADCLASS(i)		(((in_addr_t)(i) & 0xf0000000) == 0xf0000000)
@@ -398,7 +408,9 @@ __END_DECLS
 #define	INADDR_ALLMDNS_GROUP	((in_addr_t)0xe00000fb)	/* 224.0.0.251 */
 #define	INADDR_MAX_LOCAL_GROUP	((in_addr_t)0xe00000ff)	/* 224.0.0.255 */
 
+#ifdef IN_HISTORICAL_NETS
 #define	IN_LOOPBACKNET		127			/* official! */
+#endif /* IN_HISTORICAL_NETS */
 
 #define	IN_RFC3021_MASK		((in_addr_t)0xfffffffe)


                 reply	other threads:[~2022-07-11 11:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220711115515.6660A385742A@sourceware.org \
    --to=sh@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).