summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-05-23 16:13:18 +0200
committerLennart Poettering <lennart@poettering.net>2016-05-26 15:34:42 +0200
commit2f8e763376e932395c859d0ab5a8931b7f27fe18 (patch)
tree9b70354184513fcfdf29f2dca1c76828bdb5d88d
parent9c2438b84e1071a841364250f2dec2b15dafceb7 (diff)
sd-network: rename "index" field of the various clients to "ifindex"
A field "index" is not particularly precise and also might conflict with libc's index() function definition. Also, pretty much everywhere else we call this concept "ifindex", including in networkd, the primary user of these libraries. Hence, let's fix this up and call this "ifindex" everywhere here too.
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c27
-rw-r--r--src/libsystemd-network/sd-dhcp6-client.c27
-rw-r--r--src/libsystemd-network/sd-ipv4acd.c20
-rw-r--r--src/libsystemd-network/sd-ipv4ll.c5
-rw-r--r--src/libsystemd-network/sd-ndisc.c17
-rw-r--r--src/libsystemd-network/test-acd.c2
-rw-r--r--src/libsystemd-network/test-dhcp-client.c16
-rw-r--r--src/libsystemd-network/test-dhcp6-client.c10
-rw-r--r--src/libsystemd-network/test-ipv4ll-manual.c2
-rw-r--r--src/libsystemd-network/test-ipv4ll.c12
-rw-r--r--src/libsystemd-network/test-ndisc-rs.c2
-rw-r--r--src/network/networkd-dhcp4.c2
-rw-r--r--src/network/networkd-dhcp6.c2
-rw-r--r--src/network/networkd-ipv4ll.c2
-rw-r--r--src/network/networkd-ndisc.c2
-rw-r--r--src/systemd/sd-dhcp-client.h2
-rw-r--r--src/systemd/sd-dhcp6-client.h2
-rw-r--r--src/systemd/sd-ipv4acd.h2
-rw-r--r--src/systemd/sd-ipv4ll.h2
-rw-r--r--src/systemd/sd-ndisc.h2
20 files changed, 76 insertions, 82 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index aa028e1d24..fab9f3f088 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -53,7 +53,7 @@ struct sd_dhcp_client {
sd_event *event;
int event_priority;
sd_event_source *timeout_resend;
- int index;
+ int ifindex;
int fd;
union sockaddr_union link;
sd_event_source *receive_message;
@@ -194,14 +194,13 @@ int sd_dhcp_client_set_request_address(
return 0;
}
-int sd_dhcp_client_set_index(sd_dhcp_client *client, int interface_index) {
- assert_return(client, -EINVAL);
- assert_return (IN_SET(client->state, DHCP_STATE_INIT,
- DHCP_STATE_STOPPED), -EBUSY);
- assert_return(interface_index > 0, -EINVAL);
+int sd_dhcp_client_set_ifindex(sd_dhcp_client *client, int ifindex) {
- client->index = interface_index;
+ assert_return(client, -EINVAL);
+ assert_return(IN_SET(client->state, DHCP_STATE_INIT, DHCP_STATE_STOPPED), -EBUSY);
+ assert_return(ifindex > 0, -EINVAL);
+ client->ifindex = ifindex;
return 0;
}
@@ -348,7 +347,7 @@ int sd_dhcp_client_set_iaid_duid(
/* If IAID is not configured, generate it. */
if (iaid == 0) {
- r = dhcp_identifier_set_iaid(client->index, client->mac_addr,
+ r = dhcp_identifier_set_iaid(client->ifindex, client->mac_addr,
client->mac_addr_len,
&client->client_id.ns.iaid);
if (r < 0)
@@ -565,7 +564,7 @@ static int client_message_init(
client->client_id.type = 255;
- r = dhcp_identifier_set_iaid(client->index, client->mac_addr, client->mac_addr_len, &client->client_id.ns.iaid);
+ r = dhcp_identifier_set_iaid(client->ifindex, client->mac_addr, client->mac_addr_len, &client->client_id.ns.iaid);
if (r < 0)
return r;
@@ -1101,7 +1100,7 @@ static int client_start_delayed(sd_dhcp_client *client) {
assert_return(client, -EINVAL);
assert_return(client->event, -EINVAL);
- assert_return(client->index > 0, -EINVAL);
+ assert_return(client->ifindex > 0, -EINVAL);
assert_return(client->fd < 0, -EBUSY);
assert_return(client->xid == 0, -EINVAL);
assert_return(client->state == DHCP_STATE_INIT ||
@@ -1109,7 +1108,7 @@ static int client_start_delayed(sd_dhcp_client *client) {
client->xid = random_u32();
- r = dhcp_network_bind_raw_socket(client->index, &client->link,
+ r = dhcp_network_bind_raw_socket(client->ifindex, &client->link,
client->xid, client->mac_addr,
client->mac_addr_len, client->arp_type);
if (r < 0) {
@@ -1157,7 +1156,7 @@ static int client_timeout_t2(sd_event_source *s, uint64_t usec, void *userdata)
client->state = DHCP_STATE_REBINDING;
client->attempt = 1;
- r = dhcp_network_bind_raw_socket(client->index, &client->link,
+ r = dhcp_network_bind_raw_socket(client->ifindex, &client->link,
client->xid, client->mac_addr,
client->mac_addr_len, client->arp_type);
if (r < 0) {
@@ -1778,7 +1777,7 @@ int sd_dhcp_client_start(sd_dhcp_client *client) {
r = client_start(client);
if (r >= 0)
- log_dhcp_client(client, "STARTED on ifindex %i", client->index);
+ log_dhcp_client(client, "STARTED on ifindex %i", client->ifindex);
return r;
}
@@ -1879,7 +1878,7 @@ int sd_dhcp_client_new(sd_dhcp_client **ret) {
client->n_ref = 1;
client->state = DHCP_STATE_INIT;
- client->index = -1;
+ client->ifindex = -1;
client->fd = -1;
client->attempt = 1;
client->mtu = DHCP_DEFAULT_MIN_SIZE;
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index 7dead24836..15667c26d7 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -45,7 +45,7 @@ struct sd_dhcp6_client {
enum DHCP6State state;
sd_event *event;
int event_priority;
- int index;
+ int ifindex;
struct in6_addr local_address;
uint8_t mac_addr[MAX_MAC_ADDR_LEN];
size_t mac_addr_len;
@@ -123,14 +123,13 @@ int sd_dhcp6_client_set_callback(
return 0;
}
-int sd_dhcp6_client_set_index(sd_dhcp6_client *client, int interface_index) {
- assert_return(client, -EINVAL);
- assert_return(interface_index >= -1, -EINVAL);
+int sd_dhcp6_client_set_ifindex(sd_dhcp6_client *client, int ifindex) {
+ assert_return(client, -EINVAL);
+ assert_return(ifindex >= -1, -EINVAL);
assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
- client->index = interface_index;
-
+ client->ifindex = ifindex;
return 0;
}
@@ -671,7 +670,7 @@ static int client_ensure_iaid(sd_dhcp6_client *client) {
if (client->ia_na.id)
return 0;
- r = dhcp_identifier_set_iaid(client->index, client->mac_addr, client->mac_addr_len, &client->ia_na.id);
+ r = dhcp_identifier_set_iaid(client->ifindex, client->mac_addr, client->mac_addr_len, &client->ia_na.id);
if (r < 0)
return r;
@@ -1027,7 +1026,7 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state) {
assert_return(client, -EINVAL);
assert_return(client->event, -EINVAL);
- assert_return(client->index > 0, -EINVAL);
+ assert_return(client->ifindex > 0, -EINVAL);
assert_return(client->state != state, -EINVAL);
client->timeout_resend_expire =
@@ -1160,12 +1159,12 @@ int sd_dhcp6_client_is_running(sd_dhcp6_client *client) {
}
int sd_dhcp6_client_start(sd_dhcp6_client *client) {
- int r = 0;
enum DHCP6State state = DHCP6_STATE_SOLICITATION;
+ int r = 0;
assert_return(client, -EINVAL);
assert_return(client->event, -EINVAL);
- assert_return(client->index > 0, -EINVAL);
+ assert_return(client->ifindex > 0, -EINVAL);
assert_return(in_addr_is_link_local(AF_INET6, (const union in_addr_union *) &client->local_address) > 0, -EINVAL);
if (!IN_SET(client->state, DHCP6_STATE_STOPPED))
@@ -1183,7 +1182,7 @@ int sd_dhcp6_client_start(sd_dhcp6_client *client) {
if (r < 0)
return r;
- r = dhcp6_network_bind_udp_socket(client->index, &client->local_address);
+ r = dhcp6_network_bind_udp_socket(client->ifindex, &client->local_address);
if (r < 0) {
_cleanup_free_ char *p = NULL;
@@ -1301,15 +1300,11 @@ int sd_dhcp6_client_new(sd_dhcp6_client **ret) {
return -ENOMEM;
client->n_ref = 1;
-
client->ia_na.type = SD_DHCP6_OPTION_IA_NA;
-
- client->index = -1;
-
+ client->ifindex = -1;
client->fd = -1;
client->req_opts_len = ELEMENTSOF(default_req_opts);
-
client->req_opts = new0(be16_t, client->req_opts_len);
if (!client->req_opts)
return -ENOMEM;
diff --git a/src/libsystemd-network/sd-ipv4acd.c b/src/libsystemd-network/sd-ipv4acd.c
index 3c9fa85198..fcce97cfd9 100644
--- a/src/libsystemd-network/sd-ipv4acd.c
+++ b/src/libsystemd-network/sd-ipv4acd.c
@@ -81,7 +81,7 @@ struct sd_ipv4acd {
RefCount n_ref;
IPv4ACDState state;
- int index;
+ int ifindex;
int fd;
int iteration;
int conflict;
@@ -131,7 +131,7 @@ int sd_ipv4acd_new(sd_ipv4acd **ret) {
ll->n_ref = REFCNT_INIT;
ll->state = IPV4ACD_STATE_INIT;
- ll->index = -1;
+ ll->ifindex = -1;
ll->fd = -1;
*ret = ll;
@@ -264,7 +264,7 @@ static int ipv4acd_on_timeout(sd_event_source *s, uint64_t usec, void *userdata)
case IPV4ACD_STATE_WAITING_PROBE:
case IPV4ACD_STATE_PROBING:
/* Send a probe */
- r = arp_send_probe(ll->fd, ll->index, ll->address, &ll->mac_addr);
+ r = arp_send_probe(ll->fd, ll->ifindex, ll->address, &ll->mac_addr);
if (r < 0) {
log_ipv4acd_error_errno(ll, r, "Failed to send ARP probe: %m");
goto out;
@@ -301,7 +301,7 @@ static int ipv4acd_on_timeout(sd_event_source *s, uint64_t usec, void *userdata)
}
case IPV4ACD_STATE_WAITING_ANNOUNCE:
/* Send announcement packet */
- r = arp_send_announcement(ll->fd, ll->index, ll->address, &ll->mac_addr);
+ r = arp_send_announcement(ll->fd, ll->ifindex, ll->address, &ll->mac_addr);
if (r < 0) {
log_ipv4acd_error_errno(ll, r, "Failed to send ARP announcement: %m");
goto out;
@@ -390,7 +390,7 @@ static int ipv4acd_on_packet(
/* Defend address */
if (ts > ll->defend_window) {
ll->defend_window = ts + DEFEND_INTERVAL * USEC_PER_SEC;
- r = arp_send_announcement(ll->fd, ll->index, ll->address, &ll->mac_addr);
+ r = arp_send_announcement(ll->fd, ll->ifindex, ll->address, &ll->mac_addr);
if (r < 0) {
log_ipv4acd_error_errno(ll, r, "Failed to send ARP announcement: %m");
goto out;
@@ -420,12 +420,12 @@ out:
return 1;
}
-int sd_ipv4acd_set_index(sd_ipv4acd *ll, int interface_index) {
+int sd_ipv4acd_set_ifindex(sd_ipv4acd *ll, int ifindex) {
assert_return(ll, -EINVAL);
- assert_return(interface_index > 0, -EINVAL);
+ assert_return(ifindex > 0, -EINVAL);
assert_return(ll->state == IPV4ACD_STATE_INIT, -EBUSY);
- ll->index = interface_index;
+ ll->ifindex = ifindex;
return 0;
}
@@ -497,14 +497,14 @@ int sd_ipv4acd_start(sd_ipv4acd *ll) {
assert_return(ll, -EINVAL);
assert_return(ll->event, -EINVAL);
- assert_return(ll->index > 0, -EINVAL);
+ assert_return(ll->ifindex > 0, -EINVAL);
assert_return(ll->address != 0, -EINVAL);
assert_return(!ether_addr_is_null(&ll->mac_addr), -EINVAL);
assert_return(ll->state == IPV4ACD_STATE_INIT, -EBUSY);
ll->defend_window = 0;
- r = arp_network_bind_raw_socket(ll->index, ll->address, &ll->mac_addr);
+ r = arp_network_bind_raw_socket(ll->ifindex, ll->address, &ll->mac_addr);
if (r < 0)
goto out;
diff --git a/src/libsystemd-network/sd-ipv4ll.c b/src/libsystemd-network/sd-ipv4ll.c
index 2a06418c53..184603de52 100644
--- a/src/libsystemd-network/sd-ipv4ll.c
+++ b/src/libsystemd-network/sd-ipv4ll.c
@@ -125,10 +125,11 @@ int sd_ipv4ll_stop(sd_ipv4ll *ll) {
return 0;
}
-int sd_ipv4ll_set_index(sd_ipv4ll *ll, int interface_index) {
+int sd_ipv4ll_set_ifindex(sd_ipv4ll *ll, int ifindex) {
assert_return(ll, -EINVAL);
+ assert_return(ifindex > 0, -EINVAL);
- return sd_ipv4acd_set_index(ll->acd, interface_index);
+ return sd_ipv4acd_set_ifindex(ll->acd, ifindex);
}
#define HASH_KEY SD_ID128_MAKE(df,04,22,98,3f,ad,14,52,f9,87,2e,d1,9c,70,e2,f2)
diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c
index bb62cc21a3..ab2527b915 100644
--- a/src/libsystemd-network/sd-ndisc.c
+++ b/src/libsystemd-network/sd-ndisc.c
@@ -75,7 +75,7 @@ struct sd_ndisc {
enum NDiscState state;
sd_event *event;
int event_priority;
- int index;
+ int ifindex;
struct ether_addr mac_addr;
uint32_t mtu;
LIST_HEAD(NDiscPrefix, prefixes);
@@ -145,12 +145,11 @@ int sd_ndisc_set_callback(sd_ndisc *nd,
return 0;
}
-int sd_ndisc_set_index(sd_ndisc *nd, int interface_index) {
- assert(nd);
- assert(interface_index >= -1);
-
- nd->index = interface_index;
+int sd_ndisc_set_ifindex(sd_ndisc *nd, int ifindex) {
+ assert_return(nd, -EINVAL);
+ assert_return(ifindex > 0, -EINVAL);
+ nd->ifindex = ifindex;
return 0;
}
@@ -254,7 +253,7 @@ int sd_ndisc_new(sd_ndisc **ret) {
nd->n_ref = 1;
- nd->index = -1;
+ nd->ifindex = -1;
nd->fd = -1;
LIST_HEAD_INIT(nd->prefixes);
@@ -675,10 +674,10 @@ int sd_ndisc_router_discovery_start(sd_ndisc *nd) {
if (nd->state != NDISC_STATE_IDLE)
return -EBUSY;
- if (nd->index < 1)
+ if (nd->ifindex < 1)
return -EINVAL;
- r = icmp6_bind_router_solicitation(nd->index);
+ r = icmp6_bind_router_solicitation(nd->ifindex);
if (r < 0)
return r;
diff --git a/src/libsystemd-network/test-acd.c b/src/libsystemd-network/test-acd.c
index 75564615b9..27fcc332a3 100644
--- a/src/libsystemd-network/test-acd.c
+++ b/src/libsystemd-network/test-acd.c
@@ -56,7 +56,7 @@ static int client_run(int ifindex, const struct in_addr *pa, const struct ether_
assert_se(sd_ipv4acd_new(&acd) >= 0);
assert_se(sd_ipv4acd_attach_event(acd, e, 0) >= 0);
- assert_se(sd_ipv4acd_set_index(acd, ifindex) >= 0);
+ assert_se(sd_ipv4acd_set_ifindex(acd, ifindex) >= 0);
assert_se(sd_ipv4acd_set_mac(acd, ha) >= 0);
assert_se(sd_ipv4acd_set_address(acd, pa) >= 0);
assert_se(sd_ipv4acd_set_callback(acd, acd_handler, NULL) >= 0);
diff --git a/src/libsystemd-network/test-dhcp-client.c b/src/libsystemd-network/test-dhcp-client.c
index c3c08fef5e..2a101cb1fe 100644
--- a/src/libsystemd-network/test-dhcp-client.c
+++ b/src/libsystemd-network/test-dhcp-client.c
@@ -66,13 +66,13 @@ static void test_request_basic(sd_event *e) {
assert_se(sd_dhcp_client_set_request_option(NULL, 0) == -EINVAL);
assert_se(sd_dhcp_client_set_request_address(NULL, NULL) == -EINVAL);
- assert_se(sd_dhcp_client_set_index(NULL, 0) == -EINVAL);
+ assert_se(sd_dhcp_client_set_ifindex(NULL, 0) == -EINVAL);
- assert_se(sd_dhcp_client_set_index(client, 15) == 0);
- assert_se(sd_dhcp_client_set_index(client, -42) == -EINVAL);
- assert_se(sd_dhcp_client_set_index(client, -1) == -EINVAL);
- assert_se(sd_dhcp_client_set_index(client, 0) == -EINVAL);
- assert_se(sd_dhcp_client_set_index(client, 1) == 0);
+ assert_se(sd_dhcp_client_set_ifindex(client, 15) == 0);
+ assert_se(sd_dhcp_client_set_ifindex(client, -42) == -EINVAL);
+ assert_se(sd_dhcp_client_set_ifindex(client, -1) == -EINVAL);
+ assert_se(sd_dhcp_client_set_ifindex(client, 0) == -EINVAL);
+ assert_se(sd_dhcp_client_set_ifindex(client, 1) == 0);
assert_se(sd_dhcp_client_set_request_option(client,
SD_DHCP_OPTION_SUBNET_MASK) == -EEXIST);
@@ -243,7 +243,7 @@ static void test_discover_message(sd_event *e) {
r = sd_dhcp_client_attach_event(client, e, 0);
assert_se(r >= 0);
- assert_se(sd_dhcp_client_set_index(client, 42) >= 0);
+ assert_se(sd_dhcp_client_set_ifindex(client, 42) >= 0);
assert_se(sd_dhcp_client_set_mac(client, mac_addr, ETH_ALEN, ARPHRD_ETHER) >= 0);
assert_se(sd_dhcp_client_set_request_option(client, 248) >= 0);
@@ -458,7 +458,7 @@ static void test_addr_acq(sd_event *e) {
r = sd_dhcp_client_attach_event(client, e, 0);
assert_se(r >= 0);
- assert_se(sd_dhcp_client_set_index(client, 42) >= 0);
+ assert_se(sd_dhcp_client_set_ifindex(client, 42) >= 0);
assert_se(sd_dhcp_client_set_mac(client, mac_addr, ETH_ALEN, ARPHRD_ETHER) >= 0);
assert_se(sd_dhcp_client_set_callback(client, test_addr_acq_acquired, e) >= 0);
diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c
index e74c8c72db..bd289fa802 100644
--- a/src/libsystemd-network/test-dhcp6-client.c
+++ b/src/libsystemd-network/test-dhcp6-client.c
@@ -59,10 +59,10 @@ static int test_client_basic(sd_event *e) {
assert_se(sd_dhcp6_client_attach_event(client, e, 0) >= 0);
- assert_se(sd_dhcp6_client_set_index(client, 15) == 0);
- assert_se(sd_dhcp6_client_set_index(client, -42) == -EINVAL);
- assert_se(sd_dhcp6_client_set_index(client, -1) == 0);
- assert_se(sd_dhcp6_client_set_index(client, 42) >= 0);
+ assert_se(sd_dhcp6_client_set_ifindex(client, 15) == 0);
+ assert_se(sd_dhcp6_client_set_ifindex(client, -42) == -EINVAL);
+ assert_se(sd_dhcp6_client_set_ifindex(client, -1) == 0);
+ assert_se(sd_dhcp6_client_set_ifindex(client, 42) >= 0);
assert_se(sd_dhcp6_client_set_mac(client, (const uint8_t *) &mac_addr,
sizeof (mac_addr),
@@ -712,7 +712,7 @@ static int test_client_solicit(sd_event *e) {
assert_se(sd_dhcp6_client_attach_event(client, e, 0) >= 0);
- assert_se(sd_dhcp6_client_set_index(client, test_index) == 0);
+ assert_se(sd_dhcp6_client_set_ifindex(client, test_index) == 0);
assert_se(sd_dhcp6_client_set_mac(client, (const uint8_t *) &mac_addr,
sizeof (mac_addr),
ARPHRD_ETHER) >= 0);
diff --git a/src/libsystemd-network/test-ipv4ll-manual.c b/src/libsystemd-network/test-ipv4ll-manual.c
index 85dd61470d..2b1387fa91 100644
--- a/src/libsystemd-network/test-ipv4ll-manual.c
+++ b/src/libsystemd-network/test-ipv4ll-manual.c
@@ -64,7 +64,7 @@ static int client_run(int ifindex, const char *seed_str, const struct ether_addr
assert_se(sd_ipv4ll_new(&ll) >= 0);
assert_se(sd_ipv4ll_attach_event(ll, e, 0) >= 0);
- assert_se(sd_ipv4ll_set_index(ll, ifindex) >= 0);
+ assert_se(sd_ipv4ll_set_ifindex(ll, ifindex) >= 0);
assert_se(sd_ipv4ll_set_mac(ll, ha) >= 0);
assert_se(sd_ipv4ll_set_callback(ll, ll_handler, NULL) >= 0);
diff --git a/src/libsystemd-network/test-ipv4ll.c b/src/libsystemd-network/test-ipv4ll.c
index 8cdbfb8ed8..aad3c476a0 100644
--- a/src/libsystemd-network/test-ipv4ll.c
+++ b/src/libsystemd-network/test-ipv4ll.c
@@ -136,11 +136,11 @@ static void test_public_api_setters(sd_event *e) {
assert_se(sd_ipv4ll_set_mac(ll, NULL) == -EINVAL);
assert_se(sd_ipv4ll_set_mac(ll, &mac_addr) == 0);
- assert_se(sd_ipv4ll_set_index(NULL, -1) == -EINVAL);
- assert_se(sd_ipv4ll_set_index(ll, -1) == -EINVAL);
- assert_se(sd_ipv4ll_set_index(ll, -99) == -EINVAL);
- assert_se(sd_ipv4ll_set_index(ll, 1) == 0);
- assert_se(sd_ipv4ll_set_index(ll, 99) == 0);
+ assert_se(sd_ipv4ll_set_ifindex(NULL, -1) == -EINVAL);
+ assert_se(sd_ipv4ll_set_ifindex(ll, -1) == -EINVAL);
+ assert_se(sd_ipv4ll_set_ifindex(ll, -99) == -EINVAL);
+ assert_se(sd_ipv4ll_set_ifindex(ll, 1) == 0);
+ assert_se(sd_ipv4ll_set_ifindex(ll, 99) == 0);
assert_se(sd_ipv4ll_ref(ll) == ll);
assert_se(sd_ipv4ll_unref(ll) == NULL);
@@ -172,7 +172,7 @@ static void test_basic_request(sd_event *e) {
basic_request_handler_userdata) == 0);
assert_se(sd_ipv4ll_start(ll) == -EINVAL);
- assert_se(sd_ipv4ll_set_index(ll, 1) == 0);
+ assert_se(sd_ipv4ll_set_ifindex(ll, 1) == 0);
assert_se(sd_ipv4ll_start(ll) == 0);
sd_event_run(e, (uint64_t) -1);
diff --git a/src/libsystemd-network/test-ndisc-rs.c b/src/libsystemd-network/test-ndisc-rs.c
index f7b2eb8050..4817c968ac 100644
--- a/src/libsystemd-network/test-ndisc-rs.c
+++ b/src/libsystemd-network/test-ndisc-rs.c
@@ -130,7 +130,7 @@ static void test_rs(void) {
assert_se(sd_ndisc_attach_event(nd, e, 0) >= 0);
- assert_se(sd_ndisc_set_index(nd, 42) >= 0);
+ assert_se(sd_ndisc_set_ifindex(nd, 42) >= 0);
assert_se(sd_ndisc_set_mac(nd, &mac_addr) >= 0);
assert_se(sd_ndisc_set_callback(nd, test_rs_done, NULL, NULL, NULL, e) >= 0);
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 2ddcee9db8..12fb8e3fce 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -554,7 +554,7 @@ int dhcp4_configure(Link *link) {
if (r < 0)
return r;
- r = sd_dhcp_client_set_index(link->dhcp_client, link->ifindex);
+ r = sd_dhcp_client_set_ifindex(link->dhcp_client, link->ifindex);
if (r < 0)
return r;
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index 37e13e639e..a44c9ea71d 100644
--- a/src/network/networkd-dhcp6.c
+++ b/src/network/networkd-dhcp6.c
@@ -237,7 +237,7 @@ int dhcp6_configure(Link *link) {
if (r < 0)
goto error;
- r = sd_dhcp6_client_set_index(client, link->ifindex);
+ r = sd_dhcp6_client_set_ifindex(client, link->ifindex);
if (r < 0)
goto error;
diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c
index ae323d595b..a41f231f8c 100644
--- a/src/network/networkd-ipv4ll.c
+++ b/src/network/networkd-ipv4ll.c
@@ -231,7 +231,7 @@ int ipv4ll_configure(Link *link) {
if (r < 0)
return r;
- r = sd_ipv4ll_set_index(link->ipv4ll, link->ifindex);
+ r = sd_ipv4ll_set_ifindex(link->ipv4ll, link->ifindex);
if (r < 0)
return r;
diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
index 1a380bd214..3baca2e63c 100644
--- a/src/network/networkd-ndisc.c
+++ b/src/network/networkd-ndisc.c
@@ -243,7 +243,7 @@ int ndisc_configure(Link *link) {
if (r < 0)
return r;
- r = sd_ndisc_set_index(link->ndisc_router_discovery, link->ifindex);
+ r = sd_ndisc_set_ifindex(link->ndisc_router_discovery, link->ifindex);
if (r < 0)
return r;
diff --git a/src/systemd/sd-dhcp-client.h b/src/systemd/sd-dhcp-client.h
index 20b8c2873f..9a90c2ed42 100644
--- a/src/systemd/sd-dhcp-client.h
+++ b/src/systemd/sd-dhcp-client.h
@@ -99,7 +99,7 @@ int sd_dhcp_client_set_request_address(
int sd_dhcp_client_set_request_broadcast(
sd_dhcp_client *client,
int broadcast);
-int sd_dhcp_client_set_index(
+int sd_dhcp_client_set_ifindex(
sd_dhcp_client *client,
int interface_index);
int sd_dhcp_client_set_mac(
diff --git a/src/systemd/sd-dhcp6-client.h b/src/systemd/sd-dhcp6-client.h
index 90f62eaca4..7819f0d2de 100644
--- a/src/systemd/sd-dhcp6-client.h
+++ b/src/systemd/sd-dhcp6-client.h
@@ -82,7 +82,7 @@ int sd_dhcp6_client_set_callback(
sd_dhcp6_client_callback_t cb,
void *userdata);
-int sd_dhcp6_client_set_index(
+int sd_dhcp6_client_set_ifindex(
sd_dhcp6_client *client,
int interface_index);
int sd_dhcp6_client_set_local_address(
diff --git a/src/systemd/sd-ipv4acd.h b/src/systemd/sd-ipv4acd.h
index 9e3e14a30c..604160ae3f 100644
--- a/src/systemd/sd-ipv4acd.h
+++ b/src/systemd/sd-ipv4acd.h
@@ -44,7 +44,7 @@ int sd_ipv4acd_attach_event(sd_ipv4acd *ll, sd_event *event, int64_t priority);
int sd_ipv4acd_get_address(sd_ipv4acd *ll, struct in_addr *address);
int sd_ipv4acd_set_callback(sd_ipv4acd *ll, sd_ipv4acd_callback_t cb, void *userdata);
int sd_ipv4acd_set_mac(sd_ipv4acd *ll, const struct ether_addr *addr);
-int sd_ipv4acd_set_index(sd_ipv4acd *ll, int interface_index);
+int sd_ipv4acd_set_ifindex(sd_ipv4acd *ll, int interface_index);
int sd_ipv4acd_set_address(sd_ipv4acd *ll, const struct in_addr *address);
int sd_ipv4acd_is_running(sd_ipv4acd *ll);
int sd_ipv4acd_start(sd_ipv4acd *ll);
diff --git a/src/systemd/sd-ipv4ll.h b/src/systemd/sd-ipv4ll.h
index 6fa38a2243..95ed972ffe 100644
--- a/src/systemd/sd-ipv4ll.h
+++ b/src/systemd/sd-ipv4ll.h
@@ -43,7 +43,7 @@ int sd_ipv4ll_attach_event(sd_ipv4ll *ll, sd_event *event, int64_t priority);
int sd_ipv4ll_get_address(sd_ipv4ll *ll, struct in_addr *address);
int sd_ipv4ll_set_callback(sd_ipv4ll *ll, sd_ipv4ll_callback_t cb, void *userdata);
int sd_ipv4ll_set_mac(sd_ipv4ll *ll, const struct ether_addr *addr);
-int sd_ipv4ll_set_index(sd_ipv4ll *ll, int interface_index);
+int sd_ipv4ll_set_ifindex(sd_ipv4ll *ll, int interface_index);
int sd_ipv4ll_set_address(sd_ipv4ll *ll, const struct in_addr *address);
int sd_ipv4ll_set_address_seed(sd_ipv4ll *ll, unsigned seed);
int sd_ipv4ll_is_running(sd_ipv4ll *ll);
diff --git a/src/systemd/sd-ndisc.h b/src/systemd/sd-ndisc.h
index 29bcbe8e3e..2b774233b8 100644
--- a/src/systemd/sd-ndisc.h
+++ b/src/systemd/sd-ndisc.h
@@ -49,7 +49,7 @@ int sd_ndisc_set_callback(sd_ndisc *nd,
sd_ndisc_prefix_autonomous_callback_t pacb,
sd_ndisc_callback_t cb,
void *userdata);
-int sd_ndisc_set_index(sd_ndisc *nd, int interface_index);
+int sd_ndisc_set_ifindex(sd_ndisc *nd, int interface_index);
int sd_ndisc_set_mac(sd_ndisc *nd, const struct ether_addr *mac_addr);
int sd_ndisc_attach_event(sd_ndisc *nd, sd_event *event, int64_t priority);