Lines Matching full:link
2 * lib/route/link/ipvti.c IPVTI Link Info
13 * @ingroup link
15 * ipvti link module
18 * \b Link Type Name: "ipvti"
31 #include <netlink-private/route/link/api.h>
42 uint32_t link; member
58 static int ipvti_alloc(struct rtnl_link *link) in ipvti_alloc() argument
66 link->l_info = ipvti; in ipvti_alloc()
71 static int ipvti_parse(struct rtnl_link *link, struct nlattr *data, in ipvti_parse() argument
78 NL_DBG(3, "Parsing IPVTI link info"); in ipvti_parse()
84 err = ipvti_alloc(link); in ipvti_parse()
88 ipvti = link->l_info; in ipvti_parse()
91 ipvti->link = nla_get_u32(tb[IFLA_VTI_LINK]); in ipvti_parse()
121 static int ipvti_put_attrs(struct nl_msg *msg, struct rtnl_link *link) in ipvti_put_attrs() argument
123 struct ipvti_info *ipvti = link->l_info; in ipvti_put_attrs()
131 NLA_PUT_U32(msg, IFLA_VTI_LINK, ipvti->link); in ipvti_put_attrs()
152 static void ipvti_free(struct rtnl_link *link) in ipvti_free() argument
154 struct ipvti_info *ipvti = link->l_info; in ipvti_free()
157 link->l_info = NULL; in ipvti_free()
160 static void ipvti_dump_line(struct rtnl_link *link, struct nl_dump_params *p) in ipvti_dump_line() argument
162 nl_dump(p, "ipvti : %s", link->l_name); in ipvti_dump_line()
165 static void ipvti_dump_details(struct rtnl_link *link, struct nl_dump_params *p) in ipvti_dump_details() argument
167 struct ipvti_info *ipvti = link->l_info; in ipvti_dump_details()
171 nl_dump(p, " link "); in ipvti_dump_details()
172 name = rtnl_link_get_name(link); in ipvti_dump_details()
176 nl_dump_line(p, "%u\n", ipvti->link); in ipvti_dump_details()
240 #define IS_IPVTI_LINK_ASSERT(link) \ argument
241 if ((link)->l_info_ops != &ipvti_info_ops) { \
242 APPBUG("Link is not a ipvti link. set type \vti\" first."); \
248 struct rtnl_link *link; in rtnl_link_ipvti_alloc() local
251 link = rtnl_link_alloc(); in rtnl_link_ipvti_alloc()
252 if (!link) in rtnl_link_ipvti_alloc()
255 err = rtnl_link_set_type(link, "vti"); in rtnl_link_ipvti_alloc()
257 rtnl_link_put(link); in rtnl_link_ipvti_alloc()
261 return link; in rtnl_link_ipvti_alloc()
265 * Check if link is a IPVTI link
266 * @arg link Link object
268 * @return True if link is a IPVTI link, otherwise 0 is returned.
270 int rtnl_link_is_ipvti(struct rtnl_link *link) in rtnl_link_is_ipvti() argument
272 return link->l_info_ops && !strcmp(link->l_info_ops->io_name, "vti"); in rtnl_link_is_ipvti()
284 struct rtnl_link *link; in rtnl_link_ipvti_add() local
287 link = rtnl_link_ipvti_alloc(); in rtnl_link_ipvti_add()
288 if (!link) in rtnl_link_ipvti_add()
292 rtnl_link_set_name(link, name); in rtnl_link_ipvti_add()
294 err = rtnl_link_add(sk, link, NLM_F_CREATE); in rtnl_link_ipvti_add()
295 rtnl_link_put(link); in rtnl_link_ipvti_add()
301 * @arg link Link object
306 int rtnl_link_ipvti_set_link(struct rtnl_link *link, uint32_t index) in rtnl_link_ipvti_set_link() argument
308 struct ipvti_info *ipvti = link->l_info; in rtnl_link_ipvti_set_link()
310 IS_IPVTI_LINK_ASSERT(link); in rtnl_link_ipvti_set_link()
312 ipvti->link = index; in rtnl_link_ipvti_set_link()
320 * @arg link Link object
324 uint32_t rtnl_link_ipvti_get_link(struct rtnl_link *link) in rtnl_link_ipvti_get_link() argument
326 struct ipvti_info *ipvti = link->l_info; in rtnl_link_ipvti_get_link()
328 IS_IPVTI_LINK_ASSERT(link); in rtnl_link_ipvti_get_link()
330 return ipvti->link; in rtnl_link_ipvti_get_link()
335 * @arg link Link object
340 int rtnl_link_ipvti_set_ikey(struct rtnl_link *link, uint32_t ikey) in rtnl_link_ipvti_set_ikey() argument
342 struct ipvti_info *ipvti = link->l_info; in rtnl_link_ipvti_set_ikey()
344 IS_IPVTI_LINK_ASSERT(link); in rtnl_link_ipvti_set_ikey()
354 * @arg link Link object
358 uint32_t rtnl_link_ipvti_get_ikey(struct rtnl_link *link) in rtnl_link_ipvti_get_ikey() argument
360 struct ipvti_info *ipvti = link->l_info; in rtnl_link_ipvti_get_ikey()
362 IS_IPVTI_LINK_ASSERT(link); in rtnl_link_ipvti_get_ikey()
369 * @arg link Link object
374 int rtnl_link_ipvti_set_okey(struct rtnl_link *link, uint32_t okey) in rtnl_link_ipvti_set_okey() argument
376 struct ipvti_info *ipvti = link->l_info; in rtnl_link_ipvti_set_okey()
378 IS_IPVTI_LINK_ASSERT(link); in rtnl_link_ipvti_set_okey()
388 * @arg link Link object
392 uint32_t rtnl_link_ipvti_get_okey(struct rtnl_link *link) in rtnl_link_ipvti_get_okey() argument
394 struct ipvti_info *ipvti = link->l_info; in rtnl_link_ipvti_get_okey()
396 IS_IPVTI_LINK_ASSERT(link); in rtnl_link_ipvti_get_okey()
403 * @arg link Link object
408 int rtnl_link_ipvti_set_local(struct rtnl_link *link, uint32_t addr) in rtnl_link_ipvti_set_local() argument
410 struct ipvti_info *ipvti = link->l_info; in rtnl_link_ipvti_set_local()
412 IS_IPVTI_LINK_ASSERT(link); in rtnl_link_ipvti_set_local()
422 * @arg link Link object
426 uint32_t rtnl_link_ipvti_get_local(struct rtnl_link *link) in rtnl_link_ipvti_get_local() argument
428 struct ipvti_info *ipvti = link->l_info; in rtnl_link_ipvti_get_local()
430 IS_IPVTI_LINK_ASSERT(link); in rtnl_link_ipvti_get_local()
437 * @arg link Link object
442 int rtnl_link_ipvti_set_remote(struct rtnl_link *link, uint32_t remote) in rtnl_link_ipvti_set_remote() argument
444 struct ipvti_info *ipvti = link->l_info; in rtnl_link_ipvti_set_remote()
446 IS_IPVTI_LINK_ASSERT(link); in rtnl_link_ipvti_set_remote()
456 * @arg link Link object
460 uint32_t rtnl_link_ipvti_get_remote(struct rtnl_link *link) in rtnl_link_ipvti_get_remote() argument
462 struct ipvti_info *ipvti = link->l_info; in rtnl_link_ipvti_get_remote()
464 IS_IPVTI_LINK_ASSERT(link); in rtnl_link_ipvti_get_remote()