diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-07-02 15:49:19 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-07-02 16:58:06 +0900 |
commit | 1a6c9136763d6ea73d56bc3f2bff3e6d0d7b9087 (patch) | |
tree | 9bf17d66b2b03fda5cdf78eeb997c8fdd6caa32c /src/libsystemd-network | |
parent | 7fa69c0a6f8a0e5425856d7f74c3e44834077f6b (diff) | |
download | systemd-1a6c9136763d6ea73d56bc3f2bff3e6d0d7b9087.tar.gz |
libsystemd-network: rename index -> ifindex
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r-- | src/libsystemd-network/dhcp6-internal.h | 2 | ||||
-rw-r--r-- | src/libsystemd-network/dhcp6-network.c | 6 | ||||
-rw-r--r-- | src/libsystemd-network/icmp6-util.c | 8 | ||||
-rw-r--r-- | src/libsystemd-network/icmp6-util.h | 4 | ||||
-rw-r--r-- | src/libsystemd-network/test-dhcp-client.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/test-dhcp6-client.c | 8 | ||||
-rw-r--r-- | src/libsystemd-network/test-ipv4ll.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/test-ndisc-ra.c | 6 | ||||
-rw-r--r-- | src/libsystemd-network/test-ndisc-rs.c | 7 |
9 files changed, 22 insertions, 23 deletions
diff --git a/src/libsystemd-network/dhcp6-internal.h b/src/libsystemd-network/dhcp6-internal.h index b0d1216eed..baf7bb2ef4 100644 --- a/src/libsystemd-network/dhcp6-internal.h +++ b/src/libsystemd-network/dhcp6-internal.h @@ -112,7 +112,7 @@ int dhcp6_option_parse_ip6addrs(uint8_t *optval, uint16_t optlen, int dhcp6_option_parse_domainname(const uint8_t *optval, uint16_t optlen, char ***str_arr); -int dhcp6_network_bind_udp_socket(int index, struct in6_addr *address); +int dhcp6_network_bind_udp_socket(int ifindex, struct in6_addr *address); int dhcp6_network_send_udp_socket(int s, struct in6_addr *address, const void *packet, size_t len); diff --git a/src/libsystemd-network/dhcp6-network.c b/src/libsystemd-network/dhcp6-network.c index f82afe6a09..e2efa8bbe3 100644 --- a/src/libsystemd-network/dhcp6-network.c +++ b/src/libsystemd-network/dhcp6-network.c @@ -17,16 +17,16 @@ #include "fd-util.h" #include "socket-util.h" -int dhcp6_network_bind_udp_socket(int index, struct in6_addr *local_address) { +int dhcp6_network_bind_udp_socket(int ifindex, struct in6_addr *local_address) { union sockaddr_union src = { .in6.sin6_family = AF_INET6, .in6.sin6_port = htobe16(DHCP6_PORT_CLIENT), - .in6.sin6_scope_id = index, + .in6.sin6_scope_id = ifindex, }; _cleanup_close_ int s = -1; int r; - assert(index > 0); + assert(ifindex > 0); assert(local_address); src.in6.sin6_addr = *local_address; diff --git a/src/libsystemd-network/icmp6-util.c b/src/libsystemd-network/icmp6-util.c index bdd94867ac..d9690293f1 100644 --- a/src/libsystemd-network/icmp6-util.c +++ b/src/libsystemd-network/icmp6-util.c @@ -81,11 +81,11 @@ static int icmp6_bind_router_message(const struct icmp6_filter *filter, return TAKE_FD(s); } -int icmp6_bind_router_solicitation(int index) { +int icmp6_bind_router_solicitation(int ifindex) { struct icmp6_filter filter = {}; struct ipv6_mreq mreq = { .ipv6mr_multiaddr = IN6ADDR_ALL_NODES_MULTICAST_INIT, - .ipv6mr_interface = index, + .ipv6mr_interface = ifindex, }; ICMP6_FILTER_SETBLOCKALL(&filter); @@ -94,11 +94,11 @@ int icmp6_bind_router_solicitation(int index) { return icmp6_bind_router_message(&filter, &mreq); } -int icmp6_bind_router_advertisement(int index) { +int icmp6_bind_router_advertisement(int ifindex) { struct icmp6_filter filter = {}; struct ipv6_mreq mreq = { .ipv6mr_multiaddr = IN6ADDR_ALL_ROUTERS_MULTICAST_INIT, - .ipv6mr_interface = index, + .ipv6mr_interface = ifindex, }; ICMP6_FILTER_SETBLOCKALL(&filter); diff --git a/src/libsystemd-network/icmp6-util.h b/src/libsystemd-network/icmp6-util.h index 725a68086b..ac68ded1fe 100644 --- a/src/libsystemd-network/icmp6-util.h +++ b/src/libsystemd-network/icmp6-util.h @@ -17,8 +17,8 @@ { { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } } } -int icmp6_bind_router_solicitation(int index); -int icmp6_bind_router_advertisement(int index); +int icmp6_bind_router_solicitation(int ifindex); +int icmp6_bind_router_advertisement(int ifindex); int icmp6_send_router_solicitation(int s, const struct ether_addr *ether_addr); int icmp6_receive(int fd, void *buffer, size_t size, struct in6_addr *dst, triple_timestamp *timestamp); diff --git a/src/libsystemd-network/test-dhcp-client.c b/src/libsystemd-network/test-dhcp-client.c index 80a8566194..8f2f4462be 100644 --- a/src/libsystemd-network/test-dhcp-client.c +++ b/src/libsystemd-network/test-dhcp-client.c @@ -258,7 +258,7 @@ int dhcp_network_send_raw_socket(int s, const union sockaddr_union *link, const } int dhcp_network_bind_raw_socket( - int index, + int ifindex, union sockaddr_union *link, uint32_t id, const uint8_t *addr, size_t addr_len, diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c index fb6df71b22..7af7d670b5 100644 --- a/src/libsystemd-network/test-dhcp6-client.c +++ b/src/libsystemd-network/test-dhcp6-client.c @@ -30,7 +30,7 @@ static struct ether_addr mac_addr = { static sd_event_source *hangcheck; static int test_dhcp_fd[2]; -static int test_index = 42; +static int test_ifindex = 42; static int test_client_message_num; static be32_t test_iaid = 0; static uint8_t test_duid[14] = { }; @@ -877,8 +877,8 @@ int dhcp6_network_send_udp_socket(int s, struct in6_addr *server_address, return len; } -int dhcp6_network_bind_udp_socket(int index, struct in6_addr *local_address) { - assert_se(index == test_index); +int dhcp6_network_bind_udp_socket(int ifindex, struct in6_addr *local_address) { + assert_se(ifindex == test_ifindex); if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0, test_dhcp_fd) < 0) return -errno; @@ -899,7 +899,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_ifindex(client, test_index) == 0); + assert_se(sd_dhcp6_client_set_ifindex(client, test_ifindex) == 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.c b/src/libsystemd-network/test-ipv4ll.c index 6051e65820..310b658e18 100644 --- a/src/libsystemd-network/test-ipv4ll.c +++ b/src/libsystemd-network/test-ipv4ll.c @@ -78,7 +78,7 @@ int arp_send_announcement(int fd, int ifindex, return arp_network_send_raw_socket(fd, ifindex, &ea); } -int arp_network_bind_raw_socket(int index, be32_t address, const struct ether_addr *eth_mac) { +int arp_network_bind_raw_socket(int ifindex, be32_t address, const struct ether_addr *eth_mac) { if (socketpair(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0, test_fd) < 0) return -errno; diff --git a/src/libsystemd-network/test-ndisc-ra.c b/src/libsystemd-network/test-ndisc-ra.c index afd50d8fe3..d759ec03a8 100644 --- a/src/libsystemd-network/test-ndisc-ra.c +++ b/src/libsystemd-network/test-ndisc-ra.c @@ -219,12 +219,12 @@ static void test_radv(void) { assert_se(!ra); } -int icmp6_bind_router_solicitation(int index) { +int icmp6_bind_router_solicitation(int ifindex) { return -ENOSYS; } -int icmp6_bind_router_advertisement(int index) { - assert_se(index == 42); +int icmp6_bind_router_advertisement(int ifindex) { + assert_se(ifindex == 42); return test_fd[1]; } diff --git a/src/libsystemd-network/test-ndisc-rs.c b/src/libsystemd-network/test-ndisc-rs.c index 9fc902645c..5d1e66fcdc 100644 --- a/src/libsystemd-network/test-ndisc-rs.c +++ b/src/libsystemd-network/test-ndisc-rs.c @@ -174,8 +174,8 @@ static int test_rs_hangcheck(sd_event_source *s, uint64_t usec, return 0; } -int icmp6_bind_router_solicitation(int index) { - assert_se(index == 42); +int icmp6_bind_router_solicitation(int ifindex) { + assert_se(ifindex == 42); if (socketpair(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0, test_fd) < 0) return -errno; @@ -183,8 +183,7 @@ int icmp6_bind_router_solicitation(int index) { return test_fd[0]; } -int icmp6_bind_router_advertisement(int index) { - +int icmp6_bind_router_advertisement(int ifindex) { return -ENOSYS; } |