Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 fix endian issue in filling in interface id.
details: https://anonhg.NetBSD.org/src/rev/a896a9b76778
branches: trunk
changeset: 485050:a896a9b76778
user: itojun <itojun%NetBSD.org@localhost>
date: Mon Apr 17 16:26:07 2000 +0000
description:
fix endian issue in filling in interface id.
better sync with kame (nuke space at EOL).
diffstat:
sys/netinet6/udp6_usrreq.c | 42 ++++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 20 deletions(-)
diffs (144 lines):
diff -r 7eb6124e443c -r a896a9b76778 sys/netinet6/udp6_usrreq.c
--- a/sys/netinet6/udp6_usrreq.c Mon Apr 17 14:59:02 2000 +0000
+++ b/sys/netinet6/udp6_usrreq.c Mon Apr 17 16:26:07 2000 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: udp6_usrreq.c,v 1.26 2000/03/01 12:49:50 itojun Exp $ */
-/* $KAME: udp6_usrreq.c,v 1.40 2000/02/28 15:44:13 itojun Exp $ */
+/* $NetBSD: udp6_usrreq.c,v 1.27 2000/04/17 16:26:07 itojun Exp $ */
+/* $KAME: udp6_usrreq.c,v 1.46 2000/04/17 16:16:32 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -16,7 +16,7 @@
* 3. Neither the name of the project 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 PROJECT 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
@@ -92,8 +92,8 @@
#include <netinet/udp.h>
#include <netinet/udp_var.h>
#include <netinet/ip6.h>
+#include <netinet6/ip6_var.h>
#include <netinet6/in6_pcb.h>
-#include <netinet6/ip6_var.h>
#include <netinet/icmp6.h>
#include <netinet6/udp6_var.h>
#include <netinet6/ip6protosw.h>
@@ -186,7 +186,11 @@
}
#endif
ulen = ntohs((u_short)uh->uh_ulen);
- if (ulen == 0 && plen > 0xffff) /* jumbogram */
+ /*
+ * RFC2675 section 4: jumbograms will have 0 in the UDP header field,
+ * iff payload length > 0xffff.
+ */
+ if (ulen == 0 && plen > 0xffff)
ulen = plen;
if (plen != ulen) {
@@ -244,7 +248,7 @@
* matches one of the multicast groups specified in the socket.
*/
- /*
+ /*
* Construct sockaddr format source address.
*/
bzero(&udp_in6, sizeof(udp_in6));
@@ -457,7 +461,7 @@
/*
* Notify a udp user of an asynchronous error;
- * just wake up so tat he can collect error status.
+ * just wake up so that he can collect error status.
*/
static void
udp6_notify(in6p, errno)
@@ -605,10 +609,9 @@
fport = sin6->sin6_port; /* allow 0 port */
/*
* If the scope of the destination is link-local,
- * embed the interface
- * index in the address.
+ * embed the interface index in the address.
*
- * XXX advanced-api value overrides sin6_scope_id
+ * XXX advanced-api value overrides sin6_scope_id
*/
if (IN6_IS_ADDR_LINKLOCAL(faddr) ||
IN6_IS_ADDR_MC_LINKLOCAL(faddr)) {
@@ -625,15 +628,14 @@
pi->ipi6_ifindex) {
faddr->s6_addr16[1] = htons(pi->ipi6_ifindex);
oifp = ifindex2ifnet[pi->ipi6_ifindex];
- }
- else if (IN6_IS_ADDR_MULTICAST(faddr) &&
+ } else if (IN6_IS_ADDR_MULTICAST(faddr) &&
(mopt = in6p->in6p_moptions) &&
mopt->im6o_multicast_ifp) {
oifp = mopt->im6o_multicast_ifp;
- faddr->s6_addr16[1] = oifp->if_index;
+ faddr->s6_addr16[1] = htons(oifp->if_index);
} else if (sin6->sin6_scope_id) {
/* boundary check */
- if (sin6->sin6_scope_id < 0
+ if (sin6->sin6_scope_id < 0
|| if_index < sin6->sin6_scope_id) {
error = ENXIO; /* XXX EINVAL? */
goto release;
@@ -786,7 +788,7 @@
int error = 0;
int s;
- /*
+ /*
* MAPPED_ADDR implementation info:
* Mapped addr support for PRU_CONTROL is not necessary.
* Because typical user of PRU_CONTROL is such as ifconfig,
@@ -815,7 +817,7 @@
case PRU_ATTACH:
/*
* MAPPED_ADDR implementation spec:
- * Always attach for IPv6,
+ * Always attach for IPv6,
* and only when necessary for IPv4.
*/
if (in6p != NULL) {
@@ -864,7 +866,7 @@
error = in6_pcbconnect(in6p, addr6);
if (ip6_auto_flowlabel) {
in6p->in6p_flowinfo &= ~IPV6_FLOWLABEL_MASK;
- in6p->in6p_flowinfo |=
+ in6p->in6p_flowinfo |=
(htonl(ip6_flow_seq++) & IPV6_FLOWLABEL_MASK);
}
splx(s);
@@ -948,7 +950,7 @@
udp6_detach(in6p)
struct in6pcb *in6p;
{
- int s = splsoftnet();
+ int s = splsoftnet();
if (in6p == udp6_last_in6pcb)
udp6_last_in6pcb = &udb6;
@@ -978,7 +980,7 @@
return sysctl_int(oldp, oldlenp, newp, newlen,
&udp6_sendspace);
case UDP6CTL_RECVSPACE:
- return sysctl_int(oldp, oldlenp, newp, newlen,
+ return sysctl_int(oldp, oldlenp, newp, newlen,
&udp6_recvspace);
default:
return ENOPROTOOPT;
Home |
Main Index |
Thread Index |
Old Index