diff options
author | Susant Sahani <susant@redhat.com> | 2014-04-25 17:21:23 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-05-05 17:08:29 (GMT) |
commit | d715b8a5f6ec8faf205ae77950a1c625440be22f (patch) | |
tree | b0340f8ec1e653a7aa8093af677ed37346bfb6a8 /doc | |
parent | 57bdc4ff4895dd91cc723d22eecadcf48945e87c (diff) | |
download | libnl-d715b8a5f6ec8faf205ae77950a1c625440be22f.zip libnl-d715b8a5f6ec8faf205ae77950a1c625440be22f.tar.gz libnl-d715b8a5f6ec8faf205ae77950a1c625440be22f.tar.bz2 |
introduce sit tunnel support
This patch introduces sit 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.txt | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/doc/route.txt b/doc/route.txt index 746201a..f70ad87 100644 --- a/doc/route.txt +++ b/doc/route.txt @@ -1002,6 +1002,84 @@ if((err = rtnl_link_add(sk, link, NLM_F_CREATE)) < 0) rtnl_link_put(link); ----- +[[link_sit]] +==== SIT + +[source,c] +----- +extern struct rtnl_link *rtnl_link_sit_alloc(void); +extern int rtnl_link_sit_add(struct nl_sock *sk, const char *name); + +extern int rtnl_link_sit_set_link(struct rtnl_link *link, uint32_t index); +extern uint32_t rtnl_link_sit_get_link(struct rtnl_link *link); + +extern int rtnl_link_sit_set_iflags(struct rtnl_link *link, uint16_t iflags); +extern uint16_t rtnl_link_get_iflags(struct rtnl_link *link); + +extern int rtnl_link_sit_set_oflags(struct rtnl_link *link, uint16_t oflags); +extern uint16_t rtnl_link_get_oflags(struct rtnl_link *link); + +extern int rtnl_link_sit_set_ikey(struct rtnl_link *link, uint32_t ikey); +extern uint32_t rtnl_link_get_ikey(struct rtnl_link *link); + +extern int rtnl_link_sit_set_okey(struct rtnl_link *link, uint32_t okey); +extern uint32_t rtnl_link_get_okey(struct rtnl_link *link) + +extern int rtnl_link_sit_set_local(struct rtnl_link *link, uint32_t addr); +extern uint32_t rtnl_link_sit_get_local(struct rtnl_link *link); + +extern int rtnl_link_sit_set_remote(struct rtnl_link *link, uint32_t addr); +extern uint32_t rtnl_link_sit_get_remote(struct rtnl_link *link); + +extern int rtnl_link_sit_set_ttl(struct rtnl_link *link, uint8_t ttl); +extern uint8_t rtnl_link_sit_get_ttl(struct rtnl_link *link); + +extern int rtnl_link_sit_set_tos(struct rtnl_link *link, uint8_t tos); +extern uint8_t rtnl_link_sit_get_tos(struct rtnl_link *link); + +extern int rtnl_link_sit_set_pmtudisc(struct rtnl_link *link, uint8_t pmtudisc); +extern uint8_t rtnl_link_sit_get_pmtudisc(struct rtnl_link *link); + +----- + +.Example: Add a sit tunnel device +[source,c] +----- +struct rtnl_link *link +struct in_addr addr + +/* allocate new link object of type vxlan */ +if(!(link = rtnl_link_sit_alloc())) + /* error */ + +/* set sit tunnel name */ +if ((err = rtnl_link_set_name(link, "sit-tun")) < 0) + /* error */ + +/* set link index */ +if ((err = rtnl_link_sit_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_sit_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_sit_set_remote(link, addr.s_addr)) < 0) + /* error */ + +/* set tunnel ttl */ +if ((err = rtnl_link_sit_set_ttl(link, 64)) < 0) + /* error */ + +if((err = rtnl_link_add(sk, link, NLM_F_CREATE)) < 0) + /* error */ + +rtnl_link_put(link); +----- + == Neighbouring |