Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Accept Binding Ack. after checking binding authentication is valid.

  • Loading branch information...
commit 57f8e3bfe4fc66cb78fbde6ecc1a8706a386c012 1 parent 5208187
authored October 05, 2002
26  kame/sys/netinet6/mip6_pktproc.c
... ...
@@ -1,4 +1,4 @@
1  
-/*	$KAME: mip6_pktproc.c,v 1.65 2002/10/04 08:58:23 t-momose Exp $	*/
  1
+/*	$KAME: mip6_pktproc.c,v 1.66 2002/10/05 18:33:25 t-momose Exp $	*/
2 2
 
3 3
 /*
4 4
  * Copyright (C) 2002 WIDE Project.  All rights reserved.
@@ -870,6 +870,30 @@ mip6_ip6ma_input(m, ip6ma, ip6malen)
870 870
                 return (EINVAL);
871 871
 	}
872 872
 
  873
+	if (mopt.valid_options & MOPT_AUTHDATA) {
  874
+		/* Check Autheticator */
  875
+		u_int8_t key_bu[MIP6_KBU_LEN];
  876
+		u_int8_t authdata[MIP6_AUTHENTICATOR_LEN];
  877
+		u_int16_t cksum_backup;
  878
+
  879
+		cksum_backup = ip6ma->ip6ma_cksum;
  880
+		ip6ma->ip6ma_cksum = 0;
  881
+		/* Calculate K_bu */
  882
+		mip6_calculate_kbu(&mbu->mbu_home_cookie,
  883
+				   &mbu->mbu_careof_cookie, key_bu);
  884
+		/* Calculate Authenticator */
  885
+		mip6_calculate_authenticator(key_bu, authdata,
  886
+			&mbu->mbu_coa.sin6_addr, &ip6->ip6_dst,
  887
+			(caddr_t)ip6ma, ip6malen,
  888
+			(caddr_t)mopt.mopt_auth + 2 - (caddr_t)ip6ma,
  889
+			min(MOPT_AUTH_LEN(&mopt) + 2, MIP6_AUTHENTICATOR_LEN));
  890
+		ip6ma->ip6ma_cksum = cksum_backup;
  891
+		if (bcmp(authdata, mopt.mopt_auth + 2,
  892
+			 min(MOPT_AUTH_LEN(&mopt) + 2, MIP6_AUTHENTICATOR_LEN))
  893
+			 == 0)
  894
+			goto accept_binding_ack;
  895
+	}
  896
+
873 897
 	if (!mip6_config.mcfg_use_ipsec && (mbu->mbu_flags & IP6MU_HOME)) {
874 898
 		ba_safe = 1;
875 899
 		goto accept_binding_ack;
4  kame/sys/netinet6/mip6_var.h
... ...
@@ -1,4 +1,4 @@
1  
-/*	$KAME: mip6_var.h,v 1.60 2002/10/02 11:16:00 t-momose Exp $	*/
  1
+/*	$KAME: mip6_var.h,v 1.61 2002/10/05 18:33:25 t-momose Exp $	*/
2 2
 
3 3
 /*
4 4
  * Copyright (C) 2001 WIDE Project.  All rights reserved.
@@ -276,7 +276,7 @@ struct mip6_mobility_options {
276 276
 #define MOPT_AUTHDATA	0x0008
277 277
 #define MOPT_REFRESH	0x0010
278 278
 
279  
-#define MOPT_AUTH_LEN(mopt)	(int)(*(mopt->mopt_auth + 1))
  279
+#define MOPT_AUTH_LEN(mopts)	(int)(*((mopts)->mopt_auth + 1))
280 280
 
281 281
 /*
282 282
  * the list entry to hold the destination addresses which do not use a

0 notes on commit 57f8e3b

Please sign in to comment.
Something went wrong with that request. Please try again.