Permalink
Browse files

- changed mobility header formats to those of id-19.

  • Loading branch information...
1 parent 1970c26 commit 2bd7d80b0eb22f33521c87eee982debcfec1f419 keiichi committed Nov 1, 2002
Showing with 26 additions and 65 deletions.
  1. +13 −23 kame/sys/netinet/ip6.h
  2. +3 −15 kame/sys/netinet6/ip6_output.c
  3. +8 −25 kame/sys/netinet6/mip6_pktproc.c
  4. +2 −2 kame/sys/netinet6/mobility6.c
View
36 kame/sys/netinet/ip6.h
@@ -1,4 +1,4 @@
-/* $KAME: ip6.h,v 1.36 2002/11/01 03:31:29 keiichi Exp $ */
+/* $KAME: ip6.h,v 1.37 2002/11/01 11:09:50 keiichi Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -271,7 +271,8 @@ struct ip6_frag {
struct ip6_mobility {
u_int8_t ip6m_pproto; /* following payload protocol (for PG) */
u_int8_t ip6m_len; /* length in units of 8 octets */
- u_int16_t ip6m_type; /* message type */
+ u_int8_t ip6m_type; /* message type */
+ u_int8_t ip6m_reserved;
u_int16_t ip6m_cksum; /* sum of IPv6 pseudo-header and MH */
/* followed by type specific data */
} __attribute__((__packed__));
@@ -280,25 +281,14 @@ struct ip6_mobility {
#define IP6M_MINLEN 8
/* Mobility header message types */
-#if BYTE_ORDER == BIG_ENDIAN
-#define IP6M_BINDING_REQUEST 0x0000
-#define IP6M_HOME_TEST_INIT 0x0001
-#define IP6M_CAREOF_TEST_INIT 0x0002
-#define IP6M_HOME_TEST 0x0003
-#define IP6M_CAREOF_TEST 0x0004
-#define IP6M_BINDING_UPDATE 0x0005
-#define IP6M_BINDING_ACK 0x0006
-#define IP6M_BINDING_ERROR 0x0007
-#else /* BYTE_ORDER == LITTLE_ENDIAN */
-#define IP6M_BINDING_REQUEST 0x0000
-#define IP6M_HOME_TEST_INIT 0x0100
-#define IP6M_CAREOF_TEST_INIT 0x0200
-#define IP6M_HOME_TEST 0x0300
-#define IP6M_CAREOF_TEST 0x0400
-#define IP6M_BINDING_UPDATE 0x0500
-#define IP6M_BINDING_ACK 0x0600
-#define IP6M_BINDING_ERROR 0x0700
-#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+#define IP6M_BINDING_REQUEST 0
+#define IP6M_HOME_TEST_INIT 1
+#define IP6M_CAREOF_TEST_INIT 2
+#define IP6M_HOME_TEST 3
+#define IP6M_CAREOF_TEST 4
+#define IP6M_BINDING_UPDATE 5
+#define IP6M_BINDING_ACK 6
+#define IP6M_BINDING_ERROR 7
/* Binding Refresh Request (BRR) message */
struct ip6m_binding_request {
@@ -365,7 +355,7 @@ struct ip6m_binding_update {
u_int16_t ip6mu_seqno;
u_int8_t ip6mu_flags;
u_int8_t ip6mu_reserved;
- u_int16_t ip6mu_lifetime;
+ u_int16_t ip6mu_lifetime; /* a unit of 4 seconds */
/* followed by mobility options */
} __attribute__((__packed__));
@@ -386,7 +376,7 @@ struct ip6m_binding_ack {
u_int8_t ip6ma_status;
u_int8_t ip6ma_reserved;
u_int16_t ip6ma_seqno;
- u_int16_t ip6ma_lifetime;
+ u_int16_t ip6ma_lifetime; /* a unit of 4 seconds */
/* followed by mobility options */
} __attribute__((__packed__));
View
18 kame/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $KAME: ip6_output.c,v 1.344 2002/10/31 11:25:44 jinmei Exp $ */
+/* $KAME: ip6_output.c,v 1.345 2002/11/01 11:09:51 keiichi Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -341,18 +341,6 @@ ip6_output(m0, opt, ro, flags, im6o, ifpp)
goto freehdrs; \
} \
} while (0)
-#ifdef MIP6
-#define MAKE_MOBILITYHDR(hp, mp) \
- do { \
- if (hp) { \
- struct ip6_mobility *mh = (struct ip6_mobility *)(hp); \
- error = ip6_copyexthdr((mp), (caddr_t)(hp), \
- (mh)->ip6m_len << 3); \
- if (error) \
- goto freehdrs; \
- } \
- } while (0)
-#endif
bzero(&exthdrs, sizeof(exthdrs));
@@ -387,7 +375,7 @@ ip6_output(m0, opt, ro, flags, im6o, ifpp)
/* Destination options header(2nd part) */
MAKE_EXTHDR(opt->ip6po_dest2, &exthdrs.ip6e_dest2);
#ifdef MIP6
- MAKE_MOBILITYHDR(opt->ip6po_mobility, &exthdrs.ip6e_mobility);
+ MAKE_EXTHDR(opt->ip6po_mobility, &exthdrs.ip6e_mobility);
#endif /* MIP6 */
}
#ifdef MIP6
@@ -441,7 +429,7 @@ ip6_output(m0, opt, ro, flags, im6o, ifpp)
* header is specified by the ip6_output()
* caller.
*/
- MAKE_MOBILITYHDR(mip6opt.mip6po_mobility,
+ MAKE_EXTHDR(mip6opt.mip6po_mobility,
&exthdrs.ip6e_mobility);
}
} else {
View
33 kame/sys/netinet6/mip6_pktproc.c
@@ -1,4 +1,4 @@
-/* $KAME: mip6_pktproc.c,v 1.77 2002/11/01 10:10:09 keiichi Exp $ */
+/* $KAME: mip6_pktproc.c,v 1.78 2002/11/01 11:09:51 keiichi Exp $ */
/*
* Copyright (C) 2002 WIDE Project. All rights reserved.
@@ -194,7 +194,7 @@ mip6_ip6mh_create(pktopt_mobility, src, dst, cookie)
bzero(ip6mh, ip6mh_size);
ip6mh->ip6mh_pproto = IPPROTO_NONE;
- ip6mh->ip6mh_len = ip6mh_size >> 3;
+ ip6mh->ip6mh_len = (ip6mh_size >> 3) - 1;
ip6mh->ip6mh_type = IP6M_HOME_TEST;
ip6mh->ip6mh_nonce_index = htons(nonce_index);
bcopy(cookie, ip6mh->ip6mh_hot_cookie, sizeof(ip6mh->ip6mh_hot_cookie));
@@ -305,7 +305,7 @@ mip6_ip6mc_create(pktopt_mobility, src, dst, cookie)
bzero(ip6mc, ip6mc_size);
ip6mc->ip6mc_pproto = IPPROTO_NONE;
- ip6mc->ip6mc_len = ip6mc_size >> 3;
+ ip6mc->ip6mc_len = (ip6mc_size >> 3) - 1;
ip6mc->ip6mc_type = IP6M_CAREOF_TEST;
ip6mc->ip6mc_nonce_index = htons(nonce_index);
bcopy(cookie, ip6mc->ip6mc_cot_cookie, sizeof(ip6mc->ip6mc_cot_cookie));
@@ -626,11 +626,7 @@ mip6_ip6mu_input(m, ip6mu, ip6mulen)
bi.mbc_pcoa.sin6_addr = mopt.mopt_altcoa;
bi.mbc_seqno = ntohs(ip6mu->ip6mu_seqno);
-#if 0 /* XXX MIPv6 Issue 58 */
bi.mbc_lifetime = ntohs(ip6mu->ip6mu_lifetime) << 2; /* units of 4 secs */
-#else
- bi.mbc_lifetime = ntohs(ip6mu->ip6mu_lifetime) << 4; /* units of 16secs */
-#endif
if (!bu_safe &&
mip6_is_valid_bu(ip6, ip6mu, ip6mulen, &mopt,
@@ -1003,11 +999,7 @@ mip6_ip6ma_input(m, ip6ma, ip6malen)
/* binding refresh advice option */
if ((mbu->mbu_flags & IP6MU_HOME) &&
(mopt.valid_options & MOPT_REFRESH)) {
-#if 0 /* XXX MIPv6 Issue 86 */
refresh = mopt.mopt_refresh << 2;
-#else
- refresh = mopt.mopt_refresh;
-#endif
if (refresh > lifetime || refresh == 0)
refresh = lifetime;
}
@@ -1389,7 +1381,7 @@ mip6_ip6mhi_create(pktopt_mobility, mbu)
bzero(ip6mhi, ip6mhi_size);
ip6mhi->ip6mhi_pproto = IPPROTO_NONE;
- ip6mhi->ip6mhi_len = ip6mhi_size >> 3;
+ ip6mhi->ip6mhi_len = (ip6mhi_size >> 3) - 1;
ip6mhi->ip6mhi_type = IP6M_HOME_TEST_INIT;
bcopy(mbu->mbu_mobile_cookie, ip6mhi->ip6mhi_hot_cookie,
sizeof(ip6mhi->ip6mhi_hot_cookie));
@@ -1427,7 +1419,7 @@ mip6_ip6mci_create(pktopt_mobility, mbu)
bzero(ip6mci, ip6mci_size);
ip6mci->ip6mci_pproto = IPPROTO_NONE;
- ip6mci->ip6mci_len = ip6mci_size >> 3;
+ ip6mci->ip6mci_len = (ip6mci_size >> 3) - 1;
ip6mci->ip6mci_type = IP6M_CAREOF_TEST_INIT;
bcopy(mbu->mbu_mobile_cookie, ip6mci->ip6mci_cot_cookie,
sizeof(ip6mci->ip6mci_cot_cookie));
@@ -1548,7 +1540,7 @@ printf("MN: bu_size = %d, nonce_size= %d, auth_size = %d(AUTHSIZE:%d)\n", bu_siz
bzero(ip6mu, ip6mu_size);
ip6mu->ip6mu_pproto = IPPROTO_NONE;
- ip6mu->ip6mu_len = ip6mu_size >> 3;
+ ip6mu->ip6mu_len = (ip6mu_size >> 3) - 1;
ip6mu->ip6mu_type = IP6M_BINDING_UPDATE;
ip6mu->ip6mu_flags = mbu->mbu_flags;
ip6mu->ip6mu_seqno = htons(mbu->mbu_seqno);
@@ -1590,13 +1582,8 @@ printf("MN: bu_size = %d, nonce_size= %d, auth_size = %d(AUTHSIZE:%d)\n", bu_siz
mbu->mbu_lifetime = lifetime;
mbu->mbu_expire = time_second + mbu->mbu_lifetime;
mbu->mbu_refresh = mbu->mbu_lifetime;
-#if 0 /* XXX MIPv6 Issue 58 */
ip6mu->ip6mu_lifetime =
htons((u_int16_t)(mbu->mbu_lifetime >> 2)); /* units 4 secs */
-#else
- ip6mu->ip6mu_lifetime =
- htons((u_int16_t)(mbu->mbu_lifetime >> 4)); /* units 16 secs */
-#endif
}
if ((pad = bu_size - sizeof(struct ip6m_binding_update)) >= 2) {
@@ -1730,7 +1717,7 @@ mip6_ip6ma_create(pktopt_mobility, src, dst, status, seqno, lifetime, refresh, m
bzero(ip6ma, ip6ma_size);
ip6ma->ip6ma_pproto = IPPROTO_NONE;
- ip6ma->ip6ma_len = ip6ma_size >> 3;
+ ip6ma->ip6ma_len = (ip6ma_size >> 3) - 1;
ip6ma->ip6ma_type = IP6M_BINDING_ACK;
ip6ma->ip6ma_status = status;
ip6ma->ip6ma_seqno = htons(seqno);
@@ -1764,11 +1751,7 @@ mip6_ip6ma_create(pktopt_mobility, src, dst, status, seqno, lifetime, refresh, m
if (need_refresh) {
mopt_refresh->ip6mor_type = IP6MOPT_REFRESH;
mopt_refresh->ip6mor_len = sizeof(struct ip6m_opt_refresh) - 2;
-#if 0 /* XXX MIPv6 Issue 86 */
SET_NETVAL_S(&mopt_refresh->ip6mor_refresh, refresh >> 2);
-#else
- SET_NETVAL_S(&mopt_refresh->ip6mor_refresh, refresh);
-#endif
}
if (need_auth) {
@@ -1950,7 +1933,7 @@ mip6_ip6me_create(pktopt_mobility, src, dst, status, addr)
bzero(ip6me, ip6me_size);
ip6me->ip6me_pproto = IPPROTO_NONE;
- ip6me->ip6me_len = ip6me_size >> 3;
+ ip6me->ip6me_len = (ip6me_size >> 3) - 1;
ip6me->ip6me_type = IP6M_BINDING_ERROR;
ip6me->ip6me_status = status;
ip6me->ip6me_addr = addr->sin6_addr;
View
4 kame/sys/netinet6/mobility6.c
@@ -1,4 +1,4 @@
-/* $KAME: mobility6.c,v 1.14 2002/10/11 07:01:45 k-sugyou Exp $ */
+/* $KAME: mobility6.c,v 1.15 2002/11/01 11:09:51 keiichi Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -96,7 +96,7 @@ mobility6_input(mp, offp, proto)
if (mh6 == NULL)
return (IPPROTO_DONE);
#endif
- mh6len = mh6->ip6m_len << 3;
+ mh6len = (mh6->ip6m_len + 1) << 3;
if (mh6len < IP6M_MINLEN) {
/* too small */
m_freem(m);

0 comments on commit 2bd7d80

Please sign in to comment.