• Home
  • Raw
  • Download

Lines Matching refs:addr

51 int iface_check(int family, struct all_addr *addr, char *name, int *indexp)  in iface_check()  argument
90 if (daemon->if_names || (addr && daemon->if_addrs)) in iface_check()
99 if (addr && tmp->addr.sa.sa_family == family) in iface_check()
102 tmp->addr.in.sin_addr.s_addr == addr->addr.addr4.s_addr) in iface_check()
106 IN6_ARE_ADDR_EQUAL(&tmp->addr.in6.sin6_addr, in iface_check()
107 &addr->addr.addr6) && in iface_check()
108 (!IN6_IS_ADDR_LINKLOCAL(&addr->addr.addr6) || in iface_check()
109 (tmp->addr.in6.sin6_scope_id == (uint32_t) *indexp))) in iface_check()
123 union mysockaddr *addr, struct in_addr netmask) in iface_allowed() argument
134 if (sockaddr_isequal(&iface->addr, addr)) in iface_allowed()
180 if (addr->sa.sa_family == AF_INET && in iface_allowed()
181 !iface_check(AF_INET, (struct all_addr *)&addr->in.sin_addr, ifr.ifr_name, NULL)) in iface_allowed()
189 int ifindex = (int) addr->in6.sin6_scope_id; in iface_allowed()
190 if (addr->sa.sa_family == AF_INET6 && in iface_allowed()
191 !iface_check(AF_INET6, (struct all_addr *)&addr->in6.sin6_addr, ifr.ifr_name, &ifindex)) in iface_allowed()
198 iface->addr = *addr; in iface_allowed()
215 union mysockaddr addr; in iface_allowed_v6() local
220 memset(&addr, 0, sizeof(addr)); in iface_allowed_v6()
222 addr.in6.sin6_len = sizeof(addr.in6); in iface_allowed_v6()
224 addr.in6.sin6_family = AF_INET6; in iface_allowed_v6()
225 addr.in6.sin6_addr = *local; in iface_allowed_v6()
226 addr.in6.sin6_port = htons(daemon->port); in iface_allowed_v6()
234 addr.in6.sin6_scope_id = scope; in iface_allowed_v6()
237 return iface_allowed((struct irec **)vparam, if_index, &addr, netmask); in iface_allowed_v6()
244 union mysockaddr addr; in iface_allowed_v4() local
246 memset(&addr, 0, sizeof(addr)); in iface_allowed_v4()
248 addr.in.sin_len = sizeof(addr.in); in iface_allowed_v4()
250 addr.in.sin_family = AF_INET; in iface_allowed_v4()
251 addr.in.sin_addr = broadcast; /* warning */ in iface_allowed_v4()
252 addr.in.sin_addr = local; in iface_allowed_v4()
253 addr.in.sin_port = htons(daemon->port); in iface_allowed_v4()
255 return iface_allowed((struct irec **)vparam, if_index, &addr, netmask); in iface_allowed_v4()
282 union mysockaddr addr; in create_ipv6_listener() local
287 memset(&addr, 0, sizeof(addr)); in create_ipv6_listener()
288 addr.in6.sin6_family = AF_INET6; in create_ipv6_listener()
289 addr.in6.sin6_addr = in6addr_any; in create_ipv6_listener()
290 addr.in6.sin6_port = htons(port); in create_ipv6_listener()
292 addr.in6.sin6_len = sizeof(addr.in6); in create_ipv6_listener()
315 bind(tcpfd, (struct sockaddr *)&addr, sa_len(&addr)) == -1 || in create_ipv6_listener()
317 bind(fd, (struct sockaddr *)&addr, sa_len(&addr)) == -1) in create_ipv6_listener()
334 union mysockaddr addr; in create_wildcard_listeners() local
339 memset(&addr, 0, sizeof(addr)); in create_wildcard_listeners()
340 addr.in.sin_family = AF_INET; in create_wildcard_listeners()
341 addr.in.sin_addr.s_addr = INADDR_ANY; in create_wildcard_listeners()
342 addr.in.sin_port = htons(daemon->port); in create_wildcard_listeners()
344 addr.in.sin_len = sizeof(struct sockaddr_in); in create_wildcard_listeners()
355 bind(tcpfd, (struct sockaddr *)&addr, sa_len(&addr)) == -1 || in create_wildcard_listeners()
369 bind(fd, (struct sockaddr *)&addr, sa_len(&addr)) == -1) in create_wildcard_listeners()
421 new->family = iface->addr.sa.sa_family; in create_bound_listener()
430 if ((new->tcpfd = socket(iface->addr.sa.sa_family, SOCK_STREAM, 0)) == -1 || in create_bound_listener()
431 (new->fd = socket(iface->addr.sa.sa_family, SOCK_DGRAM, 0)) == -1 || in create_bound_listener()
439 if (iface->addr.sa.sa_family == AF_INET6) in create_bound_listener()
449 if ((rc = bind(new->fd, &iface->addr.sa, sa_len(&iface->addr))) != -1) in create_bound_listener()
458 if (iface->addr.sa.sa_family == AF_INET6 && (errno == ENODEV || errno == EADDRNOTAVAIL) && in create_bound_listener()
468 if (rc == -1 || bind(new->tcpfd, &iface->addr.sa, sa_len(&iface->addr)) == -1) in create_bound_listener()
470 prettyprint_addr(&iface->addr, daemon->namebuff); in create_bound_listener()
502 if (sockaddr_isequal(&listener_iface->addr, &new_iface->addr)) { in fixup_possible_existing_listener()
520 int port = prettyprint_addr(&listener->iface->addr, daemon->namebuff); in delete_listener()
559 if (iface && listener_iface && sockaddr_isequal(&listener_iface->addr, &iface->addr)) { in close_bound_listener()
592 new->family = iface->addr.sa.sa_family; in create_bound_listeners()
601 if ((new->tcpfd = socket(iface->addr.sa.sa_family, SOCK_STREAM, 0)) == -1 || in create_bound_listeners()
602 (new->fd = socket(iface->addr.sa.sa_family, SOCK_DGRAM, 0)) == -1 || in create_bound_listeners()
610 if (iface->addr.sa.sa_family == AF_INET6) in create_bound_listeners()
620 if ((rc = bind(new->fd, &iface->addr.sa, sa_len(&iface->addr))) != -1) in create_bound_listeners()
627 if (iface->addr.sa.sa_family == AF_INET6 && (errno == ENODEV || errno == EADDRNOTAVAIL) && in create_bound_listeners()
637 if (rc == -1 || bind(new->tcpfd, &iface->addr.sa, sa_len(&iface->addr)) == -1) in create_bound_listeners()
639 prettyprint_addr(&iface->addr, daemon->namebuff); in create_bound_listeners()
662 union mysockaddr addr; in random_sock() local
666 memset(&addr, 0, sizeof(addr)); in random_sock()
667 addr.sa.sa_family = family; in random_sock()
681 addr.in.sin_addr.s_addr = INADDR_ANY; in random_sock()
682 addr.in.sin_port = port; in random_sock()
684 addr.in.sin_len = sizeof(struct sockaddr_in); in random_sock()
690 addr.in6.sin6_addr = in6addr_any; in random_sock()
691 addr.in6.sin6_port = port; in random_sock()
693 addr.in6.sin6_len = sizeof(struct sockaddr_in6); in random_sock()
698 if (bind(fd, (struct sockaddr *)&addr, sa_len(&addr)) == 0) in random_sock()
712 int local_bind(int fd, union mysockaddr *addr, char *intname, uint32_t mark, int is_tcp) in local_bind() argument
714 union mysockaddr addr_copy = *addr; in local_bind()
742 static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname, uint32_t mark) in allocate_sfd() argument
753 if (addr->sa.sa_family == AF_INET && in allocate_sfd()
754 addr->in.sin_addr.s_addr == INADDR_ANY && in allocate_sfd()
755 addr->in.sin_port == htons(0)) in allocate_sfd()
759 if (addr->sa.sa_family == AF_INET6 && in allocate_sfd()
760 memcmp(&addr->in6.sin6_addr, &in6addr_any, sizeof(in6addr_any)) == 0 && in allocate_sfd()
761 addr->in6.sin6_port == htons(0)) in allocate_sfd()
768 if (sockaddr_isequal(&sfd->source_addr, addr) && in allocate_sfd()
778 if ((sfd->fd = socket(addr->sa.sa_family, SOCK_DGRAM, 0)) == -1) in allocate_sfd()
784 if (!local_bind(sfd->fd, addr, intname, mark, 0) || !fix_fd(sfd->fd)) in allocate_sfd()
794 sfd->source_addr = *addr; in allocate_sfd()
809 union mysockaddr addr; in pre_allocate_sfds() local
810 memset(&addr, 0, sizeof(addr)); in pre_allocate_sfds()
811 addr.in.sin_family = AF_INET; in pre_allocate_sfds()
812 addr.in.sin_addr.s_addr = INADDR_ANY; in pre_allocate_sfds()
813 addr.in.sin_port = htons(daemon->query_port); in pre_allocate_sfds()
815 addr.in.sin_len = sizeof(struct sockaddr_in); in pre_allocate_sfds()
817 allocate_sfd(&addr, "", 0); in pre_allocate_sfds()
819 memset(&addr, 0, sizeof(addr)); in pre_allocate_sfds()
820 addr.in6.sin6_family = AF_INET6; in pre_allocate_sfds()
821 addr.in6.sin6_addr = in6addr_any; in pre_allocate_sfds()
822 addr.in6.sin6_port = htons(daemon->query_port); in pre_allocate_sfds()
824 addr.in6.sin6_len = sizeof(struct sockaddr_in6); in pre_allocate_sfds()
826 allocate_sfd(&addr, "", 0); in pre_allocate_sfds()
836 prettyprint_addr(&srv->addr, daemon->namebuff); in pre_allocate_sfds()
860 port = prettyprint_addr(&new->addr, daemon->namebuff); in check_servers()
863 if (new->addr.sa.sa_family == AF_INET && in check_servers()
864 new->addr.in.sin_addr.s_addr == 0) in check_servers()
871 if (sockaddr_isequal(&new->addr, &iface->addr)) in check_servers()
988 if (sockaddr_isequal(&old_iface->addr, &new_iface->addr)) { in set_interfaces()
999 prettyprint_addr(&old_iface->addr, debug_buff); in set_interfaces()
1018 if(sockaddr_isequal(&old_iface->addr, &new_iface->addr)) { in set_interfaces()
1027 prettyprint_addr(&new_iface->addr, debug_buff); in set_interfaces()
1095 union mysockaddr addr, source_addr; in set_servers() local
1096 memset(&addr, 0, sizeof(addr)); in set_servers()
1099 if (parse_addr(AF_INET, saddr, &addr) == 0) in set_servers()
1101 addr.in.sin_port = htons(NAMESERVER_PORT); in set_servers()
1107 else if (parse_addr(AF_INET6, saddr, &addr) == 0) in set_servers()
1109 addr.in6.sin6_port = htons(NAMESERVER_PORT); in set_servers()
1130 serv->addr = addr; in set_servers()
1194 union mysockaddr addr, source_addr; in reload_servers() local
1204 memset(&addr, 0, sizeof(addr)); in reload_servers()
1207 if (parse_addr(AF_INET, token, &addr) == 0) in reload_servers()
1209 addr.in.sin_port = htons(NAMESERVER_PORT); in reload_servers()
1215 else if (parse_addr(AF_INET6, token, &addr) == 0) in reload_servers()
1217 addr.in6.sin6_port = htons(NAMESERVER_PORT); in reload_servers()
1238 serv->addr = addr; in reload_servers()