mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
libsystemd-network: rename index -> ifindex
This commit is contained in:
parent
7fa69c0a6f
commit
1a6c913676
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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];
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user