[PATCH v2 00/11] Add support for MPLS routes and encapsulations

David Ahern dsahern at gmail.com
Thu Aug 17 15:59:27 PDT 2017


This patch set adds support for the MPLS address family (LSP and egress)
and MPLS encapsulations (ingress to LSP).

Patches 1, 2 and 8 update or import header files from the kernel tree.

Patch 3 imports mpls_ntop and mpls_pton from iproute2. These are known
working implementations so no since re-inventing those wheels.

Patch 4 adds support to addr.c for MPLS labels as an nl_addr.

Patch 5 adds support for routes in the MPLS address family. MPLS uses
2 new address attributes - RTA_NEWDST and RTA_VIA - per nexthop.
RTA_NEWDST is the label stack to be applied on a forward and RTA_VIA
is the nexthop for the packet (e.g., an IPv4 or IPv6 address).

Patch 6 adds support for TTL propagation attribute per route. This
attribute sets whether the TTL is propagated on tunnel egress.

Patch 7 adds support for MPLS labels to the commands under src. The
'as' keyword is added as a nexthop option where the value is one or
more labels (NEWDST to attribute). The via keyword is updated to use
RTA_VIA if the route is added or deleted to the MPLS family.

Patch 9 adds support for lwtunnel encapsulation as a generic framework
with Patch 10 adding MPLS encapsulation support.

Patch 11 adds support for MPLS encap to the commands under src

v2
- Address Thomas' feedback:
  - moved mpls.h to netlink-private
  - limited the ROUTE_ATTR_PRIO change to just not setting the attr
    bit in the mask by default for MPLS
  - fixed mask for ROUTE_ATTR_TTL_PROPAGATE
  - add rtnl_route_get_ttl_propagate
  - Added free of encap private data if the encap is changed on a nh

David Ahern (11):
  Update rtnetlink.h from kernel tree
  Import mpls header from kernel tree
  addr: Add implementations for mpls_ntop and mpls_pton
  addr: Add support for AF_MPLS
  route: Add support for MPLS address family
  route: Add support for ttl propagation in MPLS routes
  Add support for label stack in nl-route commands
  Import lwtunnel encap files from kernel
  route: Add support for lwtunnel encapsulations
  route: Add support for MPLS encap
  Add support for mpls encap to libnl commands

 Makefile.am                                   |   5 +-
 include/linux-private/linux/lwtunnel.h        |  69 +++++++++
 include/linux-private/linux/mpls.h            |  76 ++++++++++
 include/linux-private/linux/mpls_iptunnel.h   |  30 ++++
 include/linux-private/linux/rtnetlink.h       |  18 ++-
 include/netlink-private/route/mpls.h          |  15 ++
 include/netlink-private/route/nexthop-encap.h |  35 +++++
 include/netlink-private/types.h               |  11 ++
 include/netlink/route/nexthop.h               |  12 ++
 include/netlink/route/route.h                 |   3 +
 lib/addr.c                                    |  56 ++++++--
 lib/mpls.c                                    | 108 ++++++++++++++
 lib/route/nexthop.c                           | 131 +++++++++++++++++
 lib/route/nexthop_encap.c                     |  99 +++++++++++++
 lib/route/nh_encap_mpls.c                     | 134 +++++++++++++++++
 lib/route/route.c                             |   1 +
 lib/route/route_obj.c                         | 200 ++++++++++++++++++++++++--
 libnl-route-3.sym                             |   7 +
 src/lib/route.c                               |  26 +++-
 19 files changed, 1011 insertions(+), 25 deletions(-)
 create mode 100644 include/linux-private/linux/lwtunnel.h
 create mode 100644 include/linux-private/linux/mpls.h
 create mode 100644 include/linux-private/linux/mpls_iptunnel.h
 create mode 100644 include/netlink-private/route/mpls.h
 create mode 100644 include/netlink-private/route/nexthop-encap.h
 create mode 100644 lib/mpls.c
 create mode 100644 lib/route/nexthop_encap.c
 create mode 100644 lib/route/nh_encap_mpls.c

-- 
2.1.4




More information about the libnl mailing list