diff options
27 files changed, 168 insertions, 99 deletions
diff --git a/src/libsystemd-network/dhcp-internal.h b/src/libsystemd-network/dhcp-internal.h index 16999971d2..6538f05bdb 100644 --- a/src/libsystemd-network/dhcp-internal.h +++ b/src/libsystemd-network/dhcp-internal.h @@ -12,7 +12,7 @@ #include "sd-dhcp-client.h" #include "dhcp-protocol.h" -#include "log-link.h" +#include "network-common.h" #include "socket-util.h" typedef struct sd_dhcp_option { @@ -75,10 +75,10 @@ void dhcp_client_set_test_mode(sd_dhcp_client *client, bool test_mode); #define log_dhcp_client_errno(client, error, fmt, ...) \ log_interface_prefix_full_errno( \ "DHCPv4 client: ", \ - sd_dhcp_client_get_ifname(client), \ + sd_dhcp_client, client, \ error, fmt, ##__VA_ARGS__) #define log_dhcp_client(client, fmt, ...) \ log_interface_prefix_full_errno_zerook( \ "DHCPv4 client: ", \ - sd_dhcp_client_get_ifname(client), \ + sd_dhcp_client, client, \ 0, fmt, ##__VA_ARGS__) diff --git a/src/libsystemd-network/dhcp-server-internal.h b/src/libsystemd-network/dhcp-server-internal.h index 2bb7f3cce3..3b87a4c066 100644 --- a/src/libsystemd-network/dhcp-server-internal.h +++ b/src/libsystemd-network/dhcp-server-internal.h @@ -9,8 +9,8 @@ #include "sd-event.h" #include "dhcp-internal.h" +#include "network-common.h" #include "ordered-set.h" -#include "log-link.h" #include "time-util.h" typedef enum DHCPRawOption { @@ -112,10 +112,10 @@ int client_id_compare_func(const DHCPClientId *a, const DHCPClientId *b); #define log_dhcp_server_errno(server, error, fmt, ...) \ log_interface_prefix_full_errno( \ "DHCPv4 server: ", \ - sd_dhcp_server_get_ifname(server), \ + sd_dhcp_server, server, \ error, fmt, ##__VA_ARGS__) #define log_dhcp_server(server, fmt, ...) \ log_interface_prefix_full_errno_zerook( \ "DHCPv4 server: ", \ - sd_dhcp_server_get_ifname(server), \ + sd_dhcp_server, server, \ 0, fmt, ##__VA_ARGS__) diff --git a/src/libsystemd-network/dhcp6-internal.h b/src/libsystemd-network/dhcp6-internal.h index 35cafc96ec..91418ad351 100644 --- a/src/libsystemd-network/dhcp6-internal.h +++ b/src/libsystemd-network/dhcp6-internal.h @@ -13,8 +13,8 @@ #include "hashmap.h" #include "list.h" -#include "log-link.h" #include "macro.h" +#include "network-common.h" #include "sparse-endian.h" typedef struct sd_dhcp6_option { @@ -125,10 +125,10 @@ void dhcp6_client_set_test_mode(sd_dhcp6_client *client, bool test_mode); #define log_dhcp6_client_errno(client, error, fmt, ...) \ log_interface_prefix_full_errno( \ "DHCPv6 client: ", \ - sd_dhcp6_client_get_ifname(client), \ + sd_dhcp6_client, client, \ error, fmt, ##__VA_ARGS__) #define log_dhcp6_client(client, fmt, ...) \ log_interface_prefix_full_errno_zerook( \ "DHCPv6 client: ", \ - sd_dhcp6_client_get_ifname(client), \ + sd_dhcp6_client, client, \ 0, fmt, ##__VA_ARGS__) diff --git a/src/libsystemd-network/lldp-rx-internal.h b/src/libsystemd-network/lldp-rx-internal.h index 6d3ce0e1bc..83d0bc460d 100644 --- a/src/libsystemd-network/lldp-rx-internal.h +++ b/src/libsystemd-network/lldp-rx-internal.h @@ -5,7 +5,7 @@ #include "sd-lldp-rx.h" #include "hashmap.h" -#include "log-link.h" +#include "network-common.h" #include "prioq.h" struct sd_lldp_rx { @@ -39,10 +39,10 @@ sd_lldp_rx_event_t lldp_rx_event_from_string(const char *s) _pure_; #define log_lldp_rx_errno(lldp_rx, error, fmt, ...) \ log_interface_prefix_full_errno( \ "LLDP Rx: ", \ - sd_lldp_rx_get_ifname(lldp_rx), \ + sd_lldp_rx, lldp_rx, \ error, fmt, ##__VA_ARGS__) #define log_lldp_rx(lldp_rx, fmt, ...) \ log_interface_prefix_full_errno_zerook( \ "LLDP Rx: ", \ - sd_lldp_rx_get_ifname(lldp_rx), \ + sd_lldp_rx, lldp_rx, \ 0, fmt, ##__VA_ARGS__) diff --git a/src/libsystemd-network/ndisc-internal.h b/src/libsystemd-network/ndisc-internal.h index d43b575352..d379b44519 100644 --- a/src/libsystemd-network/ndisc-internal.h +++ b/src/libsystemd-network/ndisc-internal.h @@ -7,7 +7,7 @@ #include "sd-ndisc.h" -#include "log-link.h" +#include "network-common.h" #include "time-util.h" #define NDISC_ROUTER_SOLICITATION_INTERVAL (4U * USEC_PER_SEC) @@ -44,10 +44,10 @@ sd_ndisc_event_t ndisc_event_from_string(const char *s) _pure_; #define log_ndisc_errno(ndisc, error, fmt, ...) \ log_interface_prefix_full_errno( \ "NDISC: ", \ - sd_ndisc_get_ifname(ndisc), \ + sd_ndisc, ndisc, \ error, fmt, ##__VA_ARGS__) #define log_ndisc(ndisc, fmt, ...) \ log_interface_prefix_full_errno_zerook( \ "NDISC: ", \ - sd_ndisc_get_ifname(ndisc), \ + sd_ndisc, ndisc, \ 0, fmt, ##__VA_ARGS__) diff --git a/src/libsystemd-network/network-common.c b/src/libsystemd-network/network-common.c index c8f3305b19..b8b4ecdaae 100644 --- a/src/libsystemd-network/network-common.c +++ b/src/libsystemd-network/network-common.c @@ -3,16 +3,13 @@ #include "format-util.h" #include "network-common.h" -const char *get_ifname(int ifindex, char **ifname) { +int get_ifname(int ifindex, char **ifname) { assert(ifname); /* This sets ifname only when it is not set yet. */ if (*ifname) - return *ifname; + return 0; - if (format_ifname_alloc(ifindex, ifname) < 0) - return NULL; - - return *ifname; + return format_ifname_alloc(ifindex, ifname); } diff --git a/src/libsystemd-network/network-common.h b/src/libsystemd-network/network-common.h index 76a6c4a989..d43b76d4b8 100644 --- a/src/libsystemd-network/network-common.h +++ b/src/libsystemd-network/network-common.h @@ -1,4 +1,28 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -const char *get_ifname(int ifindex, char **ifname); +#include "log-link.h" + +#define log_interface_prefix_full_errno_zerook(prefix, type, val, error, fmt, ...) \ + ({ \ + int _e = (error); \ + if (DEBUG_LOGGING) { \ + const char *_n = NULL; \ + \ + (void) type##_get_ifname(val, &_n); \ + log_interface_full_errno_zerook( \ + _n, LOG_DEBUG, _e, prefix fmt, \ + ##__VA_ARGS__); \ + } \ + -ERRNO_VALUE(_e); \ + }) + +#define log_interface_prefix_full_errno(prefix, type, val, error, fmt, ...) \ + ({ \ + int _error = (error); \ + ASSERT_NON_ZERO(_error); \ + log_interface_prefix_full_errno_zerook( \ + prefix, type, val, _error, fmt, ##__VA_ARGS__); \ + }) + +int get_ifname(int ifindex, char **ifname); diff --git a/src/libsystemd-network/radv-internal.h b/src/libsystemd-network/radv-internal.h index 209425548b..ef566ed8ec 100644 --- a/src/libsystemd-network/radv-internal.h +++ b/src/libsystemd-network/radv-internal.h @@ -7,8 +7,8 @@ #include "sd-radv.h" -#include "log-link.h" #include "list.h" +#include "network-common.h" #include "sparse-endian.h" assert_cc(SD_RADV_DEFAULT_MIN_TIMEOUT_USEC <= SD_RADV_DEFAULT_MAX_TIMEOUT_USEC); @@ -128,10 +128,10 @@ struct sd_radv_route_prefix { #define log_radv_errno(radv, error, fmt, ...) \ log_interface_prefix_full_errno( \ "RADV: ", \ - sd_radv_get_ifname(radv), \ + sd_radv, radv, \ error, fmt, ##__VA_ARGS__) #define log_radv(radv, fmt, ...) \ log_interface_prefix_full_errno_zerook( \ "RADV: ", \ - sd_radv_get_ifname(radv), \ + sd_radv, radv, \ 0, fmt, ##__VA_ARGS__) diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 72dbd95145..45c2351c53 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -297,11 +297,19 @@ int sd_dhcp_client_set_ifname(sd_dhcp_client *client, const char *ifname) { return free_and_strdup(&client->ifname, ifname); } -const char *sd_dhcp_client_get_ifname(sd_dhcp_client *client) { - if (!client) - return NULL; +int sd_dhcp_client_get_ifname(sd_dhcp_client *client, const char **ret) { + int r; - return get_ifname(client->ifindex, &client->ifname); + assert_return(client, -EINVAL); + + r = get_ifname(client->ifindex, &client->ifname); + if (r < 0) + return r; + + if (ret) + *ret = client->ifname; + + return 0; } int sd_dhcp_client_set_mac( diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index a075469e82..45ac70b461 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -230,11 +230,19 @@ int sd_dhcp_server_set_ifname(sd_dhcp_server *server, const char *ifname) { return free_and_strdup(&server->ifname, ifname); } -const char *sd_dhcp_server_get_ifname(sd_dhcp_server *server) { - if (!server) - return NULL; +int sd_dhcp_server_get_ifname(sd_dhcp_server *server, const char **ret) { + int r; + + assert_return(server, -EINVAL); - return get_ifname(server->ifindex, &server->ifname); + r = get_ifname(server->ifindex, &server->ifname); + if (r < 0) + return r; + + if (ret) + *ret = server->ifname; + + return 0; } int sd_dhcp_server_attach_event(sd_dhcp_server *server, sd_event *event, int64_t priority) { diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index adc65cd70e..298a89b086 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -179,11 +179,19 @@ int sd_dhcp6_client_set_ifname(sd_dhcp6_client *client, const char *ifname) { return free_and_strdup(&client->ifname, ifname); } -const char *sd_dhcp6_client_get_ifname(sd_dhcp6_client *client) { - if (!client) - return NULL; +int sd_dhcp6_client_get_ifname(sd_dhcp6_client *client, const char **ret) { + int r; + + assert_return(client, -EINVAL); + + r = get_ifname(client->ifindex, &client->ifname); + if (r < 0) + return r; - return get_ifname(client->ifindex, &client->ifname); + if (ret) + *ret = client->ifname; + + return 0; } int sd_dhcp6_client_set_local_address( diff --git a/src/libsystemd-network/sd-ipv4acd.c b/src/libsystemd-network/sd-ipv4acd.c index 1e30aad231..0a975fbbad 100644 --- a/src/libsystemd-network/sd-ipv4acd.c +++ b/src/libsystemd-network/sd-ipv4acd.c @@ -17,7 +17,6 @@ #include "event-util.h" #include "fd-util.h" #include "in-addr-util.h" -#include "log-link.h" #include "memory-util.h" #include "network-common.h" #include "random-util.h" @@ -81,12 +80,12 @@ struct sd_ipv4acd { #define log_ipv4acd_errno(acd, error, fmt, ...) \ log_interface_prefix_full_errno( \ "IPv4ACD: ", \ - sd_ipv4acd_get_ifname(acd), \ + sd_ipv4acd, acd, \ error, fmt, ##__VA_ARGS__) #define log_ipv4acd(acd, fmt, ...) \ log_interface_prefix_full_errno_zerook( \ "IPv4ACD: ", \ - sd_ipv4acd_get_ifname(acd), \ + sd_ipv4acd, acd, \ 0, fmt, ##__VA_ARGS__) static const char * const ipv4acd_state_table[_IPV4ACD_STATE_MAX] = { @@ -445,11 +444,19 @@ int sd_ipv4acd_set_ifname(sd_ipv4acd *acd, const char *ifname) { return free_and_strdup(&acd->ifname, ifname); } -const char *sd_ipv4acd_get_ifname(sd_ipv4acd *acd) { - if (!acd) - return NULL; +int sd_ipv4acd_get_ifname(sd_ipv4acd *acd, const char **ret) { + int r; - return get_ifname(acd->ifindex, &acd->ifname); + assert_return(acd, -EINVAL); + + r = get_ifname(acd->ifindex, &acd->ifname); + if (r < 0) + return r; + + if (ret) + *ret = acd->ifname; + + return 0; } int sd_ipv4acd_set_mac(sd_ipv4acd *acd, const struct ether_addr *addr) { diff --git a/src/libsystemd-network/sd-ipv4ll.c b/src/libsystemd-network/sd-ipv4ll.c index f2cc22db26..ff065fd1b6 100644 --- a/src/libsystemd-network/sd-ipv4ll.c +++ b/src/libsystemd-network/sd-ipv4ll.c @@ -15,7 +15,7 @@ #include "alloc-util.h" #include "ether-addr-util.h" #include "in-addr-util.h" -#include "log-link.h" +#include "network-common.h" #include "random-util.h" #include "siphash24.h" #include "sparse-endian.h" @@ -55,12 +55,12 @@ struct sd_ipv4ll { #define log_ipv4ll_errno(ll, error, fmt, ...) \ log_interface_prefix_full_errno( \ "IPv4LL: ", \ - sd_ipv4ll_get_ifname(ll), \ + sd_ipv4ll, ll, \ error, fmt, ##__VA_ARGS__) #define log_ipv4ll(ll, fmt, ...) \ log_interface_prefix_full_errno_zerook( \ "IPv4LL: ", \ - sd_ipv4ll_get_ifname(ll), \ + sd_ipv4ll, ll, \ 0, fmt, ##__VA_ARGS__) static void ipv4ll_on_acd(sd_ipv4acd *acd, int event, void *userdata); @@ -133,11 +133,10 @@ int sd_ipv4ll_set_ifname(sd_ipv4ll *ll, const char *ifname) { return sd_ipv4acd_set_ifname(ll->acd, ifname); } -const char *sd_ipv4ll_get_ifname(sd_ipv4ll *ll) { - if (!ll) - return NULL; +int sd_ipv4ll_get_ifname(sd_ipv4ll *ll, const char **ret) { + assert_return(ll, -EINVAL); - return sd_ipv4acd_get_ifname(ll->acd); + return sd_ipv4acd_get_ifname(ll->acd, ret); } int sd_ipv4ll_set_mac(sd_ipv4ll *ll, const struct ether_addr *addr) { diff --git a/src/libsystemd-network/sd-lldp-rx.c b/src/libsystemd-network/sd-lldp-rx.c index 98bde8b306..7224d3a345 100644 --- a/src/libsystemd-network/sd-lldp-rx.c +++ b/src/libsystemd-network/sd-lldp-rx.c @@ -359,11 +359,19 @@ int sd_lldp_rx_set_ifname(sd_lldp_rx *lldp_rx, const char *ifname) { return free_and_strdup(&lldp_rx->ifname, ifname); } -const char *sd_lldp_rx_get_ifname(sd_lldp_rx *lldp_rx) { - if (!lldp_rx) - return NULL; +int sd_lldp_rx_get_ifname(sd_lldp_rx *lldp_rx, const char **ret) { + int r; + + assert_return(lldp_rx, -EINVAL); - return get_ifname(lldp_rx->ifindex, &lldp_rx->ifname); + r = get_ifname(lldp_rx->ifindex, &lldp_rx->ifname); + if (r < 0) + return r; + + if (ret) + *ret = lldp_rx->ifname; + + return 0; } static sd_lldp_rx *lldp_rx_free(sd_lldp_rx *lldp_rx) { diff --git a/src/libsystemd-network/sd-lldp-tx.c b/src/libsystemd-network/sd-lldp-tx.c index 24003af7e1..4d2ab05713 100644 --- a/src/libsystemd-network/sd-lldp-tx.c +++ b/src/libsystemd-network/sd-lldp-tx.c @@ -12,7 +12,6 @@ #include "ether-addr-util.h" #include "fd-util.h" #include "hostname-util.h" -#include "log-link.h" #include "network-common.h" #include "random-util.h" #include "socket-util.h" @@ -70,12 +69,12 @@ struct sd_lldp_tx { #define log_lldp_tx_errno(lldp_tx, error, fmt, ...) \ log_interface_prefix_full_errno( \ "LLDP Tx: ", \ - sd_lldp_tx_get_ifname(lldp_tx), \ + sd_lldp_tx, lldp_tx, \ error, fmt, ##__VA_ARGS__) #define log_lldp_tx(lldp_tx, fmt, ...) \ log_interface_prefix_full_errno_zerook( \ "LLDP Tx: ", \ - sd_lldp_tx_get_ifname(lldp_tx), \ + sd_lldp_tx, lldp_tx, \ 0, fmt, ##__VA_ARGS__) static sd_lldp_tx *lldp_tx_free(sd_lldp_tx *lldp_tx) { @@ -131,11 +130,19 @@ int sd_lldp_tx_set_ifname(sd_lldp_tx *lldp_tx, const char *ifname) { return free_and_strdup(&lldp_tx->ifname, ifname); } -const char *sd_lldp_tx_get_ifname(sd_lldp_tx *lldp_tx) { - if (!lldp_tx) - return NULL; +int sd_lldp_tx_get_ifname(sd_lldp_tx *lldp_tx, const char **ret) { + int r; - return get_ifname(lldp_tx->ifindex, &lldp_tx->ifname); + assert_return(lldp_tx, -EINVAL); + + r = get_ifname(lldp_tx->ifindex, &lldp_tx->ifname); + if (r < 0) + return r; + + if (ret) + *ret = lldp_tx->ifname; + + return 0; } int sd_lldp_tx_set_multicast_mode(sd_lldp_tx *lldp_tx, sd_lldp_multicast_mode_t mode) { @@ -222,7 +229,7 @@ static size_t lldp_tx_calculate_maximum_packet_size(sd_lldp_tx *lldp_tx, const c /* Chassis ID */ 2 + 1 + (SD_ID128_STRING_MAX - 1) + /* Port ID */ - 2 + 1 + strlen_ptr(sd_lldp_tx_get_ifname(lldp_tx)) + + 2 + 1 + strlen_ptr(lldp_tx->ifname) + /* Port description */ 2 + strlen_ptr(lldp_tx->port_description) + /* System name */ @@ -334,6 +341,11 @@ static int lldp_tx_create_packet(sd_lldp_tx *lldp_tx, size_t *ret_packet_size, u assert(ret_packet_size); assert(ret_packet); + /* If ifname is not set yet, set ifname from ifindex. */ + r = sd_lldp_tx_get_ifname(lldp_tx, NULL); + if (r < 0) + return r; + r = sd_id128_get_machine(&machine_id); if (r < 0) return r; @@ -365,7 +377,7 @@ static int lldp_tx_create_packet(sd_lldp_tx *lldp_tx, size_t *ret_packet_size, u r = packet_append_prefixed_string(packet, packet_size, &offset, SD_LLDP_TYPE_PORT_ID, 1, (const uint8_t[]) { SD_LLDP_PORT_SUBTYPE_INTERFACE_NAME }, - sd_lldp_tx_get_ifname(lldp_tx)); + lldp_tx->ifname); if (r < 0) return r; diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c index 0c27b7ea72..65f75cc250 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/sd-ndisc.c @@ -74,11 +74,19 @@ int sd_ndisc_set_ifname(sd_ndisc *nd, const char *ifname) { return free_and_strdup(&nd->ifname, ifname); } -const char *sd_ndisc_get_ifname(sd_ndisc *nd) { - if (!nd) - return NULL; +int sd_ndisc_get_ifname(sd_ndisc *nd, const char **ret) { + int r; + + assert_return(nd, -EINVAL); - return get_ifname(nd->ifindex, &nd->ifname); + r = get_ifname(nd->ifindex, &nd->ifname); + if (r < 0) + return r; + + if (ret) + *ret = nd->ifname; + + return 0; } _public_ int sd_ndisc_set_mac(sd_ndisc *nd, const struct ether_addr *mac_addr) { diff --git a/src/libsystemd-network/sd-radv.c b/src/libsystemd-network/sd-radv.c index fd16a70a54..ae33894302 100644 --- a/src/libsystemd-network/sd-radv.c +++ b/src/libsystemd-network/sd-radv.c @@ -438,11 +438,19 @@ int sd_radv_set_ifname(sd_radv *ra, const char *ifname) { return free_and_strdup(&ra->ifname, ifname); } -const char *sd_radv_get_ifname(sd_radv *ra) { - if (!ra) - return NULL; +int sd_radv_get_ifname(sd_radv *ra, const char **ret) { + int r; + + assert_return(ra, -EINVAL); - return get_ifname(ra->ifindex, &ra->ifname); + r = get_ifname(ra->ifindex, &ra->ifname); + if (r < 0) + return r; + + if (ret) + *ret = ra->ifname; + + return 0; } _public_ int sd_radv_set_mac(sd_radv *ra, const struct ether_addr *mac_addr) { diff --git a/src/shared/log-link.h b/src/shared/log-link.h index 51eaa0c06e..5f2b176353 100644 --- a/src/shared/log-link.h +++ b/src/shared/log-link.h @@ -17,24 +17,6 @@ log_interface_full_errno_zerook(ifname, level, _error, __VA_ARGS__); \ }) -#define log_interface_prefix_full_errno_zerook(prefix, ifname_expr, error, fmt, ...) \ - ({ \ - int _e = (error); \ - if (DEBUG_LOGGING) \ - log_interface_full_errno_zerook( \ - ifname_expr, \ - LOG_DEBUG, _e, prefix fmt, \ - ##__VA_ARGS__); \ - -ERRNO_VALUE(_e); \ - }) - -#define log_interface_prefix_full_errno(prefix, ifname_expr, error, fmt, ...) \ - ({ \ - int _error = (error); \ - ASSERT_NON_ZERO(_error); \ - log_interface_prefix_full_errno_zerook(prefix, ifname_expr, _error, fmt, ##__VA_ARGS__); \ - }) - /* * The following macros append INTERFACE= to the message. * The macros require a struct named 'Link' which contains 'char *ifname': diff --git a/src/systemd/sd-dhcp-client.h b/src/systemd/sd-dhcp-client.h index 5300234098..23979b1232 100644 --- a/src/systemd/sd-dhcp-client.h +++ b/src/systemd/sd-dhcp-client.h @@ -135,7 +135,7 @@ int sd_dhcp_client_set_ifindex( int sd_dhcp_client_set_ifname( sd_dhcp_client *client, const char *interface_name); -const char *sd_dhcp_client_get_ifname(sd_dhcp_client *client); +int sd_dhcp_client_get_ifname(sd_dhcp_client *client, const char **ret); int sd_dhcp_client_set_mac( sd_dhcp_client *client, const uint8_t *addr, diff --git a/src/systemd/sd-dhcp-server.h b/src/systemd/sd-dhcp-server.h index 7d42bc1dab..149a14fdc6 100644 --- a/src/systemd/sd-dhcp-server.h +++ b/src/systemd/sd-dhcp-server.h @@ -38,7 +38,7 @@ enum { int sd_dhcp_server_new(sd_dhcp_server **ret, int ifindex); int sd_dhcp_server_set_ifname(sd_dhcp_server *server, const char *ifname); -const char *sd_dhcp_server_get_ifname(sd_dhcp_server *server); +int sd_dhcp_server_get_ifname(sd_dhcp_server *server, const char **ret); sd_dhcp_server *sd_dhcp_server_ref(sd_dhcp_server *server); sd_dhcp_server *sd_dhcp_server_unref(sd_dhcp_server *server); diff --git a/src/systemd/sd-dhcp6-client.h b/src/systemd/sd-dhcp6-client.h index e02d67632a..f3889782bc 100644 --- a/src/systemd/sd-dhcp6-client.h +++ b/src/systemd/sd-dhcp6-client.h @@ -94,7 +94,7 @@ int sd_dhcp6_client_set_ifindex( int sd_dhcp6_client_set_ifname( sd_dhcp6_client *client, const char *interface_name); -const char * sd_dhcp6_client_get_ifname(sd_dhcp6_client *client); +int sd_dhcp6_client_get_ifname(sd_dhcp6_client *client, const char **ret); int sd_dhcp6_client_set_local_address( sd_dhcp6_client *client, const struct in6_addr *local_address); diff --git a/src/systemd/sd-ipv4acd.h b/src/systemd/sd-ipv4acd.h index 3213db553c..90d3f0a0d1 100644 --- a/src/systemd/sd-ipv4acd.h +++ b/src/systemd/sd-ipv4acd.h @@ -47,7 +47,7 @@ int sd_ipv4acd_set_mac(sd_ipv4acd *acd, const struct ether_addr *addr); int sd_ipv4acd_set_ifindex(sd_ipv4acd *acd, int interface_index); int sd_ipv4acd_get_ifindex(sd_ipv4acd *acd); int sd_ipv4acd_set_ifname(sd_ipv4acd *acd, const char *interface_name); -const char *sd_ipv4acd_get_ifname(sd_ipv4acd *acd); +int sd_ipv4acd_get_ifname(sd_ipv4acd *acd, const char **ret); int sd_ipv4acd_set_address(sd_ipv4acd *acd, const struct in_addr *address); int sd_ipv4acd_is_running(sd_ipv4acd *acd); int sd_ipv4acd_start(sd_ipv4acd *acd, bool reset_conflicts); diff --git a/src/systemd/sd-ipv4ll.h b/src/systemd/sd-ipv4ll.h index 27263bc837..ed014b53f2 100644 --- a/src/systemd/sd-ipv4ll.h +++ b/src/systemd/sd-ipv4ll.h @@ -47,7 +47,7 @@ int sd_ipv4ll_set_mac(sd_ipv4ll *ll, const struct ether_addr *addr); int sd_ipv4ll_set_ifindex(sd_ipv4ll *ll, int interface_index); int sd_ipv4ll_get_ifindex(sd_ipv4ll *ll); int sd_ipv4ll_set_ifname(sd_ipv4ll *ll, const char *interface_name); -const char *sd_ipv4ll_get_ifname(sd_ipv4ll *ll); +int sd_ipv4ll_get_ifname(sd_ipv4ll *ll, const char **ret); int sd_ipv4ll_set_address(sd_ipv4ll *ll, const struct in_addr *address); int sd_ipv4ll_set_address_seed(sd_ipv4ll *ll, uint64_t seed); int sd_ipv4ll_is_running(sd_ipv4ll *ll); diff --git a/src/systemd/sd-lldp-rx.h b/src/systemd/sd-lldp-rx.h index 4653626eee..bfeac14ce3 100644 --- a/src/systemd/sd-lldp-rx.h +++ b/src/systemd/sd-lldp-rx.h @@ -59,7 +59,7 @@ sd_event *sd_lldp_rx_get_event(sd_lldp_rx *lldp_rx); int sd_lldp_rx_set_callback(sd_lldp_rx *lldp_rx, sd_lldp_rx_callback_t cb, void *userdata); int sd_lldp_rx_set_ifindex(sd_lldp_rx *lldp_rx, int ifindex); int sd_lldp_rx_set_ifname(sd_lldp_rx *lldp_rx, const char *ifname); -const char *sd_lldp_rx_get_ifname(sd_lldp_rx *lldp_rx); +int sd_lldp_rx_get_ifname(sd_lldp_rx *lldp_rx, const char **ret); /* Controls how much and what to store in the neighbors database */ int sd_lldp_rx_set_neighbors_max(sd_lldp_rx *lldp_rx, uint64_t n); diff --git a/src/systemd/sd-lldp-tx.h b/src/systemd/sd-lldp-tx.h index aef06ed7eb..512d455c71 100644 --- a/src/systemd/sd-lldp-tx.h +++ b/src/systemd/sd-lldp-tx.h @@ -54,7 +54,7 @@ sd_event *sd_lldp_tx_get_event(sd_lldp_tx *lldp_tx); int sd_lldp_tx_set_ifindex(sd_lldp_tx *lldp_tx, int ifindex); int sd_lldp_tx_set_ifname(sd_lldp_tx *lldp_tx, const char *ifname); -const char *sd_lldp_tx_get_ifname(sd_lldp_tx *lldp_tx); +int sd_lldp_tx_get_ifname(sd_lldp_tx *lldp_tx, const char **ret); int sd_lldp_tx_set_multicast_mode(sd_lldp_tx *lldp_tx, sd_lldp_multicast_mode_t mode); int sd_lldp_tx_set_hwaddr(sd_lldp_tx *lldp_tx, const struct ether_addr *hwaddr); diff --git a/src/systemd/sd-ndisc.h b/src/systemd/sd-ndisc.h index 6088def1b6..f45b2ad65e 100644 --- a/src/systemd/sd-ndisc.h +++ b/src/systemd/sd-ndisc.h @@ -79,7 +79,7 @@ sd_event *sd_ndisc_get_event(sd_ndisc *nd); int sd_ndisc_set_callback(sd_ndisc *nd, sd_ndisc_callback_t cb, void *userdata); int sd_ndisc_set_ifindex(sd_ndisc *nd, int interface_index); int sd_ndisc_set_ifname(sd_ndisc *nd, const char *interface_name); -const char *sd_ndisc_get_ifname(sd_ndisc *nd); +int sd_ndisc_get_ifname(sd_ndisc *nd, const char **ret); int sd_ndisc_set_mac(sd_ndisc *nd, const struct ether_addr *mac_addr); int sd_ndisc_get_mtu(sd_ndisc *nd, uint32_t *ret); diff --git a/src/systemd/sd-radv.h b/src/systemd/sd-radv.h index be5cf1b94e..6bf56def40 100644 --- a/src/systemd/sd-radv.h +++ b/src/systemd/sd-radv.h @@ -54,7 +54,7 @@ int sd_radv_is_running(sd_radv *ra); int sd_radv_set_ifindex(sd_radv *ra, int interface_index); int sd_radv_set_ifname(sd_radv *ra, const char *interface_name); -const char *sd_radv_get_ifname(sd_radv *ra); +int sd_radv_get_ifname(sd_radv *ra, const char **ret); int sd_radv_set_mac(sd_radv *ra, const struct ether_addr *mac_addr); int sd_radv_set_mtu(sd_radv *ra, uint32_t mtu); int sd_radv_set_hop_limit(sd_radv *ra, uint8_t hop_limit); |