summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-ndisc.c
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 /src/libsystemd-network/sd-ndisc.c
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.
Diffstat (limited to 'src/libsystemd-network/sd-ndisc.c')
-rw-r--r--src/libsystemd-network/sd-ndisc.c17
1 files changed, 8 insertions, 9 deletions
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;