diff options
| author | David Ahern <dsahern@gmail.com> | 2017-08-17 15:59:36 -0700 |
|---|---|---|
| committer | Thomas Haller <thaller@redhat.com> | 2017-08-18 15:01:04 +0200 |
| commit | 0164d57aee542507942b1f746d9ff3140d61658b (patch) | |
| tree | a6d9f71c479c5509e414dff149af0428f8b86f5d /include | |
| parent | 000a792c7b2b3cffa731c8170eb9c969b569d8a9 (diff) | |
| download | platform_external_libnl-0164d57aee542507942b1f746d9ff3140d61658b.tar.gz platform_external_libnl-0164d57aee542507942b1f746d9ff3140d61658b.tar.bz2 platform_external_libnl-0164d57aee542507942b1f746d9ff3140d61658b.zip | |
route: Add support for lwtunnel encapsulations
Add framework to support lwtunnel encapsulations per nexthop.
Encapsulations types are expected to fill in the nh_encap_ops for
building and parsing messages, compare encapsulations in routes,
dumping the encapsulations and freeing memory.
Signed-off-by: David Ahern <dsahern@gmail.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/netlink-private/route/nexthop-encap.h | 30 | ||||
| -rw-r--r-- | include/netlink-private/types.h | 8 |
2 files changed, 38 insertions, 0 deletions
diff --git a/include/netlink-private/route/nexthop-encap.h b/include/netlink-private/route/nexthop-encap.h new file mode 100644 index 0000000..ba96b0d --- /dev/null +++ b/include/netlink-private/route/nexthop-encap.h @@ -0,0 +1,30 @@ +#ifndef NETLINK_NEXTHOP_ENCAP_H_ +#define NETLINK_NEXTHOP_ENCAP_H_ + +struct nh_encap_ops { + uint16_t encap_type; + + int (*build_msg)(struct nl_msg *msg, void *priv); + int (*parse_msg)(struct nlattr *nla, struct rtnl_nexthop *rtnh); + + int (*compare)(void *a, void *b); + + void (*dump)(void *priv, struct nl_dump_params *dp); + void (*destructor)(void *priv); +}; + +struct rtnl_nh_encap; + +/* + * generic nexthop encap + */ +void nh_set_encap(struct rtnl_nexthop *nh, struct rtnl_nh_encap *rtnh_encap); + +int nh_encap_parse_msg(struct nlattr *encap, struct nlattr *encap_type, + struct rtnl_nexthop *rtnh); +int nh_encap_build_msg(struct nl_msg *msg, struct rtnl_nh_encap *rtnh_encap); + +void nh_encap_dump(struct rtnl_nh_encap *rtnh_encap, struct nl_dump_params *dp); + +int nh_encap_compare(struct rtnl_nh_encap *a, struct rtnl_nh_encap *b); +#endif diff --git a/include/netlink-private/types.h b/include/netlink-private/types.h index 5d165b6..35c9689 100644 --- a/include/netlink-private/types.h +++ b/include/netlink-private/types.h @@ -23,6 +23,7 @@ #include <netlink-private/object-api.h> #include <netlink-private/route/tc-api.h> #include <netlink-private/route/link/sriov.h> +#include <netlink-private/route/nexthop-encap.h> #include <linux/netlink.h> #include <linux/rtnetlink.h> #include <linux/genetlink.h> @@ -300,6 +301,12 @@ struct rtnl_addr struct rtnl_link *a_link; }; +struct rtnl_nh_encap +{ + struct nh_encap_ops *ops; + void *priv; /* private data for encap type */ +}; + struct rtnl_nexthop { uint8_t rtnh_flags; @@ -313,6 +320,7 @@ struct rtnl_nexthop uint32_t rtnh_realms; struct nl_addr * rtnh_newdst; struct nl_addr * rtnh_via; + struct rtnl_nh_encap * rtnh_encap; }; struct rtnl_route |
