Your patch allows MIPL to receive multiple ACoAs, but the first one will be used :-(

Hi Ville,

Ok, here's a different patch. Since the opts_end element in mh_options is never used (mh_opt_next() is never called), I just removed it and update the option pointer appropriately.

Haven't tested this since I don't have a test program that can send two alt-coa's right now.

-Brian


Signed-off-by: Brian Haley <[EMAIL PROTECTED]>
diff -urN src/mh.h.sav src/mh.h
--- src/mh.h.sav	2006-02-25 06:13:33.000000000 -0500
+++ src/mh.h	2006-03-23 11:58:39.000000000 -0500
@@ -24,7 +24,6 @@
 
 struct mh_options {
 	ssize_t opts[IP6_MHOPT_MAX + 1];
-	ssize_t opts_end[IP6_MHOPT_MAX + 1];
 };
 
 struct mh_handler {
@@ -98,27 +97,6 @@
 	return NULL;
 }
 
-static inline void *mh_opt_next(const struct ip6_mh *mh,
-				const struct mh_options *mh_opts,
-				const void *vopt)
-{
-	uint8_t *data = (uint8_t *)mh;
-	uint8_t *opt = (uint8_t *)vopt;
-	if (opt) {
-		ssize_t last = mh_opts->opts_end[opt[0]];
-		ssize_t i = opt - data;
-		while (i < last) {
-			if (data[i] == IP6_MHOPT_PAD1)
-				i++;
-			else
-				i += data[i + 1] + 2;
-			if (i <= last && data[i] == opt[0])
-				return &data[i];
-		}
-	}
-	return NULL;
-}
-
 /* Mobility option parse functions */
 int mh_opt_parse(const struct ip6_mh *mh,
 		 const ssize_t len,

diff -urN src/mh.c.sav src/mh.c
--- src/mh.c.sav	2006-02-25 06:13:33.000000000 -0500
+++ src/mh.c	2006-03-23 11:55:53.000000000 -0500
@@ -87,7 +87,7 @@
 	1, /* PAD1 */ 
 	1, /* PADN */
 	0, /* BRR */
-	0, /* Alternate CoA */
+	1, /* Alternate CoA */
 	0, /* Nonce Index */
 	0, /* Binding Auth Data */
 };
@@ -734,10 +734,9 @@
 		if (op->ip6mhopt_type == IP6_MHOPT_BAUTH)
 			bauth = 1;
 
-		if (!mh_opts->opts[op->ip6mhopt_type])
+		if (!mh_opts->opts[op->ip6mhopt_type] ||
+		    mh_opts_dup_ok[op->ip6mhopt_type])
 			mh_opts->opts[op->ip6mhopt_type] = i;
-		else if (mh_opts_dup_ok[op->ip6mhopt_type])
-			mh_opts->opts_end[op->ip6mhopt_type] = i;
 		else
 			return -EINVAL;
 		left -= op->ip6mhopt_len + 2;

_______________________________________________
mipl mailing list
[EMAIL PROTECTED]
http://www.mobile-ipv6.org/cgi-bin/mailman/listinfo/mipl

Reply via email to