tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Support for 240/4 and 0/8 addresses in NetBSD
> I think that is what we are landing on; there have been several
> comments (including me) that we shouldn't change given the lack of
> standardization, and I haven't seen any in favor of just changing.
Depending on your opinion of me, it may be a reason to change or a
reason to not change, but I'm in favour of just changing. I've made
this change to my own semi-private forks; while I haven't reinstalled
many of my machines with it yet, that will happen gradually. Here, for
example, is the change I made to my 5.2 fork:
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 454b7af..138d9f4 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -190,19 +190,13 @@ in_localaddr(struct in_addr in)
* that may not be forwarded, or whether datagrams to that destination
* may be forwarded.
*/
-int
-in_canforward(struct in_addr in)
+int in_canforward(struct in_addr in)
{
- u_int32_t net;
-
- if (IN_EXPERIMENTAL(in.s_addr) || IN_MULTICAST(in.s_addr))
- return (0);
- if (IN_CLASSA(in.s_addr)) {
- net = in.s_addr & IN_CLASSA_NET;
- if (net == 0 || net == htonl(IN_LOOPBACKNET << IN_CLASSA_NSHIFT))
- return (0);
- }
- return (1);
+ return(!( (in.s_addr == INADDR_ANY) ||
+ (in.s_addr == INADDR_BROADCAST) ||
+ IN_MULTICAST(in.s_addr) ||
+ ( (in.s_addr & IN_CLASSA_NET) ==
+ htonl(IN_LOOPBACKNET << IN_CLASSA_NSHIFT) ) ));
}
/*
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse%rodents-montreal.org@localhost
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Home |
Main Index |
Thread Index |
Old Index