From: Arran Cudbard-Bell Date: Thu, 4 May 2017 22:02:42 +0000 (-0400) Subject: s/zone_id/scope_id/ X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a78dd1e0f84d58948f2d93d85ac604b898640bb;p=thirdparty%2Ffreeradius-server.git s/zone_id/scope_id/ --- diff --git a/src/include/inet.h b/src/include/inet.h index 153b5de5055..b02129c32dc 100644 --- a/src/include/inet.h +++ b/src/include/inet.h @@ -47,7 +47,7 @@ typedef struct fr_ipaddr_t { struct in6_addr v6; //!< IPv6 address. } addr; uint8_t prefix; //!< Prefix length - Between 0-32 for IPv4 and 0-128 for IPv6. - uint32_t zone_id; //!< A host may have multiple link-local interfaces + uint32_t scope_id; //!< A host may have multiple link-local interfaces //!< the scope ID allows the application to specify which of //!< those interfaces the IP applies to. A special scope_id //!< of zero means that any interface of a given scope can diff --git a/src/lib/util/inet.c b/src/lib/util/inet.c index e018f8562b7..3878d357870 100644 --- a/src/lib/util/inet.c +++ b/src/lib/util/inet.c @@ -736,7 +736,7 @@ char *fr_inet_ntop(char out[FR_IPADDR_STRLEN], size_t outlen, fr_ipaddr_t const if (inet_ntop(addr->af, &addr->addr, out, outlen) == NULL) return NULL; - if ((addr->af == AF_INET) || (addr->zone_id == 0)) return out; + if ((addr->af == AF_INET) || (addr->scope_id == 0)) return out; p = out + strlen(out); @@ -745,7 +745,7 @@ char *fr_inet_ntop(char out[FR_IPADDR_STRLEN], size_t outlen, fr_ipaddr_t const char buffer[IFNAMSIZ]; char *ifname; - ifname = fr_ifname_from_ifindex(buffer, addr->zone_id); + ifname = fr_ifname_from_ifindex(buffer, addr->scope_id); if (ifname) { len = snprintf(p, outlen - (p - out), "%%%s", ifname); if (is_truncated(len + (p - out), outlen)) { @@ -759,7 +759,7 @@ char *fr_inet_ntop(char out[FR_IPADDR_STRLEN], size_t outlen, fr_ipaddr_t const } #endif - len = snprintf(p, outlen - (p - out), "%%%u", addr->zone_id); + len = snprintf(p, outlen - (p - out), "%%%u", addr->scope_id); if (is_truncated(len + (p - out), outlen)) { fr_strerror_printf("Address buffer too small, needed %zu bytes, have %zu bytes", (p - out) + len, outlen); @@ -1059,8 +1059,8 @@ int fr_ipaddr_cmp(fr_ipaddr_t const *a, fr_ipaddr_t const *b) #ifdef HAVE_STRUCT_SOCKADDR_IN6 case AF_INET6: - if (a->zone_id < b->zone_id) return -1; - if (a->zone_id > b->zone_id) return +1; + if (a->scope_id < b->scope_id) return -1; + if (a->scope_id > b->scope_id) return +1; return memcmp(&a->addr.v6, &b->addr.v6, @@ -1101,7 +1101,7 @@ int fr_ipaddr_to_sockaddr(fr_ipaddr_t const *ipaddr, uint16_t port, s6.sin6_family = AF_INET6; s6.sin6_addr = ipaddr->addr.v6; s6.sin6_port = htons(port); - s6.sin6_scope_id = ipaddr->zone_id; + s6.sin6_scope_id = ipaddr->scope_id; memset(sa, 0, sizeof(*sa)); memcpy(sa, &s6, sizeof(s6)); #endif @@ -1145,7 +1145,7 @@ int fr_ipaddr_from_sockaddr(struct sockaddr_storage const *sa, socklen_t salen, ipaddr->prefix = 128; ipaddr->addr.v6 = s6.sin6_addr; if (port) *port = ntohs(s6.sin6_port); - ipaddr->zone_id = s6.sin6_scope_id; + ipaddr->scope_id = s6.sin6_scope_id; #endif } else { diff --git a/src/lib/util/socket.c b/src/lib/util/socket.c index 471edd98fc4..119fbf5806f 100644 --- a/src/lib/util/socket.c +++ b/src/lib/util/socket.c @@ -649,9 +649,9 @@ int fr_socket_server_bind(int sockfd, fr_ipaddr_t *ipaddr, int *port, char const * the interface. */ if (ipaddr->af == AF_INET6) { - if (ipaddr->zone_id == 0) { - ipaddr->zone_id = if_nametoindex(interface); - if (ipaddr->zone_id == 0) { + if (ipaddr->scope_id == 0) { + ipaddr->scope_id = if_nametoindex(interface); + if (ipaddr->scope_id == 0) { fr_strerror_printf("Failed finding interface %s: %s", interface, fr_syserror(errno)); return -1; } diff --git a/src/modules/proto_dhcp/dhcp.c b/src/modules/proto_dhcp/dhcp.c index 1366fbb708c..53c40e7f3f4 100644 --- a/src/modules/proto_dhcp/dhcp.c +++ b/src/modules/proto_dhcp/dhcp.c @@ -537,11 +537,11 @@ RADIUS_PACKET *fr_dhcp_recv_pcap(fr_pcap_t *pcap) src_ipaddr.af = AF_INET; src_ipaddr.addr.v4 = ip->ip_src; src_ipaddr.prefix = 32; - src_ipaddr.zone_id = 0; dst_ipaddr.af = AF_INET; + src_ipaddr.scope_id = 0; dst_ipaddr.addr.v4 = ip->ip_dst; dst_ipaddr.prefix = 32; - dst_ipaddr.zone_id = 0; + dst_ipaddr.scope_id = 0; packet = fr_dhcp_packet_ok(p, data_len, src_ipaddr, src_port, dst_ipaddr, dst_port); if (packet) {