SPRING Working Group                                          F. Duchene
Internet-Draft                                            O. Bonaventure
Intended status: Informational                                 UCLouvain
Expires: September 6, 2018                                March 05, 2018


              A socket API to control IPv6 Segment Routing
                  draft-duchene-spring-srv6-socket-00

Abstract

   This document proposes a socket API to allow applications to control
   the utilisation of IPv6 Segment Routing (SRv6).

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on September 6, 2018.

Copyright Notice

   Copyright (c) 2018 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.






Duchene & Bonaventure   Expires September 6, 2018               [Page 1]


Internet-Draft               SRV6 socket API                  March 2018


Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
   2.  SRv6 Socket API . . . . . . . . . . . . . . . . . . . . . . .   2
     2.1.  Inserting an Segment Routing Header . . . . . . . . . . .   2
   3.  IANA considerations . . . . . . . . . . . . . . . . . . . . .   5
   4.  Security considerations . . . . . . . . . . . . . . . . . . .   5
   5.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . .   5
   6.  References  . . . . . . . . . . . . . . . . . . . . . . . . .   5
     6.1.  Normative References  . . . . . . . . . . . . . . . . . .   5
     6.2.  Informative References  . . . . . . . . . . . . . . . . .   5
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .   6

1.  Introduction

   Segment Routing [I-D.ietf-spring-segment-routing] was initially
   defined as a technique to enable network operators to better control
   the flow of packets inside their network.  Most use cases
   [I-D.ietf-spring-ipv6-use-cases]
   [I-D.ietf-spring-resiliency-use-cases]
   [I-D.filsfils-spring-srv6-network-programming]
   [I-D.ietf-spring-oam-usecase] leverage Segment Routing on routers
   only.  In contrast with the MPLS data plane that is traditionally
   only supported on routers, the IPv6 Segment Routing Header
   [I-D.ietf-6man-segment-routing-header] is supported on both routers
   [SR6Demo] and on endhosts [SR6Linux].  The ability of setting and
   processing the IPv6 Segment Routing Header on endhosts opens new
   "end-to-end" use cases for Segment Routing.  We can envision networks
   where clients set the IPv6 Segment Routing Header in all the packets
   they send to reach a given server along a specific path that depends
   on the client's or the network policies.

   In this document, we propose a socket option that enables
   applications to use the IPv6 Segment Routing Header on a per UDP
   datagram basis or a per TCP connection basis.

2.  SRv6 Socket API

   From an application viewpoint, the interaction with the underlying
   stack is performed using a socket option.  The socket option is set
   by using "setsockopt()".

2.1.  Inserting an Segment Routing Header

   A SRv6 routing header [I-D.ietf-6man-segment-routing-header] can be
   attached to a socket by calling "setsockopt()" with the option
   "IPV6_RTHDR".  The structure of a SRH is presented in figure
   Figure 1.



Duchene & Bonaventure   Expires September 6, 2018               [Page 2]


Internet-Draft               SRV6 socket API                  March 2018


     struct ipv6_sr_hdr {
           uint8_t         nexthdr;
           uint8_t         hdrlen;
           uint8_t         type;
           uint8_t         segments_left;
           uint8_t         first_segment;
           uint8_t         flags;
           uint16_t        reserved;

           struct in6_addr segments[0];
     };

                Figure 1: The SRv6 routing header structure

   Once the SRH has been attached to the socket, the packets will use
   the path described in the segments list of the SRH.  An example using
   a TCP connection from 2001:DB8:1111::1 to 2001:DB8:3333::1 and
   passing through 2001:DB8:2222::1 is shown in figure Figure 2.

































Duchene & Bonaventure   Expires September 6, 2018               [Page 3]


Internet-Draft               SRV6 socket API                  March 2018


     int fd, err, srh_len, n;
     struct ipv6_sr_hdr *srh;
     struct sockaddr_in6 sin6, sin6_bind;

     srh_len = sizeof(*srh) + 2 * sizeof(struct in6_addr);
     srh = malloc(srh_len);

     srh->nexthdr = 0;
     srh->hdrlen = 4;
     srh->type = 4;
     srh->segments_left = 1;
     srh->first_segment = 1;
     srh->flags = 0;
     srh->reserved = 0;

     /* Space for the destination segment */
     memset(&srh->segments[0], 0, sizeof(struct in6_addr));
     /* Adding the segment 2001:DB8:2222::1 to the segments list of
        the SRH */
     inet_pton(AF_INET6, "2001:DB8:2222::1", &srh->segments[1]);

     fd = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);

     err = setsockopt(fd, IPPROTO_IPV6, IPV6_RTHDR, srh, srh_len);

     memset(&sin6_bind, 0, sizeof(sin6_bind));
     sin6_bind.sin6_family = AF_INET6;
     inet_pton(AF_INET6, "2001:DB8:1111::1", &sin6_bind.sin6_addr);

     err = bind(fd, (struct sockaddr *)&sin6_bind, sizeof(sin6_bind));

     memset(&sin6, 0, sizeof(sin6));
     sin6.sin6_family = AF_INET6;
     sin6.sin6_port = htons(1234);
     inet_pton(AF_INET6, "2001:DB8:3333::1", &sin6.sin6_addr);

     err = connect(fd, (struct sockaddr *)&sin6, sizeof(sin6));


            Figure 2: Sample code to establish a TCP connection

   While figure Figure 2 shows a TCP connection, the same socket option
   can be applied to UDP sockets.








