• Home
  • Raw
  • Download

Lines Matching full:link

2  * lib/route/link/veth.c	Virtual Ethernet
13 * @ingroup link
18 * \b Link Type Name: "veth"
31 #include <netlink-private/route/link/api.h>
32 #include <netlink/route/link/veth.h>
40 static int veth_parse(struct rtnl_link *link, struct nlattr *data, in veth_parse() argument
45 struct rtnl_link *peer = link->l_info; in veth_parse()
48 NL_DBG(3, "Parsing veth link info"); in veth_parse()
83 static void veth_dump_line(struct rtnl_link *link, struct nl_dump_params *p) in veth_dump_line() argument
87 static void veth_dump_details(struct rtnl_link *link, struct nl_dump_params *p) in veth_dump_details() argument
89 struct rtnl_link *peer = link->l_info; in veth_dump_details()
117 static int veth_put_attrs(struct nl_msg *msg, struct rtnl_link *link) in veth_put_attrs() argument
119 struct rtnl_link *peer = link->l_info; in veth_put_attrs()
143 static int veth_alloc(struct rtnl_link *link) in veth_alloc() argument
149 if (link->l_info) in veth_alloc()
155 /* We don't need to hold a reference here, as link and in veth_alloc()
158 peer->l_info = link; in veth_alloc()
164 link->l_info = peer; in veth_alloc()
168 static void veth_free(struct rtnl_link *link) in veth_free() argument
170 struct rtnl_link *peer = link->l_info; in veth_free()
172 link->l_info = NULL; in veth_free()
177 /* the caller should finally free link */ in veth_free()
195 #define IS_VETH_LINK_ASSERT(link) \ argument
196 if ((link)->l_info_ops != &veth_info_ops) { \
197 APPBUG("Link is not a veth link. set type \"veth\" first."); \
208 * Allocate link object of type veth
210 * @return Allocated link object or NULL.
214 struct rtnl_link *link; in rtnl_link_veth_alloc() local
217 if (!(link = rtnl_link_alloc())) in rtnl_link_veth_alloc()
219 if ((err = rtnl_link_set_type(link, "veth")) < 0) { in rtnl_link_veth_alloc()
220 rtnl_link_put(link); in rtnl_link_veth_alloc()
224 return link; in rtnl_link_veth_alloc()
228 * Get the peer link of a veth link
230 * @return the peer link object.
232 struct rtnl_link *rtnl_link_veth_get_peer(struct rtnl_link *link) in rtnl_link_veth_get_peer() argument
234 IS_VETH_LINK_ASSERT(link); in rtnl_link_veth_get_peer()
235 nl_object_get(OBJ_CAST(link->l_info)); in rtnl_link_veth_get_peer()
236 return link->l_info; in rtnl_link_veth_get_peer()
240 * Release a veth link and its peer
243 void rtnl_link_veth_release(struct rtnl_link *link) in rtnl_link_veth_release() argument
245 veth_free(link); in rtnl_link_veth_release()
246 rtnl_link_put(link); in rtnl_link_veth_release()
250 * Check if link is a veth link
251 * @arg link Link object
253 * @return True if link is a veth link, otherwise false is returned.
255 int rtnl_link_is_veth(struct rtnl_link *link) in rtnl_link_is_veth() argument
257 return link->l_info_ops && !strcmp(link->l_info_ops->io_name, "veth"); in rtnl_link_is_veth()
277 struct rtnl_link *link, *peer; in rtnl_link_veth_add() local
280 if (!(link = rtnl_link_veth_alloc())) in rtnl_link_veth_add()
282 peer = link->l_info; in rtnl_link_veth_add()
285 rtnl_link_set_name(link, name); in rtnl_link_veth_add()
290 err = rtnl_link_add(sock, link, NLM_F_CREATE | NLM_F_EXCL); in rtnl_link_veth_add()
292 rtnl_link_put(link); in rtnl_link_veth_add()