<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="info" docName="draft-ietf-dmm-ondemand-mobility-12"
     ipr="trust200902">

<!--
 This is a comment
-->
 
  <front>
    <title abbrev="On Demand Mobility">On Demand Mobility Management</title>

    <author fullname="Alper Yegin" initials="A." surname="Yegin">
      <organization abbrev="Actility">Actility</organization>

      <address>
        <postal>
          <street/>
          <city>Istanbul</city>
          <region/>
          <code/>
          <country>Turkey</country>
        </postal>
        <email>alper.yegin@actility.com</email>
      </address>
    </author>

    <author fullname="Danny Moses" initials="D." surname="Moses">
      <organization abbrev="Intel">Intel Corporation</organization>
      <address>
        <postal>
          <street/>
          <city>Petah Tikva</city>
          <region/>
          <code/>
          <country>Israel</country>
        </postal>
        <email>danny.moses@intel.com</email>
      </address>
    </author>

    <author fullname="Kisuk Kweon" initials="K." surname="Kweon">
      <organization abbrev="Samsung">Samsung</organization>
      <address>
        <postal>
          <street/>
          <city>Suwon</city>
          <region/>
          <code/>
          <country>South Korea</country>
        </postal>
        <email>kisuk.kweon@samsung.com</email>
      </address>
    </author>
    
    <author fullname="Jinsung Lee" initials="J." surname="Lee">
      <organization abbrev="Samsung">Samsung</organization>
      <address>
        <postal>
          <street/>
          <city>Suwon</city>
          <region/>
          <code/>
          <country>South Korea</country>
        </postal>
        <email>js81.lee@samsung.com</email>
      </address>
    </author>
    
    <author fullname="Jungshin Park" initials="J." surname="Park">
      <organization abbrev="Samsung">Samsung</organization>
      <address>
        <postal>
          <street/>
          <city>Suwon</city>
          <region/>
          <code/>
          <country>South Korea</country>
        </postal>
        <email>shin02.park@samsung.com</email>
      </address>
    </author>

    <author fullname="Seil Jeon" initials="S." surname="Jeon">
      <organization>Sungkyunkwan University</organization>
      <address>
        <postal>
          <street/>
          <city>Suwon</city>
          <region/>
          <code/>
          <country>South Korea</country>
        </postal>
        <email>seiljeon@skku.edu</email>
      </address>
    </author>
    <date/>

    <workgroup>DMM Working Group</workgroup>

    <abstract>
      <t>Applications differ with respect to whether they need IP session 
	  continuity and/or IP address reachability. The network providing the 
	  same type of service to any mobile host and any application running on 
	  the host yields inefficiencies. This document describes a solution for 
	  taking the application needs into account by selectively providing IP 
	  session continuity and IP address reachability on a per-socket 
	  basis.</t>
    </abstract>
  </front>

  
  
  <middle>
    <section anchor="introduction" title="Introduction">

        <t>In the context of Mobile IP <xref target="RFC5563"></xref><xref
            target="RFC6275"></xref><xref target="RFC5213"></xref><xref target="RFC5944"></xref>, 
			the following two attributes are defined for IP service provided to  
			mobile hosts:</t>
            
            <t>IP session continuity: The ability to maintain an ongoing IP session 
			by keeping the same local end-point IP address throughout the session 
			despite the mobile host changing its point of attachment within the IP 
			network topology. The IP address of the host may change between two 
			independent IP sessions, but that does not jeopardize its IP session 
			continuity. IP session continuity is essential for mobile hosts to 
			maintain ongoing flows without any interruption.</t>
            
            <t>IP address reachability: The ability to maintain the same IP address 
			for an extended period of time. The IP address stays the same across 
			independent IP sessions, and even in the absence of any IP session. The 
			IP address may be published in a long-term registry (e.g., DNS), and 
			is made available for serving incoming (e.g., TCP) connections. IP 
			address reachability is essential for mobile hosts to use 
			specific/published IP addresses.</t>
            
            <t>Mobile IP is designed to provide both IP session continuity and IP 
			address reachability to mobile hosts. Architectures utilizing these 
			protocols (e.g., 3GPP, 3GPP2, WIMAX) ensure that any mobile host 
			attached to the compliant networks can enjoy these benefits. Any 
			application running on these mobile hosts is subjected to the same 
			treatment with respect to IP session continuity and IP address 
			reachability.</t>
            
            <t>It should be noted that in reality not every application may need 
			these benefits. IP address reachability is required for applications 
			running as servers (e.g., a web server running on the mobile host). But, 
			a typical client application (e.g., web browser) does not necessarily 
			require IP address reachability. Similarly, IP session continuity is not 
			required for all types of applications either. Applications performing 
			brief communication (e.g., ping) can survive without having IP 
			session continuity support.</t>
            
            <t>Achieving IP session continuity and IP address reachability with 
			Mobile IP incurs some cost. Mobile IP protocol forces the mobile host's 
			IP traffic to traverse a centrally-located router (Home Agent,  HA), 
			which incurs additional transmission latency and use of additional 
			network resources, adds to the network CAPEX and OPEX, and decreases the 
			reliability of the network due to the introduction of a single point of 
			failure <xref target="RFC7333"></xref>. Therefore, IP session continuity 
			and IP address reachability should be provided only when necessary.</t>
            
            <t>Furthermore, when an application needs session continuity, it may be 
			able to satisfy that need by using a solution above the IP layer, such 
			as MPTCP <xref target="RFC6824"></xref>, SIP mobility <xref 
			target="RFC3261"></xref>, or an application-layer mobility solution. These 
			higher-layer solutions are not subject to the same issues that arise 
			with the use of Mobile IP since they can utilize the most direct data 
			path between the end-points. But, if Mobile IP is being applied to the 
			mobile host, the higher-layer protocols are rendered useless because 
			their operation is inhibited by Mobile IP. Since Mobile IP ensures 
			that the IP address of the mobile host remains fixed (despite the location 
			and movement of the mobile host), the higher-layer protocols never 
			detect the IP-layer change and never engage in mobility management.</t>
            
            <t>This document proposes a solution for applications running on 
			mobile hosts to indicate whether they need IP session continuity or IP 
			address reachability. The network protocol stack on the mobile host, in 
			conjunction with the network infrastructure, would provide the required 
			type of IP service. It is for the benefit of both the users and the 
			network operators not to engage an extra level of service unless it is 
			absolutely necessary. It is expected that applications and networks 
			compliant with this specification would utilize this solution to use 
			network resources more efficiently.</t>



    </section>

    <section anchor="notation" title="Notational Conventions">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in <xref
      target="RFC2119"></xref>.</t>

    </section>



    <section anchor="solution" title="Solution">

        <section anchor="addresstypes" title="Types of IP Addresses">
        
        <t> Four types of IP addresses are defined with respect to mobility 
		management.</t>
        
        <t>- Fixed IP Address</t>
        
        <t> A Fixed IP address is an address with a guarantee to be valid  for a 
		very long time, regardless of whether it is being used in any packet 
		to/from the mobile host, or whether or not the mobile host is 
		connected to the network, or whether it moves from one 
		point-of-attachment to another (with a different IP prefix) while it is 
		connected.</t>
        
		<t>Fixed IP addresses are required by applications that need both IP 
		session continuity and IP address reachability.</t>
        
        <t>- Session-lasting IP Address</t>
        
        <t>A session-lasting IP address is an address with a guarantee to be 
		valid throughout the IP session(s) for which it was requested. It is 
		guaranteed to be valid even after the mobile host had moved from one 
		point-of-attachment to another (with a different IP prefix).</t>

        <t>Session-lasting IP addresses are required by applications that need 
		IP session continuity but do not need IP address reachability.</t>
              
        <t>- Non-persistent IP Address</t>
        
        <t>This type of IP address does not provide IP session continuity nor 
		IP address reachability. The IP address is created from an IP prefix 
		that is obtained from the serving IP gateway and is not maintained across 
		gateway changes. In other words, the IP prefix may be released and replaced 
		by a new one when the IP gateway changes due to the movement of the mobile 
		host forcing the creation of a new source IP address with the updated 
		allocated IP prefix.</t>
        
        <t>- Graceful Replacement IP Address</t>
		<t>In some cases, the network cannot guarantee the validity of the provided 
		IP prefix throughout the duration of the IP session, but can provide a limited 
		graceful period of time in which both the original IP prefix and a new one are 
		valid. This enables the application some flexibility in the transition from the 
		existing source IP address to the new one.</t>

        <t>This gracefulness is still better than the non-persistence type of address 
		for applications that can handle a change in their source IP address but require 
		that extra flexibility.</t>
		
		<t>Applications running as servers at a published IP address require a 
		Fixed IP Address.  Long-standing applications (e.g., an SSH session) 
		may also require this type of address. Enterprise applications that 
		connect to an enterprise network via virtual LAN require a Fixed IP 
		Address.</t>
        
        <t>Applications with short-lived transient IP sessions can use 
		Session-lasting IP Addresses. For example: Web browsers.</t>
        
        <t>Applications with very short IP sessions, such as DNS clients and 
		instant messengers, can utilize Non-persistent IP Addresses. Even 
		though they could very well use Fixed or Session-lasting IP 
		Addresses, the transmission latency would be minimized when a 
		Non-persistent IP Addresses are used.</t>

        <t>Applications that can tolerate a short interruption in connectivity 
		can use the Graceful-replacement IP addresses. For example, a streaming 
		client that has buffering capabilities.</t>
		
		</section>
        
        <section anchor="granularity" title="Granularity of Selection">
        
        <t>IP address type selection is made on a per-socket granularity. 
		Different parts of the same application may have different needs. For 
		example, the control-plane of an application may require a Fixed IP 
		Address in order to stay reachable, whereas the data-plane of the same 
		application may be satisfied with a Session-lasting IP Address.</t>
        </section>
        
        <section anchor="ondemand" title="On Demand Nature">
            
        
        <t>At any point in time, a mobile host may have a combination of IP 
		addresses configured. Zero or more Non-persistent, zero or more 
		Session-lasting, zero or more Fixed and zero or more Graceful-Replacement 
		IP addresses may be configured by the IP stack of the host. The 
		combination may be as a result of the host policy, application demand, 
		or a mix of the two.</t>
        
        <t>When an application requires a specific type of IP address and such 
		an address is not already configured on the host, the IP stack shall 
		attempt to configure one. For example, a host may not always have a 
		Session-lasting IP address available. When an application requests 
		one, the IP stack shall make an attempt to configure one by issuing a 
		request to the network (see <xref target="conveying"></xref> below  
		for more details). If the operation fails, the IP stack shall 
		fail the associated socket request and return an error. If successful, 
		a Session-lasting IP Address gets configured on the mobile host. If 
		another socket requests a Session-lasting IP address at a later time, 
		the same IP address may be served to that socket as well. When the last 
		socket using the same configured IP address is closed, the IP address 
		may be released or kept for future applications that may be launched 
		and require a Session-lasting IP address.</t>
		
		<t>In some cases it might be preferable for the mobile host to request 
		a new Session-lasting IP address for a new opening of an IP session 
		(even though one was already assigned to the mobile host by the 
		network and might be in use in a different, already active IP 
		session).  It is outside the scope of this specification to define 
		criteria for choosing to use available addresses or choosing to request 
		new ones. It supports both alternatives (and any combination).</t>
		
		<t>It is outside the scope of this specification to define how the 
		host requests a specific type of prefix and how the network indicates 
		the type of prefix in its advertisement or in its reply to a request).</t>
        
		<t>The following are matters of policy, which may be dictated by the 
		host itself, the network operator, or the system architecture 
		standard:</t>
        
        <t> - The initial set of IP addresses configured on the host at boot 
		time.</t>
        <t>- Permission to grant various types of IP addresses to a requesting 
		application.</t>
        <t>- Determination of a default address type when an application does 
		not make any explicit indication, whether it already supports the 
		required API or it is just a legacy application.</t>
        
        </section>
        
        <section anchor="conveying" title="Conveying the Desired Address Type">

		<t><xref target="RFC5014"></xref> introduced the ability of applications 
		to influence the source address selection with the IPV6_ADDR_PREFERENCE 
		option at the IPPROTO_IPV6 level. This option is used with setsockopt() 
		and getsockopt() calls to set/get address selection preferences.</t>
		
		<t>Extending this further by adding more flags does not work when a request 
		for an address of a certain type results in requiring the IP stack to wait 
		for the network to provide the desired source IP prefix and hence causing 
		the setsockopt() call to block until the prefix is allocated (or an 
		error indication from the network is received).</t>
		
		<t>Alternatively a new Socket API is defined - getsc() which allows 
		applications to express their desired type of session continuity service. 
		The new getsc() API will return an IPv6 address that is associated with the 
		desired session continuity service and with status information indicating 
		whether or not the desired service was provided.</t>
        
		<t>An application that wishes to secure a desired service will call getsc() 
		with the service type definition and a place to contain the provided IP address, 
		and call bind() to associate that IP address with the Socket (See pseudo-code 
		example in <xref target="usageexample"></xref> below).</t>
		
		<t>When the IP stack is required to use a source IP address of a specified type,
		it can use an existing address, or request a new IP prefix (of the
        same type) from the network and create a new one. If the host does not already 
		have an IPv6 prefix of that specific type, it must request one from the network.</t>
		
		<t>Using an existing address from an existing prefix is faster but might yield 
		a less optimal route (if a hand-off event occurred after its configuration). On 
		the other hand, acquiring a new IP prefix from the network may be slower due to 
		signaling exchange with the network.</t>
		
		<t>Applications can control the stack's operation by setting a new flag  - 
	    ON_NET flag - which directs the IP stack whether to use a preconfigured source
		IP address (if exists) or to request a new IPv6 prefix from the current serving 
		network and configure a new IP address.</t>
		
		<t>This new flag is added to the set of flags in the IPV6_ADDR_PREFERENCES option 
		at the IPPROTO_IPV6 level. It is used in setsockopt() to set the desired 
		behavior.</t>
		

		</section>

    </section>
	
	
    <section anchor="usageexample" title="Usage example">
	<t>The following example shows pseudo-code for creating a Stream socket (TCP)
	with a Session-Lasting source IP address:</t>

	<figure>
	  <artwork><![CDATA[
	  
#include <sys/socket.h>
#include <netinnet/in.h>

  // Socket information
int              s ;                // Socket id

  // Source information (for secsc() and bind())
sockaddr_in6     sourceInfo         // my address and port for bind()
in6_addr         sourceAddress      // will contain the provisioned source 
                                    // IP address
uint8_t          sc_type = IPV6_REQUIRE_SESSION_LASTING_IP ; 
                                    // For requesting a Session-Lasting 
                                    // source IP address

  // Destination information (for connect())
sockaddr_in6     serverInfo ;       // server info for connect()

  // Create an IPv6 TCP socket
s = socket(AF_INET6, SOCK_STREAM, 0) ;
if (s!=0) {
      // Handle socket creation error
      // ...
} // if socket creation failed
else {
       // Socket creation is successful
       // The application cannot connect yet, since it wants to use a 
       // Session-Lasting source IP address It needs to request the 
       // Session-Lasting source IP before connecting
     if (setsc(s, &sourceAddress, &sc_type)) == 0){
          // setting session continuity to Session Lasting is successful
          // sourceAddress now contains the Session-Lasting source IP 
          // address

          // Bind to that source IP address
        sourceInfo.sin6_family = AF_INET6 ;
        sourceInfo.sin6_port = 0    // let the stack choose the port
        sourceInfo.sin6_address = sourceAddress ;
                                    // Use the source address that was 
                                    // generated by the setsc() call
        if (bind(s, &sourceInfo, sizeof(sourceInfo))==0){
             // Set the desired server's information for connect()
           serverInfo.sin6_family = AF_INET6 ;
           serverInfo.sin6_port = SERVER_PORT_NUM ;
           serverAddress.sin6_addr = SERVER_IPV6_ADDRESS ;

             // Connect to the server
           if (connect(s, &serverInfo, sizeof(serverInfo))==0) {
               // connect successful (3-way handshake has been completed 
               // with Session-Lasting source address.
               // Continue application functionality
               // ...
           }  // if connect() is successful
           else {
               // connect failed
               // ...
               // Application code that handles connect failure and closes 
               // the socket
               // ...
           } // if connect() failed
        } // if bind() successful
        else {
               // bind() failed
               // ...
               // Application code that handles bind failure and closes 
               // the socket
               // ...
	    } // if bind() failed
     }  // if setsc() was successful and of a Session-Lasting source address was provided
     else {
          // application code that does not use Session-lasting IP address
          // The application may either connect without the desired 
          // Session-lasting service, or close the socket
          //...
     } // if setsc() failed
}  // if socket was created successfully

  // The rest of the application's code
  // ...


	  
	  ]]></artwork>
	</figure>
    </section>
  
    <section anchor="compatibility" title="Backwards Compatibility Considerations">
	<t> Backwards compatibility support is required by the following 3 types 
	of entities: </t>
	<t>- The Applications on the mobile host</t>
	<t>- The IP stack in the mobile host</t>
	<t>- The network infrastructure </t>
   
    <section anchor="applications" title="Applications">
	<t>Legacy applications that do not support the OnDemand functionality will use 
	the legacy API and will not be able to take advantage of the On-Demand 
	Mobility feature. </t>	
	<t> Applications using the new OnDemand functionality must be aware that 
	they may be	executed in legacy environments that do not support it. Such 
	environments may include a legacy IP stack on the mobile host, legacy network 
	infrastructure, or both. In either case, the API will return an error code and 
	the invoking applications may just give up and use legacy calls. </t>
    </section>

    <section anchor="stack" title="IP Stack in the Mobile Host">
	<t>New IP stacks must continue to support all legacy operations. If an 
	application does not use On-Demand functionality, the IP stack must 
	respond in a legacy manner.</t>
		<t> If the network infrastructure supports On-Demand functionality, 
	the IP stack should follow the application request: If the application 
	requests a specific address type, the stack should forward this 
	request to the network. If the application does not request an address 
	type, the IP stack must not request an address type and leave it to 
	the network's default behavior to choose the type of the allocated IP 
	prefix. If an IP prefix was already allocated to the host, the IP 
	stack uses it and may not request a new one from the network.</t>
	    </section>

    <section anchor="network" title="Network Infrastructure">

	<t> The network infrastructure may or may not support the On-Demand 
	functionality. How the IP stack on the host and the network 
	infrastructure behave in case of a compatibility issue is outside the 
	scope of this API specification. </t>

    </section>

    <section anchor="RFC5014ref" title="Merging this work with RFC5014">
	<t><xref target="RFC5014"></xref> defines new flags that may be used with 
	setsockopt() to influence source IP address selection for a socket. The list of 
	flags include: source home address, care-of address, temporary address, public 
	address CGA (Cryptographically Created Address) and non-CGA. When applications 
	require session continuity service and use setsc() and bind(), they should not 
	set the flags specified in <xref target="RFC5014"></xref>.</t>

	<t>However, if an application sets a specific option using setsockopt() with 
	one of the flags specified in <xref target="RFC5014"></xref> and also selects 
	a source IP address using setsc() and bind() the IP address that was generated 
	by setsc() and bound using bind() will be the one used by traffic generated 
	using that socket and options set by setsockopt() will be ignored.</t>

	<t>If bind() was not invoked after setsc() by the application, the IP address 
	generated by setsc() will not be used and traffic generated by the socket will 
	use a source IP address that complies with the options selected by 
	setsockopt().</t>
	
    </section>



  </section>


 
	<section anchor="summary" title="Summary of New Definitions">

		<section anchor="apis" title="New APIs">
		<t>setsc() enables applications to request a specific type of source IP address
		in terms of session continuity. Its definition is:</t>
	<figure>
	  <artwork><![CDATA[
int setsc (int sockfd, in6_addr *sourceAddress, sc_type addressType) ;

Where:
 - sockfd -        is the socket descriptor of the socket with which a 
                   specific address type is associated
 - sourceAddress - is a pointer to an area allocated for setsc() to place 
                   the generated source IP address of the desired session 
				   continuity type		
 - addressType -   Is the desired type of session continuity service. 
                   It is a 3-bit field containing one of the following 
				   values:
                   0 - Reserved
                   1 - FIXED_IPV6_ADDRESS
                   2 - SESSION_LASTING_IPV6_ADDRESS
                   3 - NON_PERSISTENT_IPV6_ADDRESS
                   4 - GRACEFUL_REPLACEMENT_IPV6_ADDRESS
                   5-7 - Reserved

setsc() returns the status of the operation:
 - 0 - Address was successfully generated
 - EAI_REQUIREDIPNOTSUPPORTED - the required service type is not supported
 - EAI_REQUIREDIPFAILED - the network could not fulfill the desired request 
		
	  ]]></artwork>
	</figure>

		<t>setsc() may block the invoking thread if it triggers the TCP/IP stack to 
		request a new IP prefix from the network to construct the desired source IP address. 
		If an IP prefix with the desired session continuity features already exists (was 
		previously allocated to the mobile host) and the stack is not required to request 
		a new one as a result of setting the IPV6_REQUIRE_SRC_ON_NET flag (defined below), 
		setsc() may return immediately with the constructed IP address and will not block 
		the thread.</t>
		</section>
		
		<section anchor="flags" title="New Flags">
		<t>The following flag is added to the list of flags in the 
		IPV6_ADDR_PREFERENCE option at the IPPROTO6 level:</t>
	<figure>
	  <artwork><![CDATA[
IPV6_REQUIRE_SRC_ON_NET - set IP stack address allocation behavior
	  ]]></artwork>
	</figure>
		<t>If set, the IP stack will request a new IPv6 prefix of the desired type from 
		the current serving network and configure a new source IP address. If reset, 
		the IP stack will use a preconfigured one if it exists. If there is no 
		preconfigured IP address of the desired type, a new prefix will be requested and 
		used for creating the IP address.</t>
		</section>
		
	</section>

	<section anchor="security" title="Security Considerations">
	<t> The setting of certain IP address type on a given socket may be 
	restricted to privileged applications. For example, a Fixed IP Address 
	may be provided as a premium service and only certain applications may 
	be allowed to use them.  Setting and enforcement of such privileges are 
	outside the scope of this document.</t>
   
	</section>

    <section anchor="iana" title="IANA Considerations">
      <t>This document has no IANA considerations.</t>
    </section>

    <section anchor="contributor" title="Contributors">
	  <t>This document was merged with <xref target="I-D.sijeon-dmm-use-cases-api-source"></xref>. 
	  We would like to acknowledge the contribution of the following people to that document as 
	  well:</t>

	  <figure>
