Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixes to work to get enpacsulated packets on darwin.

mip6_tunnel_input():
 - eliminate 'proto' parameter and calculate proto value
   since darwin takes only 2 parameters
 - use protocol_input() to inject decapsulated ipv6 packet
   instead of IF_ENQUEUE() as other BSD does.

With these fixes, MIP6 can work on darwin.
  • Loading branch information...
commit 4928f093731169e359b33fe8707f36a4630e6786 1 parent 1713155
t-momose authored
Showing with 33 additions and 4 deletions.
  1. +27 −2 kame/sys/netinet6/mip6.c
  2. +6 −2 kame/sys/netinet6/mip6_var.h
View
29 kame/sys/netinet6/mip6.c
@@ -1,4 +1,4 @@
-/* $Id: mip6.c,v 1.240 2006/04/17 12:12:12 t-momose Exp $ */
+/* $Id: mip6.c,v 1.241 2006/08/14 16:31:37 t-momose Exp $ */
/*
* Copyright (C) 2004 WIDE Project. All rights reserved.
@@ -425,9 +425,15 @@ mip6_input(mp, offp)
}
int
+#ifndef __APPLE__
mip6_tunnel_input(mp, offp, proto)
struct mbuf **mp;
int *offp, proto;
+#else
+mip6_tunnel_input(mp, offp)
+ struct mbuf **mp;
+ int *offp;
+#endif
{
struct mbuf *m = *mp;
#if NMIP > 0
@@ -436,11 +442,25 @@ mip6_tunnel_input(mp, offp, proto)
struct in6_addr src, dst;
struct mip6_bul_internal *bul, *cnbul;
int presence;
+#ifdef __APPLE__
+ int proto;
+ u_int8_t exthdr[2];
+#endif /* __APPLE__ */
#endif /* NMIP > 0 */
#ifndef __FreeBSD__
int s;
#endif
+#ifdef __APPLE__
+ off = sizeof(struct ip6_hdr);
+ proto = mtod(m, struct ip6_hdr *)->ip6_nxt;
+ while (off < *offp) {
+ m_copydata(m, off, sizeof(exthdr), (caddr_t)exthdr);
+ proto = exthdr[0];
+ off += (exthdr[1] + 1) << 3;
+ }
+#endif /* __APPLE__ */
+
m_adj(m, *offp);
switch (proto) {
@@ -490,6 +510,9 @@ mip6_tunnel_input(mp, offp, proto)
mip6stat.mip6s_revtunnel++;
+#ifdef __APPLE__
+ proto_input(PF_INET6, m);
+#else __APPLE__
#ifdef __NetBSD__
s = splnet();
#elif defined(__OpenBSD__) || defined(__APPLE__)
@@ -511,6 +534,7 @@ mip6_tunnel_input(mp, offp, proto)
#ifndef __FreeBSD__
splx(s);
#endif
+#endif /* __APPLE__ */
break;
default:
mip6log((LOG_ERR, "protocol %d not supported.\n", proto));
@@ -763,7 +787,7 @@ mip6_bce_update_ipsecdb(bce)
}
void
-mip6_bce_remove_all (void)
+mip6_bce_remove_all(void)
{
struct mip6_bc_internal *mbc, *mbcn = NULL;
int s;
@@ -1242,6 +1266,7 @@ mip6_bul_encapcheck(m, off, proto, arg)
struct mip6_bul_internal *mbul = (struct mip6_bul_internal *)arg;
struct ip6_hdr *ip6;
+printf("mip6_bul_encapcheck(mbul = %x) begin\n", mbul);
if (mbul == NULL) {
return (0);
}
View
8 kame/sys/netinet6/mip6_var.h
@@ -1,4 +1,4 @@
-/* $KAME: mip6_var.h,v 1.128 2005/12/30 08:57:24 t-momose Exp $ */
+/* $KAME: mip6_var.h,v 1.129 2006/08/14 16:31:38 t-momose Exp $ */
/*
* Copyright (C) 2004 WIDE Project. All rights reserved.
@@ -199,7 +199,11 @@ void mip6_md_scan(u_int16_t);
/* used by one or more kind of nodetypes. */
struct in6_ifaddr *mip6_ifa_ifwithin6addr(const struct in6_addr *);
int mip6_encapsulate(struct mbuf **, struct in6_addr *, struct in6_addr *);
-int mip6_tunnel_input(struct mbuf **, int *, int proto);
+#ifdef __APPLE__
+int mip6_tunnel_input(struct mbuf **, int *);
+#else
+int mip6_tunnel_input(struct mbuf **, int *, int);
+#endif /* __APPLE__ */
void mip6_notify_rr_hint(struct in6_addr *, struct in6_addr *);
/* a sysctl entry. */
Please sign in to comment.
Something went wrong with that request. Please try again.