Commit 988b17bd authored by berge's avatar berge
Browse files

commit with BU problems when sending to CN

parent 9f483927
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -53,6 +53,12 @@ module LibIpv6_CommonRfcs_Templates {
			padding := c_2ZeroBytes
		}
		
		template OptPadN  m_optPad6 := {
			optType := 1,
			optLen := 2,
			padding := c_4ZeroBytes
		}
		
	}//end group paddingTemplates
	
	
+3 −0
Original line number Diff line number Diff line
@@ -295,3 +295,6 @@ module LibIpv6_CommonRfcs_TypesAndValues {


} // end LibIpv6_CommonRfcs_TypesAndValues
//with {
//	encode "LibIpv6_CommonRfcs_TypesAndValues";
//}
 No newline at end of file
+51 −40
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ group rfc2460Root_Functions {
									in Ipv6Packet p_ipv6Packet)
	runs on LibIpv6Node
	return FncRetCode {
		var FncRetCode v_ret := e_success;
		var UInt8 i;
		var Ipv6Address v_homeAddress := c_16ZeroBytes;
		var UInt8 v_nrOfTunnelHdr := 0;
@@ -79,19 +80,19 @@ group rfc2460Root_Functions {
		for (i:=0; i<sizeof(p_extHdrList);i:=i+1) {
			if (ischosen(p_extHdrList[i].mipHeader)) {
				if (f_isPresentHomeAddressOption(p_extHdrList, v_homeAddress) == e_success) {
					f_setMipHeader(	v_homeAddress,
					v_ret := f_setMipHeader(	v_homeAddress,
											p_dstAddr,
											p_extHdrList[i].mipHeader,
											p_ipv6Packet);	
				}
				else if (f_isPresentRoutingHeaderType2(p_extHdrList, v_homeAddress) == e_success) {
					f_setMipHeader(	p_srcAddr,
					v_ret := f_setMipHeader(	p_srcAddr,
									v_homeAddress,									
									p_extHdrList[i].mipHeader,
									p_ipv6Packet);	
				}
				else {
					f_setMipHeader(	p_srcAddr,
					v_ret := f_setMipHeader(	p_srcAddr,
									p_dstAddr,
									p_extHdrList[i].mipHeader,
									p_ipv6Packet);
@@ -102,11 +103,11 @@ group rfc2460Root_Functions {
				p_extHdrList[i].tunneledIpv6.payloadLength := fx_tunnelledPayloadLength(p_ipv6Packet, v_nrOfTunnelHdr);
			}
		/*	else if (ischosen(p_extHdrList[i].)) {
				f_setSecurityHdr();
				v_ret := f_setSecurityHdr();
			}  */
		}//end for

		return e_success;
		return v_ret;
	}//end f_setExtensionHeaders
		
	}//end group extHdrFns
@@ -155,8 +156,9 @@ group rfc3775Mipv6_ExtHdrFunctions {
			//     because it's assumed that the correct value was set on template level
			// 3) same applies to nonceIndex etc

			if (f_isPresentNonceIndices(p_mipHeader.mipMessage.bindingUpdateMsg, v_position) == e_success
				and vc_mipSec.mnSimuParams.receivedHomeNonceIndex != c_uInt16Zero
			// TODO Check this 
			if (f_isPresentNonceIndices(p_mipHeader.mipMessage.bindingUpdateMsg, v_position) == e_success) {
				if(vc_mipSec.mnSimuParams.receivedHomeNonceIndex != c_uInt16Zero
					and vc_mipSec.mnSimuParams.receivedCareOfNonceIndex != c_uInt16Zero) {
						p_mipHeader.mipMessage.bindingUpdateMsg.mipOptions[v_position].mipOptNonceIndices.homeNonceIndex
						:= vc_mipSec.mnSimuParams.receivedHomeNonceIndex;
@@ -167,30 +169,39 @@ group rfc3775Mipv6_ExtHdrFunctions {
					log("f_setMipHeader: Error: NonceIndices included in Binding Update, but mnSimuParams.receivedCareOfNonceIndex/receivedHomeNonceIndex not initialized");
					return e_error;	
				}
			if (f_isPresentBindingAuthorizationDataOption(p_mipHeader.mipMessage.bindingUpdateMsg, v_position) == e_success
				and vc_mipSec.mnSimuParams.receivedHomeKeygenToken != c_64ZeroBits
			}	
			if (f_isPresentBindingAuthorizationDataOption(p_mipHeader.mipMessage.bindingUpdateMsg, v_position) == e_success) {
				if(vc_mipSec.mnSimuParams.receivedHomeKeygenToken != c_64ZeroBits
					and vc_mipSec.mnSimuParams.receivedCareOfKeygenToken != c_64ZeroBits) {
				
					vc_mipSec.mnSimuParams.kbm := fx_integrity(		e_sha1_96, c_1ZeroByte,
						vc_mipSec.mnSimuParams.kbm := fx_integrity(		e_sha1, c_1ZeroByte,
																		bit2oct(vc_mipSec.mnSimuParams.receivedHomeKeygenToken)
																		& bit2oct(vc_mipSec.mnSimuParams.receivedCareOfKeygenToken));
																		
					var Oct20 v_bindingAuthenticator := fx_integrity(	e_hmac_sha1_96, vc_mipSec.mnSimuParams.kbm,
						//set Authenticator option with dummy Authenticator
						p_mipHeader.mipMessage.bindingUpdateMsg.mipOptions[v_position].mipBindingAuthorizationData := {
														mipOptType := 5,
														mipOptLen := 12,
														authenticator := c_12ZeroBytes}
																		
						//calculate the mipHeaderLength over the dummy Authenticator
						p_mipHeader.headerLen := fx_mipHeaderLength(p_mipHeader) ;
						
						//set Authenticator to omit in order to calc the authenticator
						p_mipHeader.mipMessage.bindingUpdateMsg.mipOptions[v_position].mipBindingAuthorizationData.authenticator := omit;
				
						p_mipHeader.mipMessage.bindingUpdateMsg.mipOptions[v_position].mipBindingAuthorizationData.authenticator 
						:= fx_integrity(	e_hmac_sha1_96, vc_mipSec.mnSimuParams.kbm,
											p_srcAddr//careOfaddr 
											& p_dstAddr//cnAddr
											& fx_mipHdrToOct(p_mipHeader) );

					p_mipHeader.mipMessage.bindingUpdateMsg.mipOptions[v_position].mipBindingAuthorizationData := {
							mipOptType := 5,
							mipOptLen := lengthof(v_bindingAuthenticator),
							authenticator := v_bindingAuthenticator
					}
				}
				else {
					log("f_setMipHeader: Error: BindingAuthorizationDataOption included in Binding Update, but receivedHomeKeygenToken/receivedCareOfKeygenToken not initialized");
					return e_error;	
				}
			}
		}
	//	else if (ischosen(p_mipHeader.mipMessage.bindingAck) and (PX_TEST_IPSEC == true)) {
		//SMU TODO
		//}
+25 −6
Original line number Diff line number Diff line
@@ -730,12 +730,12 @@

			template MipMessage mw_bindingAck(UInt16 p_seqNr) := {	
				bindingAckMsg := {
					status := c_mipCodeBindingUpdateAccepted,
					status := (c_mipCodeBindingUpdateAccepted, c_mipCodeAcceptedButPrefixDiscoveryNecessary),
					kFlag := ?,
					reserved := ?,
					sequenceNumber := p_seqNr,
					lifeTime := ?,		
					mipOptions := ?
					mipOptions := *
				}
			}

@@ -747,7 +747,7 @@
					reserved := ?,
					sequenceNumber := ?,
					lifeTime := ?,		
					mipOptions := ?
					mipOptions := *
				}
			}

@@ -762,7 +762,7 @@
					reserved := ?,
					sequenceNumber := p_seqNr,
					lifeTime := ?,		
					mipOptions := ?
					mipOptions := *
				}
			}

@@ -778,7 +778,7 @@
					reserved := ?,
					sequenceNumber := p_seqNr,
					lifeTime := ?,		
					mipOptions := ?
					mipOptions := *
				}
			}

@@ -975,6 +975,25 @@
				p_mipOpt3, p_mipOpt4
			}
			
			template MipOptionList m_mipOptList_5Elem (
										template MipOption p_mipOpt1, template MipOption p_mipOpt2,
										template MipOption p_mipOpt3, template MipOption p_mipOpt4,
										template MipOption p_mipOpt5) := {
										p_mipOpt1, p_mipOpt2,
										p_mipOpt3, p_mipOpt4,
										p_mipOpt5
									}
			
			
			template MipOptionList m_mipOptList_6Elem (
							template MipOption p_mipOpt1, template MipOption p_mipOpt2,
							template MipOption p_mipOpt3, template MipOption p_mipOpt4,
							template MipOption p_mipOpt5, template MipOption p_mipOpt6) := {
							p_mipOpt1, p_mipOpt2,
							p_mipOpt3, p_mipOpt4,
							p_mipOpt5, p_mipOpt6
						}

			template MipOption m_mipOpt_padN(template OptPadN p_optPadN) := {
				optPadN := p_optPadN
			}
+3 −0
Original line number Diff line number Diff line
@@ -307,3 +307,6 @@
	} // end  icmpRfc461Options
	
} // end module LibIpv6_Rfc2461NeighborDiscovery_TypesAndValues
//with {
//	encode "LibIpv6_Rfc2461NeighborDiscovery_TypesAndValues";
//}
 No newline at end of file
Loading