Lines Matching full:link
2 * lib/route/link/ipip.c IPIP Link Info
13 * @ingroup link
15 * ipip link module
18 * \b Link Type Name: "ipip"
31 #include <netlink-private/route/link/api.h>
46 uint32_t link; member
61 static int ipip_alloc(struct rtnl_link *link) in ipip_alloc() argument
69 link->l_info = ipip; in ipip_alloc()
74 static int ipip_parse(struct rtnl_link *link, struct nlattr *data, in ipip_parse() argument
81 NL_DBG(3, "Parsing IPIP link info"); in ipip_parse()
87 err = ipip_alloc(link); in ipip_parse()
91 ipip = link->l_info; in ipip_parse()
94 ipip->link = nla_get_u32(tb[IFLA_IPTUN_LINK]); in ipip_parse()
129 static int ipip_put_attrs(struct nl_msg *msg, struct rtnl_link *link) in ipip_put_attrs() argument
131 struct ipip_info *ipip = link->l_info; in ipip_put_attrs()
139 NLA_PUT_U32(msg, IFLA_IPTUN_LINK, ipip->link); in ipip_put_attrs()
162 static void ipip_free(struct rtnl_link *link) in ipip_free() argument
164 struct ipip_info *ipip = link->l_info; in ipip_free()
167 link->l_info = NULL; in ipip_free()
170 static void ipip_dump_line(struct rtnl_link *link, struct nl_dump_params *p) in ipip_dump_line() argument
172 nl_dump(p, "ipip : %s", link->l_name); in ipip_dump_line()
175 static void ipip_dump_details(struct rtnl_link *link, struct nl_dump_params *p) in ipip_dump_details() argument
177 struct ipip_info *ipip = link->l_info; in ipip_dump_details()
181 nl_dump(p, " link "); in ipip_dump_details()
182 name = rtnl_link_get_name(link); in ipip_dump_details()
186 nl_dump_line(p, "%u\n", ipip->link); in ipip_dump_details()
255 #define IS_IPIP_LINK_ASSERT(link) \ argument
256 if ((link)->l_info_ops != &ipip_info_ops) { \
257 APPBUG("Link is not a ipip link. set type \"ipip\" first."); \
263 struct rtnl_link *link; in rtnl_link_ipip_alloc() local
266 link = rtnl_link_alloc(); in rtnl_link_ipip_alloc()
267 if (!link) in rtnl_link_ipip_alloc()
270 err = rtnl_link_set_type(link, "ipip"); in rtnl_link_ipip_alloc()
272 rtnl_link_put(link); in rtnl_link_ipip_alloc()
276 return link; in rtnl_link_ipip_alloc()
280 * Check if link is a IPIP link
281 * @arg link Link object
283 * @return True if link is a IPIP link, otherwise false is returned.
285 int rtnl_link_is_ipip(struct rtnl_link *link) in rtnl_link_is_ipip() argument
287 return link->l_info_ops && !strcmp(link->l_info_ops->io_name, "ipip"); in rtnl_link_is_ipip()
300 struct rtnl_link *link; in rtnl_link_ipip_add() local
303 link = rtnl_link_ipip_alloc(); in rtnl_link_ipip_add()
304 if (!link) in rtnl_link_ipip_add()
308 rtnl_link_set_name(link, name); in rtnl_link_ipip_add()
310 err = rtnl_link_add(sk, link, NLM_F_CREATE); in rtnl_link_ipip_add()
311 rtnl_link_put(link); in rtnl_link_ipip_add()
318 * @arg link Link object
323 int rtnl_link_ipip_set_link(struct rtnl_link *link, uint32_t index) in rtnl_link_ipip_set_link() argument
325 struct ipip_info *ipip = link->l_info; in rtnl_link_ipip_set_link()
327 IS_IPIP_LINK_ASSERT(link); in rtnl_link_ipip_set_link()
329 ipip->link = index; in rtnl_link_ipip_set_link()
337 * @arg link Link object
341 uint32_t rtnl_link_ipip_get_link(struct rtnl_link *link) in rtnl_link_ipip_get_link() argument
343 struct ipip_info *ipip = link->l_info; in rtnl_link_ipip_get_link()
345 IS_IPIP_LINK_ASSERT(link); in rtnl_link_ipip_get_link()
347 return ipip->link; in rtnl_link_ipip_get_link()
352 * @arg link Link object
357 int rtnl_link_ipip_set_local(struct rtnl_link *link, uint32_t addr) in rtnl_link_ipip_set_local() argument
359 struct ipip_info *ipip = link->l_info; in rtnl_link_ipip_set_local()
361 IS_IPIP_LINK_ASSERT(link); in rtnl_link_ipip_set_local()
371 * @arg link Link object
375 uint32_t rtnl_link_ipip_get_local(struct rtnl_link *link) in rtnl_link_ipip_get_local() argument
377 struct ipip_info *ipip = link->l_info; in rtnl_link_ipip_get_local()
379 IS_IPIP_LINK_ASSERT(link); in rtnl_link_ipip_get_local()
386 * @arg link Link object
391 int rtnl_link_ipip_set_remote(struct rtnl_link *link, uint32_t addr) in rtnl_link_ipip_set_remote() argument
393 struct ipip_info *ipip = link->l_info; in rtnl_link_ipip_set_remote()
395 IS_IPIP_LINK_ASSERT(link); in rtnl_link_ipip_set_remote()
405 * @arg link Link object
409 uint32_t rtnl_link_ipip_get_remote(struct rtnl_link *link) in rtnl_link_ipip_get_remote() argument
411 struct ipip_info *ipip = link->l_info; in rtnl_link_ipip_get_remote()
413 IS_IPIP_LINK_ASSERT(link); in rtnl_link_ipip_get_remote()
420 * @arg link Link object
425 int rtnl_link_ipip_set_ttl(struct rtnl_link *link, uint8_t ttl) in rtnl_link_ipip_set_ttl() argument
427 struct ipip_info *ipip = link->l_info; in rtnl_link_ipip_set_ttl()
429 IS_IPIP_LINK_ASSERT(link); in rtnl_link_ipip_set_ttl()
439 * @arg link Link object
443 uint8_t rtnl_link_ipip_get_ttl(struct rtnl_link *link) in rtnl_link_ipip_get_ttl() argument
445 struct ipip_info *ipip = link->l_info; in rtnl_link_ipip_get_ttl()
447 IS_IPIP_LINK_ASSERT(link); in rtnl_link_ipip_get_ttl()
454 * @arg link Link object
459 int rtnl_link_ipip_set_tos(struct rtnl_link *link, uint8_t tos) in rtnl_link_ipip_set_tos() argument
461 struct ipip_info *ipip = link->l_info; in rtnl_link_ipip_set_tos()
463 IS_IPIP_LINK_ASSERT(link); in rtnl_link_ipip_set_tos()
473 * @arg link Link object
477 uint8_t rtnl_link_ipip_get_tos(struct rtnl_link *link) in rtnl_link_ipip_get_tos() argument
479 struct ipip_info *ipip = link->l_info; in rtnl_link_ipip_get_tos()
481 IS_IPIP_LINK_ASSERT(link); in rtnl_link_ipip_get_tos()
488 * @arg link Link object
493 int rtnl_link_ipip_set_pmtudisc(struct rtnl_link *link, uint8_t pmtudisc) in rtnl_link_ipip_set_pmtudisc() argument
495 struct ipip_info *ipip = link->l_info; in rtnl_link_ipip_set_pmtudisc()
497 IS_IPIP_LINK_ASSERT(link); in rtnl_link_ipip_set_pmtudisc()
507 * @arg link Link object
511 uint8_t rtnl_link_ipip_get_pmtudisc(struct rtnl_link *link) in rtnl_link_ipip_get_pmtudisc() argument
513 struct ipip_info *ipip = link->l_info; in rtnl_link_ipip_get_pmtudisc()
515 IS_IPIP_LINK_ASSERT(link); in rtnl_link_ipip_get_pmtudisc()