Lines Matching refs:addr

49 int iface_check(int family, struct all_addr *addr, char *name, int *indexp)  in iface_check()  argument
88 if (daemon->if_names || (addr && daemon->if_addrs)) in iface_check()
97 if (addr && tmp->addr.sa.sa_family == family) in iface_check()
100 tmp->addr.in.sin_addr.s_addr == addr->addr.addr4.s_addr) in iface_check()
104 IN6_ARE_ADDR_EQUAL(&tmp->addr.in6.sin6_addr, in iface_check()
105 &addr->addr.addr6)) in iface_check()
119 union mysockaddr *addr, struct in_addr netmask) in iface_allowed() argument
130 if (sockaddr_isequal(&iface->addr, addr)) in iface_allowed()
176 if (addr->sa.sa_family == AF_INET && in iface_allowed()
177 !iface_check(AF_INET, (struct all_addr *)&addr->in.sin_addr, ifr.ifr_name, NULL)) in iface_allowed()
185 if (addr->sa.sa_family == AF_INET6 && in iface_allowed()
186 !iface_check(AF_INET6, (struct all_addr *)&addr->in6.sin6_addr, ifr.ifr_name, NULL)) in iface_allowed()
193 iface->addr = *addr; in iface_allowed()
210 union mysockaddr addr; in iface_allowed_v6() local
215 memset(&addr, 0, sizeof(addr)); in iface_allowed_v6()
217 addr.in6.sin6_len = sizeof(addr.in6); in iface_allowed_v6()
219 addr.in6.sin6_family = AF_INET6; in iface_allowed_v6()
220 addr.in6.sin6_addr = *local; in iface_allowed_v6()
221 addr.in6.sin6_port = htons(daemon->port); in iface_allowed_v6()
222 addr.in6.sin6_scope_id = scope; in iface_allowed_v6()
224 return iface_allowed((struct irec **)vparam, if_index, &addr, netmask); in iface_allowed_v6()
231 union mysockaddr addr; in iface_allowed_v4() local
233 memset(&addr, 0, sizeof(addr)); in iface_allowed_v4()
235 addr.in.sin_len = sizeof(addr.in); in iface_allowed_v4()
237 addr.in.sin_family = AF_INET; in iface_allowed_v4()
238 addr.in.sin_addr = broadcast; /* warning */ in iface_allowed_v4()
239 addr.in.sin_addr = local; in iface_allowed_v4()
240 addr.in.sin_port = htons(daemon->port); in iface_allowed_v4()
242 return iface_allowed((struct irec **)vparam, if_index, &addr, netmask); in iface_allowed_v4()
269 union mysockaddr addr; in create_ipv6_listener() local
274 memset(&addr, 0, sizeof(addr)); in create_ipv6_listener()
275 addr.in6.sin6_family = AF_INET6; in create_ipv6_listener()
276 addr.in6.sin6_addr = in6addr_any; in create_ipv6_listener()
277 addr.in6.sin6_port = htons(port); in create_ipv6_listener()
279 addr.in6.sin6_len = sizeof(addr.in6); in create_ipv6_listener()
302 bind(tcpfd, (struct sockaddr *)&addr, sa_len(&addr)) == -1 || in create_ipv6_listener()
304 bind(fd, (struct sockaddr *)&addr, sa_len(&addr)) == -1) in create_ipv6_listener()
322 union mysockaddr addr; in create_wildcard_listeners() local
327 memset(&addr, 0, sizeof(addr)); in create_wildcard_listeners()
328 addr.in.sin_family = AF_INET; in create_wildcard_listeners()
329 addr.in.sin_addr.s_addr = INADDR_ANY; in create_wildcard_listeners()
330 addr.in.sin_port = htons(daemon->port); in create_wildcard_listeners()
332 addr.in.sin_len = sizeof(struct sockaddr_in); in create_wildcard_listeners()
343 bind(tcpfd, (struct sockaddr *)&addr, sa_len(&addr)) == -1 || in create_wildcard_listeners()
357 bind(fd, (struct sockaddr *)&addr, sa_len(&addr)) == -1) in create_wildcard_listeners()
364 addr.in.sin_port = htons(TFTP_PORT); in create_wildcard_listeners()
375 bind(tftpfd, (struct sockaddr *)&addr, sa_len(&addr)) == -1) in create_wildcard_listeners()
412 new->family = iface->addr.sa.sa_family; in create_bound_listener()
422 if ((new->tcpfd = socket(iface->addr.sa.sa_family, SOCK_STREAM, 0)) == -1 || in create_bound_listener()
423 (new->fd = socket(iface->addr.sa.sa_family, SOCK_DGRAM, 0)) == -1 || in create_bound_listener()
431 if (iface->addr.sa.sa_family == AF_INET6) in create_bound_listener()
441 if ((rc = bind(new->fd, &iface->addr.sa, sa_len(&iface->addr))) != -1) in create_bound_listener()
448 if (iface->addr.sa.sa_family == AF_INET6 && (errno == ENODEV || errno == EADDRNOTAVAIL) && in create_bound_listener()
458 if (rc == -1 || bind(new->tcpfd, &iface->addr.sa, sa_len(&iface->addr)) == -1) in create_bound_listener()
460 prettyprint_addr(&iface->addr, daemon->namebuff); in create_bound_listener()
469 if ((daemon->options & OPT_TFTP) && iface->addr.sa.sa_family == AF_INET && iface->dhcp_ok) in create_bound_listener()
471 short save = iface->addr.in.sin_port; in create_bound_listener()
472 iface->addr.in.sin_port = htons(TFTP_PORT); in create_bound_listener()
476 bind(new->tftpfd, &iface->addr.sa, sa_len(&iface->addr)) == -1) in create_bound_listener()
478 iface->addr.in.sin_port = save; in create_bound_listener()
500 if (sockaddr_isequal(&listener_iface->addr, &new_iface->addr)) { in fixup_possible_existing_listener()
525 if (sockaddr_isequal(&listener_iface->addr, &interface->addr)) { in close_bound_listener()
575 new->family = iface->addr.sa.sa_family; in create_bound_listeners()
585 if ((new->tcpfd = socket(iface->addr.sa.sa_family, SOCK_STREAM, 0)) == -1 || in create_bound_listeners()
586 (new->fd = socket(iface->addr.sa.sa_family, SOCK_DGRAM, 0)) == -1 || in create_bound_listeners()
594 if (iface->addr.sa.sa_family == AF_INET6) in create_bound_listeners()
604 if ((rc = bind(new->fd, &iface->addr.sa, sa_len(&iface->addr))) != -1) in create_bound_listeners()
611 if (iface->addr.sa.sa_family == AF_INET6 && (errno == ENODEV || errno == EADDRNOTAVAIL) && in create_bound_listeners()
621 if (rc == -1 || bind(new->tcpfd, &iface->addr.sa, sa_len(&iface->addr)) == -1) in create_bound_listeners()
623 prettyprint_addr(&iface->addr, daemon->namebuff); in create_bound_listeners()
633 if ((daemon->options & OPT_TFTP) && iface->addr.sa.sa_family == AF_INET && iface->dhcp_ok) in create_bound_listeners()
635 short save = iface->addr.in.sin_port; in create_bound_listeners()
636 iface->addr.in.sin_port = htons(TFTP_PORT); in create_bound_listeners()
640 bind(new->tftpfd, &iface->addr.sa, sa_len(&iface->addr)) == -1) in create_bound_listeners()
642 iface->addr.in.sin_port = save; in create_bound_listeners()
660 union mysockaddr addr; in random_sock() local
664 memset(&addr, 0, sizeof(addr)); in random_sock()
665 addr.sa.sa_family = family; in random_sock()
679 addr.in.sin_addr.s_addr = INADDR_ANY; in random_sock()
680 addr.in.sin_port = port; in random_sock()
682 addr.in.sin_len = sizeof(struct sockaddr_in); in random_sock()
688 addr.in6.sin6_addr = in6addr_any; in random_sock()
689 addr.in6.sin6_port = port; in random_sock()
691 addr.in6.sin6_len = sizeof(struct sockaddr_in6); in random_sock()
696 if (bind(fd, (struct sockaddr *)&addr, sa_len(&addr)) == 0) in random_sock()
710 int local_bind(int fd, union mysockaddr *addr, char *intname, uint32_t mark, int is_tcp) in local_bind() argument
712 union mysockaddr addr_copy = *addr; in local_bind()
740 static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname, uint32_t mark) in allocate_sfd() argument
751 if (addr->sa.sa_family == AF_INET && in allocate_sfd()
752 addr->in.sin_addr.s_addr == INADDR_ANY && in allocate_sfd()
753 addr->in.sin_port == htons(0)) in allocate_sfd()
757 if (addr->sa.sa_family == AF_INET6 && in allocate_sfd()
758 memcmp(&addr->in6.sin6_addr, &in6addr_any, sizeof(in6addr_any)) == 0 && in allocate_sfd()
759 addr->in6.sin6_port == htons(0)) in allocate_sfd()
766 if (sockaddr_isequal(&sfd->source_addr, addr) && in allocate_sfd()
776 if ((sfd->fd = socket(addr->sa.sa_family, SOCK_DGRAM, 0)) == -1) in allocate_sfd()
782 if (!local_bind(sfd->fd, addr, intname, mark, 0) || !fix_fd(sfd->fd)) in allocate_sfd()
792 sfd->source_addr = *addr; in allocate_sfd()
807 union mysockaddr addr; in pre_allocate_sfds() local
808 memset(&addr, 0, sizeof(addr)); in pre_allocate_sfds()
809 addr.in.sin_family = AF_INET; in pre_allocate_sfds()
810 addr.in.sin_addr.s_addr = INADDR_ANY; in pre_allocate_sfds()
811 addr.in.sin_port = htons(daemon->query_port); in pre_allocate_sfds()
813 addr.in.sin_len = sizeof(struct sockaddr_in); in pre_allocate_sfds()
815 allocate_sfd(&addr, "", 0); in pre_allocate_sfds()
817 memset(&addr, 0, sizeof(addr)); in pre_allocate_sfds()
818 addr.in6.sin6_family = AF_INET6; in pre_allocate_sfds()
819 addr.in6.sin6_addr = in6addr_any; in pre_allocate_sfds()
820 addr.in6.sin6_port = htons(daemon->query_port); in pre_allocate_sfds()
822 addr.in6.sin6_len = sizeof(struct sockaddr_in6); in pre_allocate_sfds()
824 allocate_sfd(&addr, "", 0); in pre_allocate_sfds()
834 prettyprint_addr(&srv->addr, daemon->namebuff); in pre_allocate_sfds()
858 port = prettyprint_addr(&new->addr, daemon->namebuff); in check_servers()
861 if (new->addr.sa.sa_family == AF_INET && in check_servers()
862 new->addr.in.sin_addr.s_addr == 0) in check_servers()
869 if (sockaddr_isequal(&new->addr, &iface->addr)) in check_servers()
974 if (sockaddr_isequal(&old_iface->addr, &new_iface->addr)) { in set_interfaces()
985 prettyprint_addr(&old_iface->addr, debug_buff); in set_interfaces()
1004 if(sockaddr_isequal(&old_iface->addr, &new_iface->addr)) { in set_interfaces()
1013 prettyprint_addr(&new_iface->addr, debug_buff); in set_interfaces()
1081 union mysockaddr addr, source_addr; in set_servers() local
1082 memset(&addr, 0, sizeof(addr)); in set_servers()
1085 if ((addr.in.sin_addr.s_addr = inet_addr(saddr)) != (in_addr_t) -1) in set_servers()
1088 source_addr.in.sin_len = addr.in.sin_len = sizeof(source_addr.in); in set_servers()
1090 source_addr.in.sin_family = addr.in.sin_family = AF_INET; in set_servers()
1091 addr.in.sin_port = htons(NAMESERVER_PORT); in set_servers()
1096 else if (inet_pton(AF_INET6, saddr, &addr.in6.sin6_addr) > 0) in set_servers()
1099 source_addr.in6.sin6_len = addr.in6.sin6_len = sizeof(source_addr.in6); in set_servers()
1101 source_addr.in6.sin6_family = addr.in6.sin6_family = AF_INET6; in set_servers()
1102 addr.in6.sin6_port = htons(NAMESERVER_PORT); in set_servers()
1122 serv->addr = addr; in set_servers()
1186 union mysockaddr addr, source_addr; in reload_servers() local
1196 memset(&addr, 0, sizeof(addr)); in reload_servers()
1199 if ((addr.in.sin_addr.s_addr = inet_addr(token)) != (in_addr_t) -1) in reload_servers()
1202 source_addr.in.sin_len = addr.in.sin_len = sizeof(source_addr.in); in reload_servers()
1204 source_addr.in.sin_family = addr.in.sin_family = AF_INET; in reload_servers()
1205 addr.in.sin_port = htons(NAMESERVER_PORT); in reload_servers()
1210 else if (inet_pton(AF_INET6, token, &addr.in6.sin6_addr) > 0) in reload_servers()
1213 source_addr.in6.sin6_len = addr.in6.sin6_len = sizeof(source_addr.in6); in reload_servers()
1215 source_addr.in6.sin6_family = addr.in6.sin6_family = AF_INET6; in reload_servers()
1216 addr.in6.sin6_port = htons(NAMESERVER_PORT); in reload_servers()
1236 serv->addr = addr; in reload_servers()