Duchene & Bonaventure   Expires September 6, 2018               [Page 4]


Internet-Draft               SRV6 socket API                  March 2018


3.  IANA considerations

   There are no IANA considerations in this document.

4.  Security considerations

   There are no security considerations in this document.

5.  Acknowledgements

   The initial implementation of the socket option was written by David
   Lebrun [LEBRUN17]

6.  References

6.1.  Normative References

   [I-D.ietf-6man-segment-routing-header]
              Previdi, S., Filsfils, C., Raza, K., Dukes, D., Leddy, J.,
              Field, B., daniel.voyer@bell.ca, d.,
              daniel.bernier@bell.ca, d., Matsushima, S., Leung, I.,
              Linkova, J., Aries, E., Kosugi, T., Vyncke, E., Lebrun,
              D., Steinberg, D., and R. Raszuk, "IPv6 Segment Routing
              Header (SRH)", draft-ietf-6man-segment-routing-header-08
              (work in progress), January 2018.

   [I-D.ietf-spring-segment-routing]
              Filsfils, C., Previdi, S., Ginsberg, L., Decraene, B.,
              Litkowski, S., and R. Shakir, "Segment Routing
              Architecture", draft-ietf-spring-segment-routing-15 (work
              in progress), January 2018.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997, <https://www.rfc-
              editor.org/info/rfc2119>.

   [RFC8200]  Deering, S. and R. Hinden, "Internet Protocol, Version 6
              (IPv6) Specification", STD 86, RFC 8200,
              DOI 10.17487/RFC8200, July 2017, <https://www.rfc-
              editor.org/info/rfc8200>.

6.2.  Informative References








Duchene & Bonaventure   Expires September 6, 2018               [Page 5]


Internet-Draft               SRV6 socket API                  March 2018


   [I-D.filsfils-spring-srv6-network-programming]
              Filsfils, C., Li, Z., Leddy, J., daniel.voyer@bell.ca, d.,
              daniel.bernier@bell.ca, d., Steinberg, D., Raszuk, R.,
              Matsushima, S., Lebrun, D., Decraene, B., Peirens, B.,
              Salsano, S., Naik, G., Elmalky, H., Jonnalagadda, P., and
              M. Sharif, "SRv6 Network Programming", draft-filsfils-
              spring-srv6-network-programming-04 (work in progress),
              March 2018.

   [I-D.ietf-spring-ipv6-use-cases]
              Brzozowski, J., Leddy, J., Filsfils, C., Maglione, R., and
              M. Townsley, "IPv6 SPRING Use Cases", draft-ietf-spring-
              ipv6-use-cases-12 (work in progress), December 2017.

   [I-D.ietf-spring-oam-usecase]
              Geib, R., Filsfils, C., Pignataro, C., and N. Kumar, "A
              Scalable and Topology-Aware MPLS Dataplane Monitoring
              System", draft-ietf-spring-oam-usecase-10 (work in
              progress), December 2017.

   [I-D.ietf-spring-resiliency-use-cases]
              Filsfils, C., Previdi, S., Decraene, B., and R. Shakir,
              "Resiliency use cases in SPRING networks", draft-ietf-
              spring-resiliency-use-cases-12 (work in progress),
              December 2017.

   [LEBRUN17]
              Lebrun, D., "Reaping the Benefits of IPv6 Segment
              Routing", 2017, <https://inl.info.ucl.ac.be/system/files/
              phdthesis-lebrun.pdf>.

   [SR6Demo]  Filsfils, C., Clad, F., Camarillo, P., Liste, J.,
              Jonnalagadda, P., Sharif, M., Salsano, S., and A.
              AbdelSalam, "IPv6 Segment Routing", SIGCOMM'17, Industrial
              demo , August 2017.

   [SR6Linux]
              Lebrun, D. and O. Bonaventure, "Implementing IPv6 Segment
              Routing in the Linux Kernel.", Applied Networking Research
              Workshop 2017 , July 2017,
              <http://www.segment-routing.org>.

Authors' Addresses

   Fabien Duchene
   UCLouvain

   Email: Fabien.Duchene@uclouvain.be



Duchene & Bonaventure   Expires September 6, 2018               [Page 6]


Internet-Draft               SRV6 socket API                  March 2018


   Olivier Bonaventure
   UCLouvain

   Email: Olivier.Bonaventure@uclouvain.be















































Duchene & Bonaventure   Expires September 6, 2018               [Page 7]