Lines Matching full:link

2  * lib/route/link/ip6tnl.c        IP6TNL Link Info
13 * @ingroup link
15 * ip6tnl link module
18 * \b Link Type Name: "ip6tnl"
31 #include <netlink/route/link/ip6tnl.h>
32 #include <netlink-private/route/link/api.h>
53 uint32_t link; member
72 static int ip6_tnl_alloc(struct rtnl_link *link) in ip6_tnl_alloc() argument
76 if (link->l_info) in ip6_tnl_alloc()
77 memset(link->l_info, 0, sizeof(*ip6_tnl)); in ip6_tnl_alloc()
83 link->l_info = ip6_tnl; in ip6_tnl_alloc()
89 static int ip6_tnl_parse(struct rtnl_link *link, struct nlattr *data, in ip6_tnl_parse() argument
96 NL_DBG(3, "Parsing IP6_TNL link info\n"); in ip6_tnl_parse()
102 err = ip6_tnl_alloc(link); in ip6_tnl_parse()
106 ip6_tnl = link->l_info; in ip6_tnl_parse()
109 ip6_tnl->link = nla_get_u32(tb[IFLA_IPTUN_LINK]); in ip6_tnl_parse()
159 static int ip6_tnl_put_attrs(struct nl_msg *msg, struct rtnl_link *link) in ip6_tnl_put_attrs() argument
161 struct ip6_tnl_info *ip6_tnl = link->l_info; in ip6_tnl_put_attrs()
169 NLA_PUT_U32(msg, IFLA_IPTUN_LINK, ip6_tnl->link); in ip6_tnl_put_attrs()
204 static void ip6_tnl_free(struct rtnl_link *link) in ip6_tnl_free() argument
206 struct ip6_tnl_info *ip6_tnl = link->l_info; in ip6_tnl_free()
209 link->l_info = NULL; in ip6_tnl_free()
212 static void ip6_tnl_dump_line(struct rtnl_link *link, struct nl_dump_params *p) in ip6_tnl_dump_line() argument
214 nl_dump(p, "ip6_tnl : %s", link->l_name); in ip6_tnl_dump_line()
217 static void ip6_tnl_dump_details(struct rtnl_link *link, struct nl_dump_params *p) in ip6_tnl_dump_details() argument
219 struct ip6_tnl_info *ip6_tnl = link->l_info; in ip6_tnl_dump_details()
224 nl_dump(p, " link "); in ip6_tnl_dump_details()
227 parent = link_lookup(link->ce_cache, ip6_tnl->link); in ip6_tnl_dump_details()
234 nl_dump_line(p, "%u\n", ip6_tnl->link); in ip6_tnl_dump_details()
320 #define IS_IP6_TNL_LINK_ASSERT(link)\ argument
321 if ((link)->l_info_ops != &ip6_tnl_info_ops) {\
322 APPBUG("Link is not a ip6_tnl link. set type \"ip6tnl\" first.");\
328 struct rtnl_link *link; in rtnl_link_ip6_tnl_alloc() local
331 link = rtnl_link_alloc(); in rtnl_link_ip6_tnl_alloc()
332 if (!link) in rtnl_link_ip6_tnl_alloc()
335 err = rtnl_link_set_type(link, "ip6tnl"); in rtnl_link_ip6_tnl_alloc()
337 rtnl_link_put(link); in rtnl_link_ip6_tnl_alloc()
341 return link; in rtnl_link_ip6_tnl_alloc()
345 * Check if link is a IP6_TNL link
346 * @arg link Link object
348 * @return True if link is a IP6_TNL link, otherwise false is returned.
350 int rtnl_link_is_ip6_tnl(struct rtnl_link *link) in rtnl_link_is_ip6_tnl() argument
352 return link->l_info_ops && !strcmp(link->l_info_ops->io_name, "ip6tnl"); in rtnl_link_is_ip6_tnl()
365 struct rtnl_link *link; in rtnl_link_ip6_tnl_add() local
368 link = rtnl_link_ip6_tnl_alloc(); in rtnl_link_ip6_tnl_add()
369 if (!link) in rtnl_link_ip6_tnl_add()
373 rtnl_link_set_name(link, name); in rtnl_link_ip6_tnl_add()
375 err = rtnl_link_add(sk, link, NLM_F_CREATE); in rtnl_link_ip6_tnl_add()
376 rtnl_link_put(link); in rtnl_link_ip6_tnl_add()
383 * @arg link Link object
388 int rtnl_link_ip6_tnl_set_link(struct rtnl_link *link, uint32_t index) in rtnl_link_ip6_tnl_set_link() argument
390 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_set_link()
392 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_set_link()
394 ip6_tnl->link = index; in rtnl_link_ip6_tnl_set_link()
402 * @arg link Link object
406 uint32_t rtnl_link_ip6_tnl_get_link(struct rtnl_link *link) in rtnl_link_ip6_tnl_get_link() argument
408 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_get_link()
410 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_get_link()
412 return ip6_tnl->link; in rtnl_link_ip6_tnl_get_link()
417 * @arg link Link object
422 int rtnl_link_ip6_tnl_set_local(struct rtnl_link *link, struct in6_addr *addr) in rtnl_link_ip6_tnl_set_local() argument
424 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_set_local()
426 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_set_local()
436 * @arg link Link object
440 int rtnl_link_ip6_tnl_get_local(struct rtnl_link *link, struct in6_addr *addr) in rtnl_link_ip6_tnl_get_local() argument
442 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_get_local()
444 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_get_local()
453 * @arg link Link object
458 int rtnl_link_ip6_tnl_set_remote(struct rtnl_link *link, struct in6_addr *addr) in rtnl_link_ip6_tnl_set_remote() argument
460 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_set_remote()
462 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_set_remote()
472 * @arg link Link object
476 int rtnl_link_ip6_tnl_get_remote(struct rtnl_link *link, struct in6_addr *addr) in rtnl_link_ip6_tnl_get_remote() argument
478 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_get_remote()
480 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_get_remote()
489 * @arg link Link object
494 int rtnl_link_ip6_tnl_set_ttl(struct rtnl_link *link, uint8_t ttl) in rtnl_link_ip6_tnl_set_ttl() argument
496 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_set_ttl()
498 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_set_ttl()
508 * @arg link Link object
512 uint8_t rtnl_link_ip6_tnl_get_ttl(struct rtnl_link *link) in rtnl_link_ip6_tnl_get_ttl() argument
514 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_get_ttl()
516 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_get_ttl()
523 * @arg link Link object
528 int rtnl_link_ip6_tnl_set_tos(struct rtnl_link *link, uint8_t tos) in rtnl_link_ip6_tnl_set_tos() argument
530 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_set_tos()
532 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_set_tos()
542 * @arg link Link object
546 uint8_t rtnl_link_ip6_tnl_get_tos(struct rtnl_link *link) in rtnl_link_ip6_tnl_get_tos() argument
548 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_get_tos()
550 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_get_tos()
557 * @arg link Link object
562 int rtnl_link_ip6_tnl_set_encaplimit(struct rtnl_link *link, uint8_t encap_limit) in rtnl_link_ip6_tnl_set_encaplimit() argument
564 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_set_encaplimit()
566 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_set_encaplimit()
576 * @arg link Link object
580 uint8_t rtnl_link_ip6_tnl_get_encaplimit(struct rtnl_link *link) in rtnl_link_ip6_tnl_get_encaplimit() argument
582 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_get_encaplimit()
584 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_get_encaplimit()
591 * @arg link Link object
596 int rtnl_link_ip6_tnl_set_flowinfo(struct rtnl_link *link, uint32_t flowinfo) in rtnl_link_ip6_tnl_set_flowinfo() argument
598 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_set_flowinfo()
600 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_set_flowinfo()
610 * @arg link Link object
614 uint32_t rtnl_link_ip6_tnl_get_flowinfo(struct rtnl_link *link) in rtnl_link_ip6_tnl_get_flowinfo() argument
616 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_get_flowinfo()
618 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_get_flowinfo()
625 * @arg link Link object
630 int rtnl_link_ip6_tnl_set_flags(struct rtnl_link *link, uint32_t flags) in rtnl_link_ip6_tnl_set_flags() argument
632 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_set_flags()
634 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_set_flags()
644 * @arg link Link object
648 uint32_t rtnl_link_ip6_tnl_get_flags(struct rtnl_link *link) in rtnl_link_ip6_tnl_get_flags() argument
650 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_get_flags()
652 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_get_flags()
659 * @arg link Link object
664 int rtnl_link_ip6_tnl_set_proto(struct rtnl_link *link, uint8_t proto) in rtnl_link_ip6_tnl_set_proto() argument
666 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_set_proto()
668 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_set_proto()
678 * @arg link Link object
682 uint8_t rtnl_link_ip6_tnl_get_proto(struct rtnl_link *link) in rtnl_link_ip6_tnl_get_proto() argument
684 struct ip6_tnl_info *ip6_tnl = link->l_info; in rtnl_link_ip6_tnl_get_proto()
686 IS_IP6_TNL_LINK_ASSERT(link); in rtnl_link_ip6_tnl_get_proto()