• Home
  • Raw
  • Download

Lines Matching full:link

2  * lib/route/link/bridge.c	AF_BRIDGE link support
13 * @ingroup link
24 #include <netlink/route/link/bridge.h>
25 #include <netlink-private/route/link/api.h>
49 #define IS_BRIDGE_LINK_ASSERT(link) \ argument
50 if (!rtnl_link_is_bridge(link)) { \
51 APPBUG("A function was expecting a link object of type bridge."); \
55 static inline struct bridge_data *bridge_data(struct rtnl_link *link) in bridge_data() argument
57 return rtnl_link_af_data(link, &bridge_ops); in bridge_data()
60 static void *bridge_alloc(struct rtnl_link *link) in bridge_alloc() argument
65 static void *bridge_clone(struct rtnl_link *link, void *data) in bridge_clone() argument
69 if ((bd = bridge_alloc(link))) in bridge_clone()
75 static void bridge_free(struct rtnl_link *link, void *data) in bridge_free() argument
90 static void check_flag(struct rtnl_link *link, struct nlattr *attrs[], in check_flag() argument
94 rtnl_link_bridge_set_flags(link, flag); in check_flag()
97 static int bridge_parse_protinfo(struct rtnl_link *link, struct nlattr *attr, in bridge_parse_protinfo() argument
136 check_flag(link, br_attrs, IFLA_BRPORT_MODE, RTNL_BRIDGE_HAIRPIN_MODE); in bridge_parse_protinfo()
137 check_flag(link, br_attrs, IFLA_BRPORT_GUARD, RTNL_BRIDGE_BPDU_GUARD); in bridge_parse_protinfo()
138 check_flag(link, br_attrs, IFLA_BRPORT_PROTECT, RTNL_BRIDGE_ROOT_BLOCK); in bridge_parse_protinfo()
139 check_flag(link, br_attrs, IFLA_BRPORT_FAST_LEAVE, RTNL_BRIDGE_FAST_LEAVE); in bridge_parse_protinfo()
144 static void bridge_dump_details(struct rtnl_link *link, in bridge_dump_details() argument
187 * Allocate link object of type bridge
189 * @return Allocated link object or NULL.
193 struct rtnl_link *link; in rtnl_link_bridge_alloc() local
196 if (!(link = rtnl_link_alloc())) in rtnl_link_bridge_alloc()
199 if ((err = rtnl_link_set_type(link, "bridge")) < 0) { in rtnl_link_bridge_alloc()
200 rtnl_link_put(link); in rtnl_link_bridge_alloc()
204 return link; in rtnl_link_bridge_alloc()
221 struct rtnl_link *link; in rtnl_link_bridge_add() local
223 if (!(link = rtnl_link_bridge_alloc())) in rtnl_link_bridge_add()
227 rtnl_link_set_name(link, name); in rtnl_link_bridge_add()
229 err = rtnl_link_add(sk, link, NLM_F_CREATE); in rtnl_link_bridge_add()
230 rtnl_link_put(link); in rtnl_link_bridge_add()
236 * Check if a link is a bridge
237 * @arg link Link object
239 * @return 1 if the link is a bridge, 0 otherwise.
241 int rtnl_link_is_bridge(struct rtnl_link *link) in rtnl_link_is_bridge() argument
243 return link->l_family == AF_BRIDGE && in rtnl_link_is_bridge()
244 link->l_af_ops == &bridge_ops; in rtnl_link_is_bridge()
249 * @arg link Link object of type bridge
260 int rtnl_link_bridge_has_ext_info(struct rtnl_link *link) in rtnl_link_bridge_has_ext_info() argument
264 if (!rtnl_link_is_bridge(link)) in rtnl_link_bridge_has_ext_info()
267 bd = bridge_data(link); in rtnl_link_bridge_has_ext_info()
273 * @arg link Link object of type bridge
286 * @retval -NLE_OPNOTSUPP Link is not a bridge
289 int rtnl_link_bridge_set_port_state(struct rtnl_link *link, uint8_t state) in rtnl_link_bridge_set_port_state() argument
291 struct bridge_data *bd = bridge_data(link); in rtnl_link_bridge_set_port_state()
293 IS_BRIDGE_LINK_ASSERT(link); in rtnl_link_bridge_set_port_state()
306 * @arg link Link object of type bridge
311 * @retval -NLE_OPNOTSUPP Link is not a bridge
313 int rtnl_link_bridge_get_port_state(struct rtnl_link *link) in rtnl_link_bridge_get_port_state() argument
315 struct bridge_data *bd = bridge_data(link); in rtnl_link_bridge_get_port_state()
317 IS_BRIDGE_LINK_ASSERT(link); in rtnl_link_bridge_get_port_state()
324 * @arg link Link object of type bridge
330 * @retval -NLE_OPNOTSUPP Link is not a bridge
332 int rtnl_link_bridge_set_priority(struct rtnl_link *link, uint16_t prio) in rtnl_link_bridge_set_priority() argument
334 struct bridge_data *bd = bridge_data(link); in rtnl_link_bridge_set_priority()
336 IS_BRIDGE_LINK_ASSERT(link); in rtnl_link_bridge_set_priority()
346 * @arg link Link object of type bridge
351 * @retval -NLE_OPNOTSUPP Link is not a bridge
353 int rtnl_link_bridge_get_priority(struct rtnl_link *link) in rtnl_link_bridge_get_priority() argument
355 struct bridge_data *bd = bridge_data(link); in rtnl_link_bridge_get_priority()
357 IS_BRIDGE_LINK_ASSERT(link); in rtnl_link_bridge_get_priority()
364 * @arg link Link object of type bridge
370 * @retval -NLE_OPNOTSUPP Link is not a bridge
372 int rtnl_link_bridge_set_cost(struct rtnl_link *link, uint32_t cost) in rtnl_link_bridge_set_cost() argument
374 struct bridge_data *bd = bridge_data(link); in rtnl_link_bridge_set_cost()
376 IS_BRIDGE_LINK_ASSERT(link); in rtnl_link_bridge_set_cost()
386 * @arg link Link object of type bridge
392 * @retval -NLE_OPNOTSUPP Link is not a bridge
395 int rtnl_link_bridge_get_cost(struct rtnl_link *link, uint32_t *cost) in rtnl_link_bridge_get_cost() argument
397 struct bridge_data *bd = bridge_data(link); in rtnl_link_bridge_get_cost()
399 IS_BRIDGE_LINK_ASSERT(link); in rtnl_link_bridge_get_cost()
411 * @arg link Link object of type bridge
418 * @retval -NLE_OPNOTSUPP Link is not a bridge
420 int rtnl_link_bridge_unset_flags(struct rtnl_link *link, unsigned int flags) in rtnl_link_bridge_unset_flags() argument
422 struct bridge_data *bd = bridge_data(link); in rtnl_link_bridge_unset_flags()
424 IS_BRIDGE_LINK_ASSERT(link); in rtnl_link_bridge_unset_flags()
435 * @arg link Link object of type bridge
448 * @retval -NLE_OPNOTSUPP Link is not a bridge
450 int rtnl_link_bridge_set_flags(struct rtnl_link *link, unsigned int flags) in rtnl_link_bridge_set_flags() argument
452 struct bridge_data *bd = bridge_data(link); in rtnl_link_bridge_set_flags()
454 IS_BRIDGE_LINK_ASSERT(link); in rtnl_link_bridge_set_flags()
465 * @arg link Link object of type bridge
471 * @retval -NLE_OPNOTSUPP Link is not a bridge
473 int rtnl_link_bridge_get_flags(struct rtnl_link *link) in rtnl_link_bridge_get_flags() argument
475 struct bridge_data *bd = bridge_data(link); in rtnl_link_bridge_get_flags()
477 IS_BRIDGE_LINK_ASSERT(link); in rtnl_link_bridge_get_flags()