Lines Matching refs:rtnl

37 static int remove_one_link(sd_netlink *rtnl, const char *name) {  in remove_one_link()  argument
44 r = sd_rtnl_message_new_link(rtnl, &m, RTM_DELLINK, 0); in remove_one_link()
52 r = sd_netlink_call(rtnl, m, 0, NULL); in remove_one_link()
106 static int set_alternative_ifname(sd_netlink *rtnl, const char *ifname, const char *altifname) { in set_alternative_ifname() argument
109 assert(rtnl); in set_alternative_ifname()
120 r = rtnl_set_link_alternative_names_by_ifname(&rtnl, ifname, STRV_MAKE(altifname)); in set_alternative_ifname()
130 sd_netlink *rtnl, in add_veth() argument
141 assert(rtnl); in add_veth()
147 r = sd_rtnl_message_new_link(rtnl, &m, RTM_NEWLINK, 0); in add_veth()
195 r = sd_netlink_call(rtnl, m, 0, NULL); in add_veth()
199 (void) set_alternative_ifname(rtnl, ifname_host, altifname_host); in add_veth()
242 _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL; in setup_veth()
267 r = sd_netlink_open(&rtnl); in setup_veth()
271 r = add_veth(rtnl, pid, n, a, &mac_host, "host0", &mac_container); in setup_veth()
289 _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL; in setup_veth_extra()
299 r = sd_netlink_open(&rtnl); in setup_veth_extra()
314 r = add_veth(rtnl, pid, *a, NULL, &mac_host, *b, &mac_container); in setup_veth_extra()
324 static int join_bridge(sd_netlink *rtnl, const char *veth_name, const char *bridge_name) { in join_bridge() argument
328 assert(rtnl); in join_bridge()
332 bridge_ifi = rtnl_resolve_interface(&rtnl, bridge_name); in join_bridge()
336 r = sd_rtnl_message_new_link(rtnl, &m, RTM_SETLINK, 0); in join_bridge()
352 r = sd_netlink_call(rtnl, m, 0, NULL); in join_bridge()
359 static int create_bridge(sd_netlink *rtnl, const char *bridge_name) { in create_bridge() argument
363 r = sd_rtnl_message_new_link(rtnl, &m, RTM_NEWLINK, 0); in create_bridge()
387 r = sd_netlink_call(rtnl, m, 0, NULL); in create_bridge()
396 _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL; in setup_bridge()
403 r = sd_netlink_open(&rtnl); in setup_bridge()
417 bridge_ifi = join_bridge(rtnl, veth_name, bridge_name); in setup_bridge()
427 r = create_bridge(rtnl, bridge_name); in setup_bridge()
437 _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL; in remove_bridge()
460 r = sd_netlink_open(&rtnl); in remove_bridge()
464 return remove_one_link(rtnl, bridge_name); in remove_bridge()
496 _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL; in move_network_interfaces()
502 r = sd_netlink_open(&rtnl); in move_network_interfaces()
510 ifi = rtnl_resolve_interface_or_warn(&rtnl, *i); in move_network_interfaces()
514 r = sd_rtnl_message_new_link(rtnl, &m, RTM_SETLINK, ifi); in move_network_interfaces()
522 r = sd_netlink_call(rtnl, m, 0, NULL); in move_network_interfaces()
531 _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL; in setup_macvlan()
538 r = sd_netlink_open(&rtnl); in setup_macvlan()
548 ifi = rtnl_resolve_interface_or_warn(&rtnl, *i); in setup_macvlan()
556 r = sd_rtnl_message_new_link(rtnl, &m, RTM_NEWLINK, 0); in setup_macvlan()
607 r = sd_netlink_call(rtnl, m, 0, NULL); in setup_macvlan()
611 (void) set_alternative_ifname(rtnl, n, a); in setup_macvlan()
618 _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL; in setup_ipvlan()
624 r = sd_netlink_open(&rtnl); in setup_ipvlan()
633 ifi = rtnl_resolve_interface_or_warn(&rtnl, *i); in setup_ipvlan()
637 r = sd_rtnl_message_new_link(rtnl, &m, RTM_NEWLINK, 0); in setup_ipvlan()
684 r = sd_netlink_call(rtnl, m, 0, NULL); in setup_ipvlan()
688 (void) set_alternative_ifname(rtnl, n, a); in setup_ipvlan()
726 _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL; in remove_veth_links()
735 r = sd_netlink_open(&rtnl); in remove_veth_links()
739 remove_one_link(rtnl, primary); in remove_veth_links()
742 remove_one_link(rtnl, *a); in remove_veth_links()