Lines Matching refs:tcpfd
239 int tcpfd, fd; in create_ipv6_listener() local
252 if ((tcpfd = socket(AF_INET6, SOCK_STREAM, 0)) == -1) return 0; in create_ipv6_listener()
255 setsockopt(tcpfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1 || in create_ipv6_listener()
257 setsockopt(tcpfd, IPV6_LEVEL, IPV6_V6ONLY, &opt, sizeof(opt)) == -1 || !fix_fd(fd) || in create_ipv6_listener()
258 !fix_fd(tcpfd) || in create_ipv6_listener()
264 bind(tcpfd, (struct sockaddr*) &addr, sa_len(&addr)) == -1 || listen(tcpfd, 5) == -1 || in create_ipv6_listener()
270 l->tcpfd = tcpfd; in create_ipv6_listener()
284 int tcpfd = -1, fd = -1; in create_wildcard_listeners() local
293 (tcpfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) in create_wildcard_listeners()
296 if (setsockopt(tcpfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1 || in create_wildcard_listeners()
297 bind(tcpfd, (struct sockaddr*) &addr, sa_len(&addr)) == -1 || listen(tcpfd, 5) == -1 || in create_wildcard_listeners()
298 !fix_fd(tcpfd) || in create_wildcard_listeners()
315 setsockopt(tcpfd, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) == -1 || in create_wildcard_listeners()
317 setsockopt(l6->tcpfd, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) == -1)) { in create_wildcard_listeners()
320 close(tcpfd); in create_wildcard_listeners()
322 close(l6->tcpfd); in create_wildcard_listeners()
331 l->tcpfd = tcpfd; in create_wildcard_listeners()
361 new->tcpfd = -1; in create_bound_listener()
366 if ((new->tcpfd = socket(iface->addr.sa.sa_family, SOCK_STREAM, 0)) == -1 || in create_bound_listener()
369 setsockopt(new->tcpfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1 || in create_bound_listener()
370 !fix_fd(new->tcpfd) || !fix_fd(new->fd)) in create_bound_listener()
376 setsockopt(new->tcpfd, IPV6_LEVEL, IPV6_V6ONLY, &opt, sizeof(opt)) == -1) in create_bound_listener()
400 if (rc == -1 || bind(new->tcpfd, &iface->addr.sa, sa_len(&iface->addr)) == -1) { in create_bound_listener()
407 setsockopt(new->tcpfd, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) == -1)) in create_bound_listener()
410 if (listen(new->tcpfd, 5) == -1) die(_("failed to listen on socket: %s"), NULL, EC_BADNET); in create_bound_listener()
454 if (listener->tcpfd != -1) { in delete_listener()
455 close(listener->tcpfd); in delete_listener()
456 listener->tcpfd = -1; in delete_listener()
518 new->tcpfd = -1; in create_bound_listeners()
523 if ((new->tcpfd = socket(iface->addr.sa.sa_family, SOCK_STREAM, 0)) == -1 || in create_bound_listeners()
526 setsockopt(new->tcpfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1 || in create_bound_listeners()
527 !fix_fd(new->tcpfd) || !fix_fd(new->fd)) in create_bound_listeners()
533 setsockopt(new->tcpfd, IPV6_LEVEL, IPV6_V6ONLY, &opt, sizeof(opt)) == -1) in create_bound_listeners()
555 if (rc == -1 || bind(new->tcpfd, &iface->addr.sa, sa_len(&iface->addr)) == -1) { in create_bound_listeners()
561 if (listen(new->tcpfd, 5) == -1) in create_bound_listeners()