<artwork><![CDATA[
Sergio Figueiredo
Altran Research, France
Email: sergio.figueiredo@altran.com
	  
Younghan Kim
Soongsil University, Korea
Email: younghak@ssu.ac.kr
	  
John Kaippallimalil
Huawei, USA
Email: john.kaippallimalil@huawei.com
]]></artwork>
	</figure>
	  
	  
	</section>
	
	<section anchor="ack" title="Acknowledgements">
      <t>We would like to thank Wu-chi Feng, Alexandru Petrescu, Jouni Korhonen, 
	  Sri Gundavelli, Dave Dolson and Lorenzo Colitti for their valuable comments 
	  and suggestions on this work.</t>
    </section>


    
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>

      
        <?rfc include='reference.RFC.6724'?>
        <?rfc include='reference.RFC.5014'?>
        
      
      
    </references>

    <references title="Informative References">
        
        <?rfc include='reference.RFC.6275'?>
        
        
        <?rfc include='reference.RFC.5944'?>
        <?rfc include='reference.RFC.7333'?>
        <?rfc include='reference.RFC.5563'?>
        <?rfc include='reference.RFC.5213'?>
        <?rfc include='reference.RFC.6824'?>
        <?rfc include='reference.RFC.3261'?>
		<?rfc include='reference.I-D.sijeon-dmm-use-cases-api-source'?>


      

      <!---->
    </references>
  </back>
</rfc>

