/systemd-251/src/libsystemd/sd-network/ |
D | sd-network.c | 109 static int network_link_get_string(int ifindex, const char *field, char **ret) { in network_link_get_string() argument 110 char path[STRLEN("/run/systemd/netif/links/") + DECIMAL_STR_MAX(ifindex)]; in network_link_get_string() 114 assert_return(ifindex > 0, -EINVAL); in network_link_get_string() 117 xsprintf(path, "/run/systemd/netif/links/%i", ifindex); in network_link_get_string() 132 static int network_link_get_strv(int ifindex, const char *key, char ***ret) { in network_link_get_strv() argument 133 char path[STRLEN("/run/systemd/netif/links/") + DECIMAL_STR_MAX(ifindex)]; in network_link_get_strv() 138 assert_return(ifindex > 0, -EINVAL); in network_link_get_strv() 141 xsprintf(path, "/run/systemd/netif/links/%i", ifindex); in network_link_get_strv() 164 int sd_network_link_get_setup_state(int ifindex, char **state) { in sd_network_link_get_setup_state() argument 165 return network_link_get_string(ifindex, "ADMIN_STATE", state); in sd_network_link_get_setup_state() [all …]
|
/systemd-251/src/systemd/ |
D | sd-network.h | 84 int sd_network_link_get_setup_state(int ifindex, char **state); 97 int sd_network_link_get_operational_state(int ifindex, char **state); 98 int sd_network_link_get_required_operstate_for_online(int ifindex, char **state); 99 int sd_network_link_get_required_family_for_online(int ifindex, char **state); 100 int sd_network_link_get_carrier_state(int ifindex, char **state); 101 int sd_network_link_get_address_state(int ifindex, char **state); 102 int sd_network_link_get_ipv4_address_state(int ifindex, char **state); 103 int sd_network_link_get_ipv6_address_state(int ifindex, char **state); 104 int sd_network_link_get_online_state(int ifindex, char **state); 112 int sd_network_link_get_required_for_online(int ifindex); [all …]
|
/systemd-251/src/resolve/ |
D | resolved-dns-synthesize.c | 9 int dns_synthesize_ifindex(int ifindex) { in dns_synthesize_ifindex() argument 17 if (ifindex > 0) in dns_synthesize_ifindex() 18 return ifindex; in dns_synthesize_ifindex() 59 static int synthesize_localhost_rr(Manager *m, const DnsResourceKey *key, int ifindex, DnsAnswer **… in synthesize_localhost_rr() argument 79 … r = dns_answer_add(*answer, rr, dns_synthesize_ifindex(ifindex), DNS_ANSWER_AUTHENTICATED, NULL); in synthesize_localhost_rr() 93 … r = dns_answer_add(*answer, rr, dns_synthesize_ifindex(ifindex), DNS_ANSWER_AUTHENTICATED, NULL); in synthesize_localhost_rr() 101 static int answer_add_ptr(DnsAnswer **answer, const char *from, const char *to, int ifindex, DnsAns… in answer_add_ptr() argument 112 return dns_answer_add(*answer, rr, ifindex, flags, NULL); in answer_add_ptr() 115 static int synthesize_localhost_ptr(Manager *m, const DnsResourceKey *key, int ifindex, DnsAnswer *… in synthesize_localhost_ptr() argument 127 …(answer, dns_resource_key_name(key), "localhost", dns_synthesize_ifindex(ifindex), DNS_ANSWER_AUTH… in synthesize_localhost_ptr() [all …]
|
D | resolved-bus.c | 207 static int append_address(sd_bus_message *reply, DnsResourceRecord *rr, int ifindex) { in append_address() argument 217 r = sd_bus_message_append(reply, "i", ifindex); in append_address() 255 int ifindex, r; in bus_method_resolve_hostname_complete() local 287 DNS_ANSWER_FOREACH_IFINDEX(rr, ifindex, q->answer) { in bus_method_resolve_hostname_complete() 295 r = append_address(reply, rr, ifindex); in bus_method_resolve_hostname_complete() 382 static int parse_as_address(sd_bus_message *m, int ifindex, const char *hostname, int family, uint6… in parse_as_address() argument 397 if (ifindex > 0 && parsed_ifindex > 0 && parsed_ifindex != ifindex) in parse_as_address() 401 ifindex = parsed_ifindex; in parse_as_address() 415 r = sd_bus_message_append(reply, "ii", ifindex, ff); in parse_as_address() 434 r = in_addr_ifindex_to_string(ff, &parsed, ifindex, &canonical); in parse_as_address() [all …]
|
D | resolved-varlink.c | 9 int ifindex; member 153 int ifindex, r; in vl_method_resolve_hostname_complete() local 177 DNS_ANSWER_FOREACH_IFINDEX(rr, ifindex, q->answer) { in vl_method_resolve_hostname_complete() 201 … JSON_BUILD_PAIR_CONDITION(ifindex > 0, "ifindex", JSON_BUILD_INTEGER(ifindex)), in vl_method_resolve_hostname_complete() 239 int r, ff, parsed_ifindex, ifindex; in parse_as_address() local 252 (p->ifindex > 0 && parsed_ifindex > 0 && parsed_ifindex != p->ifindex)) in parse_as_address() 255 ifindex = parsed_ifindex > 0 ? parsed_ifindex : p->ifindex; in parse_as_address() 258 r = in_addr_ifindex_to_string(ff, &parsed, ifindex, &canonical); in parse_as_address() 268 … JSON_BUILD_PAIR_CONDITION(ifindex > 0, "ifindex", JSON_BUILD_INTEGER(ifindex)), in parse_as_address() 278 … JSON_VARIANT_UNSIGNED, json_dispatch_int, offsetof(LookupParameters, ifindex), 0 … in vl_method_resolve_hostname() [all …]
|
D | resolved-dns-stream.c | 110 if (s->local.sa.sa_family == AF_INET6 && s->ifindex <= 0) in dns_stream_identify() 111 s->ifindex = s->local.in6.sin6_scope_id; in dns_stream_identify() 118 if (s->peer.sa.sa_family == AF_INET6 && s->ifindex <= 0) in dns_stream_identify() 119 s->ifindex = s->peer.in6.sin6_scope_id; in dns_stream_identify() 152 if (s->ifindex <= 0) in dns_stream_identify() 153 s->ifindex = i->ipi6_ifindex; in dns_stream_identify() 170 if (s->ifindex <= 0) in dns_stream_identify() 171 s->ifindex = i->ipi_ifindex; in dns_stream_identify() 186 if (s->ifindex == LOOPBACK_IFINDEX) in dns_stream_identify() 187 s->ifindex = 0; in dns_stream_identify() [all …]
|
D | resolved-manager.c | 50 int ifindex, r; in manager_process_link() local 60 r = sd_rtnl_message_link_get_ifindex(mm, &ifindex); in manager_process_link() 64 l = hashmap_get(m->links, INT_TO_PTR(ifindex)); in manager_process_link() 72 r = link_new(m, &l, ifindex); in manager_process_link() 86 log_debug("Found new link %i/%s", ifindex, l->ifname); in manager_process_link() 93 log_debug("Removing link %i/%s", l->ifindex, l->ifname); in manager_process_link() 112 int r, ifindex, family; in manager_process_address() local 124 r = sd_rtnl_message_addr_get_ifindex(mm, &ifindex); in manager_process_address() 128 l = hashmap_get(m->links, INT_TO_PTR(ifindex)); in manager_process_address() 280 … log_warning_errno(r, "Failed to update monitor information for %i: %m", l->ifindex); in on_network_event() [all …]
|
D | resolved-dns-answer.c | 29 siphash24_compress(&a->ifindex, sizeof(a->ifindex), state); in dns_answer_item_hash_func() 40 r = CMP(a->ifindex, b->ifindex); in dns_answer_item_compare_func() 108 int ifindex, in dns_answer_add_raw() argument 130 .ifindex = ifindex, in dns_answer_add_raw() 151 item->ifindex, in dns_answer_add_raw_all() 164 int ifindex, in dns_answer_add() argument 179 .ifindex = ifindex, in dns_answer_add() 209 return dns_answer_add_raw(a, rr, ifindex, flags, rrsig); in dns_answer_add() 217 r = dns_answer_add(a, item->rr, item->ifindex, item->flags, item->rrsig); in dns_answer_add_all() 228 int ifindex, in dns_answer_add_extend() argument [all …]
|
D | resolvectl.c | 190 static void print_ifindex_comment(int printed_so_far, int ifindex) { in print_ifindex_comment() argument 194 if (ifindex <= 0) in print_ifindex_comment() 197 r = format_ifname(ifindex, ifname); in print_ifindex_comment() 199 …void) log_warning_errno(r, "Failed to resolve interface name for index %i, ignoring: %m", ifindex); in print_ifindex_comment() 241 int ifindex, family, k; in resolve_host() local 246 r = sd_bus_message_read(reply, "i", &ifindex); in resolve_host() 264 r = in_addr_ifindex_to_string(family, &a, ifindex, &pretty); in resolve_host() 272 print_ifindex_comment(k, ifindex); in resolve_host() 302 static int resolve_address(sd_bus *bus, int family, const union in_addr_union *address, int ifindex… in resolve_address() argument 315 if (ifindex <= 0) in resolve_address() [all …]
|
/systemd-251/src/libsystemd/sd-netlink/ |
D | netlink-util.c | 12 int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) { in rtnl_set_link_name() argument 19 assert(ifindex > 0); in rtnl_set_link_name() 25 r = rtnl_get_link_alternative_names(rtnl, ifindex, &alternative_names); in rtnl_set_link_name() 28 ifindex); in rtnl_set_link_name() 31 r = rtnl_delete_link_alternative_names(rtnl, ifindex, STRV_MAKE(name)); in rtnl_set_link_name() 34 name, ifindex); in rtnl_set_link_name() 36 r = format_ifname(ifindex, old_name); in rtnl_set_link_name() 38 … return log_debug_errno(r, "Failed to get current name of network interface %i: %m", ifindex); in rtnl_set_link_name() 41 r = sd_rtnl_message_new_link(*rtnl, &message, RTM_SETLINK, ifindex); in rtnl_set_link_name() 54 r = rtnl_set_link_alternative_names(rtnl, ifindex, STRV_MAKE(old_name)); in rtnl_set_link_name() [all …]
|
D | test-netlink.c | 46 static void test_link_configure(sd_netlink *rtnl, int ifindex) { in test_link_configure() argument 55 assert_se(sd_rtnl_message_new_link(rtnl, &message, RTM_GETLINK, ifindex) >= 0); in test_link_configure() 64 static void test_link_get(sd_netlink *rtnl, int ifindex) { in test_link_get() argument 73 assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_GETLINK, ifindex) >= 0); in test_link_get() 93 static void test_address_get(sd_netlink *rtnl, int ifindex) { in test_address_get() argument 101 assert_se(sd_rtnl_message_new_addr(rtnl, &m, RTM_GETADDR, ifindex, AF_INET) >= 0); in test_address_get() 180 static void test_event_loop(int ifindex) { in test_event_loop() argument 192 assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_GETLINK, ifindex) >= 0); in test_event_loop() 210 static void test_async(int ifindex) { in test_async() argument 225 assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_GETLINK, ifindex) >= 0); in test_async() [all …]
|
/systemd-251/src/network/ |
D | networkd-manager-bus.c | 45 link->ifindex, in method_list_links() 82 r = sd_bus_message_append(reply, "io", link->ifindex, empty_to_root(path)); in method_get_link_by_name() 93 int ifindex, r; in method_get_link_by_index() local 96 r = bus_message_read_ifindex(message, error, &ifindex); in method_get_link_by_index() 100 r = link_get_by_index(manager, ifindex, &link); in method_get_link_by_index() 102 … return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_LINK, "Link %i not known", ifindex); in method_get_link_by_index() 120 int ifindex, r; in call_link_method() local 127 r = bus_message_read_ifindex(message, error, &ifindex); in call_link_method() 131 r = link_get_by_index(m, ifindex, &l); in call_link_method() 133 … return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_LINK, "Link %i not known", ifindex); in call_link_method() [all …]
|
D | networkctl.c | 268 int ifindex; member 361 return CMP(a->ifindex, b->ifindex); in link_info_compare() 493 int ifindex, r; in decode_link() local 506 r = sd_rtnl_message_link_get_ifindex(m, &ifindex); in decode_link() 524 xsprintf(str, "%i", ifindex); in decode_link() 546 info->ifindex = ifindex; in decode_link() 620 xsprintf(ifindex_str, "%i", link->ifindex); in link_get_property() 697 r = wifi_get_interface(genl, link->ifindex, &link->wlan_iftype, &link->ssid); in acquire_wlan_link_info() 702 k = wifi_get_station(genl, link->ifindex, &link->bssid); in acquire_wlan_link_info() 751 (void) sd_device_new_from_ifindex(&links[c].sd_device, links[c].ifindex); in acquire_link_info() [all …]
|
D | networkd-wifi.c | 25 r = sd_netlink_message_append_u32(req, NL80211_ATTR_IFINDEX, link->ifindex); in link_get_wlan_interface() 42 uint32_t ifindex, wlan_iftype; in manager_genl_process_nl80211_config() local 84 r = sd_netlink_message_read_u32(message, NL80211_ATTR_IFINDEX, &ifindex); in manager_genl_process_nl80211_config() 91 r = link_get_by_index(manager, ifindex, &link); in manager_genl_process_nl80211_config() 94 strna(nl80211_cmd_to_string(cmd)), cmd, ifindex); in manager_genl_process_nl80211_config() 159 uint32_t ifindex; in manager_genl_process_nl80211_mlme() local 192 r = sd_netlink_message_read_u32(message, NL80211_ATTR_IFINDEX, &ifindex); in manager_genl_process_nl80211_mlme() 199 r = link_get_by_index(manager, ifindex, &link); in manager_genl_process_nl80211_mlme() 202 strna(nl80211_cmd_to_string(cmd)), cmd, ifindex); in manager_genl_process_nl80211_mlme()
|
/systemd-251/src/shared/ |
D | local-addresses.c | 32 r = CMP(a->ifindex, b->ifindex); in address_compare() 63 int ifindex, in local_addresses() argument 82 r = sd_rtnl_message_new_addr(rtnl, &req, RTM_GETADDR, ifindex, af); in local_addresses() 113 if (ifindex > 0 && ifi != ifindex) in local_addresses() 137 if (ifindex == 0 && IN_SET(a->scope, RT_SCOPE_HOST, RT_SCOPE_NOWHERE)) in local_addresses() 164 a->ifindex = ifi; in local_addresses() 183 int ifindex, in add_local_gateway() argument 198 .ifindex = ifindex, in add_local_gateway() 209 int ifindex, in local_gateways() argument 303 if (ifindex > 0 && (int) ifi != ifindex) in local_gateways() [all …]
|
D | socket-netlink.c | 103 int family, ifindex; in socket_address_parse() local 105 … r = in_addr_port_ifindex_name_from_string_auto(s, &family, &address, &port, &ifindex, NULL); in socket_address_parse() 127 .sin6_scope_id = ifindex, in socket_address_parse() 256 int family, ifindex = 0, r; in in_addr_port_ifindex_name_from_string_auto() local 303 ifindex = rtnl_resolve_interface(NULL, m + 1); in in_addr_port_ifindex_name_from_string_auto() 304 if (ifindex < 0) in in_addr_port_ifindex_name_from_string_auto() 305 return ifindex; in in_addr_port_ifindex_name_from_string_auto() 376 *ret_ifindex = ifindex; in in_addr_port_ifindex_name_from_string_auto() 396 int ifindex, in in_addr_full_new() argument 419 .ifindex = ifindex, in in_addr_full_new() [all …]
|
D | wifi-util.c | 8 int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *ret_iftype, char **ret_s… in wifi_get_interface() argument 17 assert(ifindex > 0); in wifi_get_interface() 23 r = sd_netlink_message_append_u32(m, NL80211_ATTR_IFINDEX, ifindex); in wifi_get_interface() 32 ifindex); in wifi_get_interface() 36 … return log_debug_errno(r, "Failed to request information about wifi interface %d: %m", ifindex); in wifi_get_interface() 38 …_debug("No reply received to request for information about wifi interface %d, ignoring.", ifindex); in wifi_get_interface() 44 … return log_debug_errno(r, "Failed to get information about wifi interface %d: %m", ifindex); in wifi_get_interface() 87 int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_addr *ret_bssid) { in wifi_get_station() argument 93 assert(ifindex > 0); in wifi_get_station() 104 r = sd_netlink_message_append_u32(m, NL80211_ATTR_IFINDEX, ifindex); in wifi_get_station()
|
D | socket-netlink.h | 24 …m_string_auto(const char *s, int *family, union in_addr_union *ret, int *ifindex, char **server_na… in in_addr_ifindex_name_from_string_auto() argument 25 … return in_addr_port_ifindex_name_from_string_auto(s, family, ret, NULL, ifindex, server_name); in in_addr_ifindex_name_from_string_auto() 27 …addr_ifindex_from_string_auto(const char *s, int *family, union in_addr_union *ret, int *ifindex) { in in_addr_ifindex_from_string_auto() argument 28 return in_addr_ifindex_name_from_string_auto(s, family, ret, ifindex, NULL); in in_addr_ifindex_from_string_auto() 35 int ifindex; member 42 int in_addr_full_new(int family, const union in_addr_union *a, uint16_t port, int ifindex, const ch…
|
/systemd-251/src/network/wait-online/ |
D | link.c | 11 int link_new(Manager *m, Link **ret, int ifindex, const char *ifname) { in link_new() argument 17 assert(ifindex > 0); in link_new() 31 .ifindex = ifindex, in link_new() 35 r = hashmap_ensure_put(&m->links_by_index, NULL, INT_TO_PTR(ifindex), l); in link_new() 56 hashmap_remove(l->manager->links_by_index, INT_TO_PTR(l->ifindex)); in link_free() 107 r = sd_network_link_get_required_for_online(l->ifindex); in link_update_monitor() 114 r = sd_network_link_get_required_operstate_for_online(l->ifindex, &required_operstate); in link_update_monitor() 126 r = network_link_get_operational_state(l->ifindex, &l->operational_state); in link_update_monitor() 130 r = sd_network_link_get_required_family_for_online(l->ifindex, &required_family); in link_update_monitor() 145 r = sd_network_link_get_ipv4_address_state(l->ifindex, &ipv4_address_state); in link_update_monitor() [all …]
|
/systemd-251/src/udev/ |
D | udev-netlink.c | 20 int link_info_get(sd_netlink **rtnl, int ifindex, LinkInfo *ret) { in link_info_get() argument 27 assert(ifindex > 0); in link_info_get() 36 r = sd_rtnl_message_new_link(*rtnl, &message, RTM_GETLINK, ifindex); in link_info_get() 52 r = sd_rtnl_message_link_get_ifindex(reply, &info.ifindex); in link_info_get() 55 if (info.ifindex != ifindex) in link_info_get() 80 info.iflink = info.ifindex; in link_info_get() 225 int ifindex, r; in device_cache_sysattr_from_link_info() local 230 r = sd_device_get_ifindex(device, &ifindex); in device_cache_sysattr_from_link_info() 234 if (ifindex != info->ifindex) in device_cache_sysattr_from_link_info() 301 int ifindex, r; in device_get_sysattr_value_maybe_from_netlink() local [all …]
|
/systemd-251/src/basic/ |
D | format-util.h | 66 int format_ifname_full(int ifindex, FormatIfnameFlag flag, char buf[static IF_NAMESIZE]); 67 int format_ifname_full_alloc(int ifindex, FormatIfnameFlag flag, char **ret); 69 static inline int format_ifname(int ifindex, char buf[static IF_NAMESIZE]) { in format_ifname() argument 70 return format_ifname_full(ifindex, 0, buf); in format_ifname() 72 static inline int format_ifname_alloc(int ifindex, char **ret) { in format_ifname_alloc() argument 73 return format_ifname_full_alloc(ifindex, 0, ret); in format_ifname_alloc() 76 static inline char *_format_ifname_full(int ifindex, FormatIfnameFlag flag, char buf[static IF_NAME… in _format_ifname_full() argument 77 (void) format_ifname_full(ifindex, flag, buf); in _format_ifname_full()
|
D | format-util.c | 9 int format_ifname_full(int ifindex, FormatIfnameFlag flag, char buf[static IF_NAMESIZE]) { in format_ifname_full() argument 10 if (ifindex <= 0) in format_ifname_full() 13 if (if_indextoname(ifindex, buf)) in format_ifname_full() 20 assert(snprintf_ok(buf, IF_NAMESIZE, "%%%d", ifindex)); in format_ifname_full() 22 assert(snprintf_ok(buf, IF_NAMESIZE, "%d", ifindex)); in format_ifname_full() 27 int format_ifname_full_alloc(int ifindex, FormatIfnameFlag flag, char **ret) { in format_ifname_full_alloc() argument 33 r = format_ifname_full(ifindex, flag, buf); in format_ifname_full_alloc()
|
/systemd-251/src/test/ |
D | test-socket-netlink.c | 230 static void test_in_addr_ifindex_to_string_one(int f, const char *a, int ifindex, const char *b) { in test_in_addr_ifindex_to_string_one() argument 236 assert_se(in_addr_ifindex_to_string(f, &ua, ifindex, &r) >= 0); in test_in_addr_ifindex_to_string_one() 243 assert_se(ifindex2 == ifindex || ifindex2 == 0); in test_in_addr_ifindex_to_string_one() 259 int family, ifindex; in TEST() local 264 assert_se(in_addr_ifindex_from_string_auto("fe80::17", &family, &ua, &ifindex) >= 0); in TEST() 266 assert_se(ifindex == 0); in TEST() 268 assert_se(in_addr_ifindex_from_string_auto("fe80::18%19", &family, &ua, &ifindex) >= 0); in TEST() 270 assert_se(ifindex == 19); in TEST() 272 assert_se(in_addr_ifindex_from_string_auto("fe80::18%lo", &family, &ua, &ifindex) >= 0); in TEST() 274 assert_se(ifindex == LOOPBACK_IFINDEX); in TEST() [all …]
|
/systemd-251/src/libsystemd-network/ |
D | arp-util.h | 15 int arp_network_bind_raw_socket(int ifindex, const struct in_addr *a, const struct ether_addr *mac); 19 int ifindex, 25 int ifindex, in arp_send_probe() argument 28 return arp_send_packet(fd, ifindex, pa, ha, false); in arp_send_probe() 32 int ifindex, in arp_send_announcement() argument 35 return arp_send_packet(fd, ifindex, pa, ha, true); in arp_send_announcement()
|
D | icmp6-util.c | 33 int ifindex = mreq->ipv6mr_interface; in icmp6_bind_router_message() local 54 r = setsockopt_int(s, IPPROTO_IPV6, IPV6_MULTICAST_IF, ifindex); in icmp6_bind_router_message() 78 r = socket_bind_to_ifindex(s, ifindex); in icmp6_bind_router_message() 85 int icmp6_bind_router_solicitation(int ifindex) { in icmp6_bind_router_solicitation() argument 89 .ipv6mr_interface = ifindex, in icmp6_bind_router_solicitation() 98 int icmp6_bind_router_advertisement(int ifindex) { in icmp6_bind_router_advertisement() argument 102 .ipv6mr_interface = ifindex, in icmp6_bind_router_advertisement()
|