]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
s/zone_id/scope_id/
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 4 May 2017 22:02:42 +0000 (18:02 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 4 May 2017 22:05:24 +0000 (18:05 -0400)
src/include/inet.h
src/lib/util/inet.c
src/lib/util/socket.c
src/modules/proto_dhcp/dhcp.c

index 153b5de50558565dc755c594c77c103215a99ca8..b02129c32dc820031c35bf78e35b1ef6606cafd4 100644 (file)
@@ -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
index e018f8562b77dc6075fb5fe84aa6ccc1d1508434..3878d357870528ddfa23659382b5c9aa6e8ebf25 100644 (file)
@@ -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 {
index 471edd98fc4199602d8cdfd426c9e5f04b34e1cb..119fbf5806f93d5c6e8eee87ada86b8637720b3d 100644 (file)
@@ -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;
                                }
index 1366fbb708c29ae0e58e3518a447eea1b7fef8e1..53c40e7f3f4c8d6b63958b9f79f6d6f5b8c8d5dc 100644 (file)
@@ -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) {