Lines Matching full:link
2 * lib/route/link/xfrmi.c XFRMI Link Info
11 * Based on lib/route/link/ipvti.c
15 * @ingroup link
17 * xfrmi link module
20 * \b Link Type Name: "xfrmi"
33 #include <netlink/route/link/xfrmi.h>
34 #include <netlink-private/route/link/api.h>
42 uint32_t link; member
52 static int xfrmi_alloc(struct rtnl_link *link) in xfrmi_alloc() argument
56 if (link->l_info) in xfrmi_alloc()
57 memset(link->l_info, 0, sizeof(*xfrmi)); in xfrmi_alloc()
63 link->l_info = xfrmi; in xfrmi_alloc()
69 static int xfrmi_parse(struct rtnl_link *link, struct nlattr *data, in xfrmi_parse() argument
76 NL_DBG(3, "Parsing XFRMI link info\n"); in xfrmi_parse()
82 err = xfrmi_alloc(link); in xfrmi_parse()
86 xfrmi = link->l_info; in xfrmi_parse()
89 xfrmi->link = nla_get_u32(tb[IFLA_XFRM_LINK]); in xfrmi_parse()
101 static int xfrmi_put_attrs(struct nl_msg *msg, struct rtnl_link *link) in xfrmi_put_attrs() argument
103 struct xfrmi_info *xfrmi = link->l_info; in xfrmi_put_attrs()
111 NLA_PUT_U32(msg, IFLA_XFRM_LINK, xfrmi->link); in xfrmi_put_attrs()
122 static void xfrmi_free(struct rtnl_link *link) in xfrmi_free() argument
124 struct xfrmi_info *xfrmi = link->l_info; in xfrmi_free()
127 link->l_info = NULL; in xfrmi_free()
130 static void xfrmi_dump_line(struct rtnl_link *link, struct nl_dump_params *p) in xfrmi_dump_line() argument
132 nl_dump(p, "xfrmi : %s", link->l_name); in xfrmi_dump_line()
135 static void xfrmi_dump_details(struct rtnl_link *link, struct nl_dump_params *p) in xfrmi_dump_details() argument
137 struct xfrmi_info *xfrmi = link->l_info; in xfrmi_dump_details()
143 nl_dump(p, " link "); in xfrmi_dump_details()
146 parent = link_lookup(link->ce_cache, xfrmi->link); in xfrmi_dump_details()
153 nl_dump_line(p, "%u\n", xfrmi->link); in xfrmi_dump_details()
196 #define IS_XFRMI_LINK_ASSERT(link) do { \ argument
197 if ((link)->l_info_ops != &xfrmi_info_ops) { \
198 APPBUG("Link is not a xfrmi link. set type \"xfrmi\" first."); \
205 struct rtnl_link *link; in rtnl_link_xfrmi_alloc() local
208 link = rtnl_link_alloc(); in rtnl_link_xfrmi_alloc()
209 if (!link) in rtnl_link_xfrmi_alloc()
212 err = rtnl_link_set_type(link, XFRMI_LINK_TYPE_NAME); in rtnl_link_xfrmi_alloc()
214 rtnl_link_put(link); in rtnl_link_xfrmi_alloc()
218 return link; in rtnl_link_xfrmi_alloc()
222 * Check if link is a XFRMI link
223 * @arg link Link object
225 * @return True if link is a IXFRMI link, otherwise 0 is returned.
227 int rtnl_link_is_xfrmi(struct rtnl_link *link) in rtnl_link_is_xfrmi() argument
229 return link->l_info_ops && !strcmp(link->l_info_ops->io_name, in rtnl_link_is_xfrmi()
234 * Set XFRMI link interface index
235 * @arg link Link object
240 int rtnl_link_xfrmi_set_link(struct rtnl_link *link, uint32_t index) in rtnl_link_xfrmi_set_link() argument
242 struct xfrmi_info *xfrmi = link->l_info; in rtnl_link_xfrmi_set_link()
244 IS_XFRMI_LINK_ASSERT(link); in rtnl_link_xfrmi_set_link()
246 xfrmi->link = index; in rtnl_link_xfrmi_set_link()
253 * Get XFRMI link interface index
254 * @arg link Link object
259 int rtnl_link_xfrmi_get_link(struct rtnl_link *link, uint32_t *out_link) in rtnl_link_xfrmi_get_link() argument
261 struct xfrmi_info *xfrmi = link->l_info; in rtnl_link_xfrmi_get_link()
263 IS_XFRMI_LINK_ASSERT(link); in rtnl_link_xfrmi_get_link()
268 *out_link = xfrmi->link; in rtnl_link_xfrmi_get_link()
274 * @arg link Link object
279 int rtnl_link_xfrmi_set_if_id(struct rtnl_link *link, uint32_t if_id) in rtnl_link_xfrmi_set_if_id() argument
281 struct xfrmi_info *xfrmi = link->l_info; in rtnl_link_xfrmi_set_if_id()
283 IS_XFRMI_LINK_ASSERT(link); in rtnl_link_xfrmi_set_if_id()
293 * @arg link Link object
298 int rtnl_link_xfrmi_get_if_id(struct rtnl_link *link, uint32_t *out_if_id) in rtnl_link_xfrmi_get_if_id() argument
300 struct xfrmi_info *xfrmi = link->l_info; in rtnl_link_xfrmi_get_if_id()
302 IS_XFRMI_LINK_ASSERT(link); in rtnl_link_xfrmi_get_if_id()