mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
libsystemd-network: make sd_dhcp_client_get_ifname() or friends return negative errno on error
This commit is contained in:
parent
01afd0f7f5
commit
5977b71f28
@ -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__)
|
||||
|
@ -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__)
|
||||
|
@ -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__)
|
||||
|
@ -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__)
|
||||
|
@ -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__)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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__)
|
||||
|
@ -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(
|
||||
|
@ -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;
|
||||
|
||||
return get_ifname(server->ifindex, &server->ifname);
|
||||
assert_return(server, -EINVAL);
|
||||
|
||||
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) {
|
||||
|
@ -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;
|
||||
|
||||
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_dhcp6_client_set_local_address(
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
return get_ifname(lldp_rx->ifindex, &lldp_rx->ifname);
|
||||
assert_return(lldp_rx, -EINVAL);
|
||||
|
||||
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) {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
return get_ifname(nd->ifindex, &nd->ifname);
|
||||
assert_return(nd, -EINVAL);
|
||||
|
||||
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) {
|
||||
|
@ -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;
|
||||
|
||||
return get_ifname(ra->ifindex, &ra->ifname);
|
||||
assert_return(ra, -EINVAL);
|
||||
|
||||
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) {
|
||||
|
@ -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':
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user