aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/ip_ecn.c
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2001-06-11 12:39:29 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2001-06-11 12:39:29 +0000
commit33841545909f4a4ee94aa148b3a9cbcdc1abb02a (patch)
treea79fc7ad2b97862c4a404f352f0211ad93a7b5f1 /sys/netinet/ip_ecn.c
parent52ebde4fbaab8a8b79de6b17892943783abec7be (diff)
downloadsrc-33841545909f4a4ee94aa148b3a9cbcdc1abb02a.tar.gz
src-33841545909f4a4ee94aa148b3a9cbcdc1abb02a.zip
Sync with recent KAME.
This work was based on kame-20010528-freebsd43-snap.tgz and some critical problem after the snap was out were fixed. There are many many changes since last KAME merge. TODO: - The definitions of SADB_* in sys/net/pfkeyv2.h are still different from RFC2407/IANA assignment because of binary compatibility issue. It should be fixed under 5-CURRENT. - ip6po_m member of struct ip6_pktopts is no longer used. But, it is still there because of binary compatibility issue. It should be removed under 5-CURRENT. Reviewed by: itojun Obtained from: KAME MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=78064
Diffstat (limited to 'sys/netinet/ip_ecn.c')
-rw-r--r--sys/netinet/ip_ecn.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/sys/netinet/ip_ecn.c b/sys/netinet/ip_ecn.c
index 047f82e1fb52..3abc3b683212 100644
--- a/sys/netinet/ip_ecn.c
+++ b/sys/netinet/ip_ecn.c
@@ -1,5 +1,5 @@
/* $FreeBSD$ */
-/* $KAME: ip_ecn.c,v 1.7 2000/05/05 11:00:56 sumikawa Exp $ */
+/* $KAME: ip_ecn.c,v 1.11 2001/05/03 16:09:29 itojun Exp $ */
/*
* Copyright (C) 1999 WIDE Project.
@@ -43,16 +43,10 @@
#include <sys/mbuf.h>
#include <sys/errno.h>
-#ifdef INET
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
-#endif
-
#ifdef INET6
-#ifndef INET
-#include <netinet/in.h>
-#endif
#include <netinet/ip6.h>
#endif
@@ -63,17 +57,17 @@
/*
* modify outer ECN (TOS) field on ingress operation (tunnel encapsulation).
- * call it after you've done the default initialization/copy for the outer.
*/
void
ip_ecn_ingress(mode, outer, inner)
int mode;
u_int8_t *outer;
- u_int8_t *inner;
+ const u_int8_t *inner;
{
if (!outer || !inner)
panic("NULL pointer passed to ip_ecn_ingress");
+ *outer = *inner;
switch (mode) {
case ECN_ALLOWED: /* ECN allowed */
*outer &= ~IPTOS_CE;
@@ -88,12 +82,11 @@ ip_ecn_ingress(mode, outer, inner)
/*
* modify inner ECN (TOS) field on egress operation (tunnel decapsulation).
- * call it after you've done the default initialization/copy for the inner.
*/
void
ip_ecn_egress(mode, outer, inner)
int mode;
- u_int8_t *outer;
+ const u_int8_t *outer;
u_int8_t *inner;
{
if (!outer || !inner)
@@ -115,14 +108,13 @@ void
ip6_ecn_ingress(mode, outer, inner)
int mode;
u_int32_t *outer;
- u_int32_t *inner;
+ const u_int32_t *inner;
{
u_int8_t outer8, inner8;
if (!outer || !inner)
panic("NULL pointer passed to ip6_ecn_ingress");
- outer8 = (ntohl(*outer) >> 20) & 0xff;
inner8 = (ntohl(*inner) >> 20) & 0xff;
ip_ecn_ingress(mode, &outer8, &inner8);
*outer &= ~htonl(0xff << 20);
@@ -132,7 +124,7 @@ ip6_ecn_ingress(mode, outer, inner)
void
ip6_ecn_egress(mode, outer, inner)
int mode;
- u_int32_t *outer;
+ const u_int32_t *outer;
u_int32_t *inner;
{
u_int8_t outer8, inner8;
@@ -141,7 +133,6 @@ ip6_ecn_egress(mode, outer, inner)
panic("NULL pointer passed to ip6_ecn_egress");
outer8 = (ntohl(*outer) >> 20) & 0xff;
- inner8 = (ntohl(*inner) >> 20) & 0xff;
ip_ecn_egress(mode, &outer8, &inner8);
*inner &= ~htonl(0xff << 20);
*inner |= htonl((u_int32_t)inner8 << 20);