diff options
author | Susant Sahani <susant@redhat.com> | 2014-04-24 17:46:27 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-05-05 16:08:47 (GMT) |
commit | 3a95fad5c92031201eeb83786057249f237c56ce (patch) | |
tree | 1a71f21174eef7de59245476fe597a12059c3515 /doc | |
parent | 0482cdcddbf3118dbc3be0144bca06817718db07 (diff) | |
download | libnl-3a95fad5c92031201eeb83786057249f237c56ce.zip libnl-3a95fad5c92031201eeb83786057249f237c56ce.tar.gz libnl-3a95fad5c92031201eeb83786057249f237c56ce.tar.bz2 |
introduce ipip tunnel support
This patch introduces ipip tunnel support. This
works with kernel module ipip.
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.txt | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/doc/route.txt b/doc/route.txt index 922ba7b..e5f06f7 100644 --- a/doc/route.txt +++ b/doc/route.txt @@ -858,6 +858,72 @@ if ((err = rtnl_link_add(sk, link, NLM_F_CREATE)) < 0) rtnl_link_put(link); ----- +[[link_ipip]] +==== IPIP + +[source,c] +----- +extern struct rtnl_link *rtnl_link_ipip_alloc(void); +extern int rtnl_link_ipip_add(struct nl_sock *sk, const char *name); + +extern int rtnl_link_ipip_set_link(struct rtnl_link *link, uint32_t index); +extern uint32_t rtnl_link_ipip_get_link(struct rtnl_link *link); + +extern int rtnl_link_ipip_set_local(struct rtnl_link *link, uint32_t addr); +extern uint32_t rtnl_link_ipip_get_local(struct rtnl_link *link); + +extern int rtnl_link_ipip_set_remote(struct rtnl_link *link, uint32_t addr); +extern uint32_t rtnl_link_ipip_get_remote(struct rtnl_link *link); + +extern int rtnl_link_ipip_set_ttl(struct rtnl_link *link, uint8_t ttl); +extern uint8_t rtnl_link_ipip_get_ttl(struct rtnl_link *link); + +extern int rtnl_link_ipip_set_tos(struct rtnl_link *link, uint8_t tos); +extern uint8_t rtnl_link_ipip_get_tos(struct rtnl_link *link); + +extern int rtnl_link_ipip_set_pmtudisc(struct rtnl_link *link, uint8_t pmtudisc); +extern uint8_t rtnl_link_ipip_get_pmtudisc(struct rtnl_link *link); + +----- + +.Example: Add a ipip tunnel device +[source,c] +----- +struct rtnl_link *link +struct in_addr addr + +/* allocate new link object of type vxlan */ +if(!(link = rtnl_link_ipip_alloc())) + /* error */ + +/* set ipip tunnel name */ +if ((err = rtnl_link_set_name(link, "ipip-tun")) < 0) + /* error */ + +/* set link index */ +if ((err = rtnl_link_ipip_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_ipip_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_ipip_set_remote(link, addr.s_addr)) < 0) + /* error */ + +/* set tunnel ttl */ +if ((err = rtnl_link_ipip_set_ttl(link, 64)) < 0) + /* error */ + +if((err = rtnl_link_add(sk, link, NLM_F_CREATE)) < 0) + /* error */ + +rtnl_link_put(link); +----- + == Neighbouring == Routing |