Home | History | Annotate | Download | only in src

Lines Matching defs:new

400       struct listener *new = safe_malloc(sizeof(struct listener));
401 new->family = iface->addr.sa.sa_family;
402 new->iface = iface;
403 new->next = listeners;
404 new->tftpfd = -1;
405 new->tcpfd = -1;
406 new->fd = -1;
407 listeners = new;
411 if ((new->tcpfd = socket(iface->addr.sa.sa_family, SOCK_STREAM, 0)) == -1 ||
412 (new->fd = socket(iface->addr.sa.sa_family, SOCK_DGRAM, 0)) == -1 ||
413 setsockopt(new->fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1 ||
414 setsockopt(new->tcpfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1 ||
415 !fix_fd(new->tcpfd) ||
416 !fix_fd(new->fd))
422 if (setsockopt(new->fd, IPV6_LEVEL, IPV6_V6ONLY, &opt, sizeof(opt)) == -1 ||
423 setsockopt(new->tcpfd, IPV6_LEVEL, IPV6_V6ONLY, &opt, sizeof(opt)) == -1)
430 if ((rc = bind(new->fd, &iface->addr.sa, sa_len(&iface->addr))) != -1)
447 if (rc == -1 || bind(new->tcpfd, &iface->addr.sa, sa_len(&iface->addr)) == -1)
454 if (listen(new->tcpfd, 5) == -1)
463 if ((new->tftpfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1 ||
464 setsockopt(new->tftpfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1 ||
465 !fix_fd(new->tftpfd) ||
466 bind(new->tftpfd, &iface->addr.sa, sa_len(&iface->addr)) == -1)
593 /* need to make a new one. */
670 struct server *new, *tmp, *ret = NULL;
673 for (new = daemon->servers; new; new = tmp)
675 tmp = new->next;
677 if (!(new->flags & (SERV_LITERAL_ADDRESS | SERV_NO_ADDR)))
679 port = prettyprint_addr(&new->addr, daemon->namebuff);
682 if (new->addr.sa.sa_family == AF_INET &&
683 new->addr.in.sin_addr.s_addr == 0)
685 free(new);
690 if (sockaddr_isequal(&new->addr, &iface->addr))
695 free(new);
700 if (!new->sfd &&
701 !(new->sfd = allocate_sfd(&new->source_addr, new->interface)) &&
707 free(new);
713 new->next = ret;
714 ret = new;
716 if (new->flags & (SERV_HAS_DOMAIN | SERV_FOR_NODOTS))
719 if (!(new->flags & SERV_HAS_DOMAIN))
721 else if (strlen(new->domain) == 0)
724 s1 = _("domain"), s2 = new->domain;
726 if (new->flags & SERV_NO_ADDR)
728 else if (!(new->flags & SERV_LITERAL_ADDRESS))
731 else if (new->interface[0] != 0)
732 my_syslog(LOG_INFO, _("using nameserver %s#%d(via %s)"), daemon->namebuff, port, new->interface);
754 and not risk malloc if there are the same or fewer new servers.
755 Servers which were specced on the command line go to the new list. */
860 and not risk malloc if there are the same or fewer new servers.
861 Servers which were specced on the command line go to the new list. */