summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSusant Sahani <susant@redhat.com>2014-04-25 22:51:22 +0530
committerThomas Haller <thaller@redhat.com>2014-05-05 19:08:23 +0200
commit57bdc4ff4895dd91cc723d22eecadcf48945e87c (patch)
tree345995ee149e0a6485950d0360f523333a115826 /doc
parent3a95fad5c92031201eeb83786057249f237c56ce (diff)
downloadlibnl-57bdc4ff4895dd91cc723d22eecadcf48945e87c.tar.gz
introduce gre tunnel support
This patch introduces gre tunnel support Signed-off-by: Susant Sahani <susant@redhat.com> Acked-by: Thomas Graf <tgraf@suug.ch> [thaller@redhat.com: change WS to TAB, fix code doc] Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/route.txt79
1 files changed, 79 insertions, 0 deletions
diff --git a/doc/route.txt b/doc/route.txt
index e5f06f75..746201a3 100644
--- a/doc/route.txt
+++ b/doc/route.txt
@@ -924,6 +924,85 @@ if((err = rtnl_link_add(sk, link, NLM_F_CREATE)) < 0)
rtnl_link_put(link);
-----
+[[link_ipgre]]
+==== IPGRE
+
+[source,c]
+-----
+extern struct rtnl_link *rtnl_link_ipgre_alloc(void);
+extern int rtnl_link_ipgre_add(struct nl_sock *sk, const char *name);
+
+extern int rtnl_link_ipgre_set_link(struct rtnl_link *link, uint32_t index);
+extern uint32_t rtnl_link_ipgre_get_link(struct rtnl_link *link);
+
+extern int rtnl_link_ipgre_set_iflags(struct rtnl_link *link, uint16_t iflags);
+extern uint16_t rtnl_link_get_iflags(struct rtnl_link *link);
+
+extern int rtnl_link_ipgre_set_oflags(struct rtnl_link *link, uint16_t oflags);
+extern uint16_t rtnl_link_get_oflags(struct rtnl_link *link);
+
+extern int rtnl_link_ipgre_set_ikey(struct rtnl_link *link, uint32_t ikey);
+extern uint32_t rtnl_link_get_ikey(struct rtnl_link *link);
+
+extern int rtnl_link_ipgre_set_okey(struct rtnl_link *link, uint32_t okey);
+extern uint32_t rtnl_link_get_okey(struct rtnl_link *link)
+
+extern int rtnl_link_ipgre_set_local(struct rtnl_link *link, uint32_t addr);
+extern uint32_t rtnl_link_ipgre_get_local(struct rtnl_link *link);
+
+extern int rtnl_link_ipgre_set_remote(struct rtnl_link *link, uint32_t addr);
+extern uint32_t rtnl_link_ipgre_get_remote(struct rtnl_link *link);
+
+extern int rtnl_link_ipgre_set_ttl(struct rtnl_link *link, uint8_t ttl);
+extern uint8_t rtnl_link_ipgre_get_ttl(struct rtnl_link *link);
+
+extern int rtnl_link_ipgre_set_tos(struct rtnl_link *link, uint8_t tos);
+extern uint8_t rtnl_link_ipgre_get_tos(struct rtnl_link *link);
+
+extern int rtnl_link_ipgre_set_pmtudisc(struct rtnl_link *link, uint8_t pmtudisc);
+extern uint8_t rtnl_link_ipgre_get_pmtudisc(struct rtnl_link *link);
+
+-----
+
+.Example: Add a ipgre tunnel device
+[source,c]
+-----
+struct rtnl_link *link
+struct in_addr addr
+
+/* allocate new link object of type vxlan */
+if(!(link = rtnl_link_ipgre_alloc()))
+ /* error */
+
+/* set ipgre tunnel name */
+if ((err = rtnl_link_set_name(link, "ipgre-tun")) < 0)
+ /* error */
+
+/* set link index */
+if ((err = rtnl_link_ipgre_set_link(link, if_index)) < 0)
+ /* error */
+
+/* set local address */
+inet_pton(AF_INET, "192.168.254.12", &addr.s_addr);
+if ((err = rtnl_link_ipgre_set_local(link, addr.s_addr)) < 0)
+ /* error */
+
+/* set remote address */
+inet_pton(AF_INET, "192.168.254.13", &addr.s_addr
+if ((err = rtnl_link_ipgre_set_remote(link, addr.s_addr)) < 0)
+ /* error */
+
+/* set tunnel ttl */
+if ((err = rtnl_link_ipgre_set_ttl(link, 64)) < 0)
+ /* error */
+
+if((err = rtnl_link_add(sk, link, NLM_F_CREATE)) < 0)
+ /* error */
+
+rtnl_link_put(link);
+-----
+
+
== Neighbouring
== Routing