Lines Matching defs:ifp
342 ns_interface_t *ifp;
348 ifp = isc_mem_get(mgr->mctx, sizeof(*ifp));
349 if (ifp == NULL)
352 ifp->mgr = NULL;
353 ifp->generation = mgr->generation;
354 ifp->addr = *addr;
355 ifp->flags = 0;
356 strlcpy(ifp->name, name, sizeof(ifp->name));
357 ifp->clientmgr = NULL;
359 result = isc_mutex_init(&ifp->lock);
365 &ifp->clientmgr);
374 ifp->udpdispatch[disp] = NULL;
376 ifp->tcpsocket = NULL;
384 ifp->ntcptarget = 1;
385 ifp->ntcpcurrent = 0;
386 ifp->nudpdispatch = 0;
388 ifp->dscp = -1;
390 ISC_LINK_INIT(ifp, link);
392 ns_interfacemgr_attach(mgr, &ifp->mgr);
393 ISC_LIST_APPEND(mgr->interfaces, ifp, link);
395 ifp->references = 1;
396 ifp->magic = IFACE_MAGIC;
397 *ifpret = ifp;
402 DESTROYLOCK(&ifp->lock);
405 ifp->magic = 0;
406 isc_mem_put(mgr->mctx, ifp, sizeof(*ifp));
412 ns_interface_listenudp(ns_interface_t *ifp) {
420 if (isc_sockaddr_pf(&ifp->addr) == AF_INET)
429 ifp->nudpdispatch = ISC_MIN(ns_g_udpdisp, MAX_UDP_DISPATCH);
430 for (disp = 0; disp < ifp->nudpdispatch; disp++) {
431 result = dns_dispatch_getudp_dup(ifp->mgr->dispatchmgr,
433 ns_g_taskmgr, &ifp->addr,
437 &ifp->udpdispatch[disp],
440 : ifp->udpdispatch[0]);
450 result = ns_clientmgr_createclients(ifp->clientmgr, ifp->nudpdispatch,
451 ifp, ISC_FALSE);
463 dns_dispatch_changeattributes(ifp->udpdispatch[i], 0,
465 dns_dispatch_detach(&(ifp->udpdispatch[i]));
467 ifp->nudpdispatch = 0;
474 ns_interface_accepttcp(ns_interface_t *ifp) {
480 result = isc_socket_create(ifp->mgr->socketmgr,
481 isc_sockaddr_pf(&ifp->addr),
483 &ifp->tcpsocket);
490 isc_socket_setname(ifp->tcpsocket, "dispatcher", NULL);
492 isc_socket_ipv6only(ifp->tcpsocket, ISC_TRUE);
494 result = isc_socket_bind(ifp->tcpsocket, &ifp->addr,
503 if (ifp->dscp != -1)
504 isc_socket_dscp(ifp->tcpsocket, ifp->dscp);
506 result = isc_socket_listen(ifp->tcpsocket, ns_g_listen);
518 (void)isc_socket_filter(ifp->tcpsocket, "dataready");
520 result = ns_clientmgr_createclients(ifp->clientmgr,
521 ifp->ntcptarget, ifp,
534 isc_socket_detach(&ifp->tcpsocket);
546 ns_interface_t *ifp = NULL;
550 result = ns_interface_create(mgr, addr, name, &ifp);
554 ifp->dscp = dscp;
556 result = ns_interface_listenudp(ifp);
564 result = ns_interface_accepttcp(ifp);
579 *ifpret = ifp;
583 ISC_LIST_UNLINK(ifp->mgr->interfaces, ifp, link);
584 ns_interface_detach(&ifp);
589 ns_interface_shutdown(ns_interface_t *ifp) {
590 if (ifp->clientmgr != NULL)
591 ns_clientmgr_destroy(&ifp->clientmgr);
595 ns_interface_destroy(ns_interface_t *ifp) {
596 isc_mem_t *mctx = ifp->mgr->mctx;
599 REQUIRE(NS_INTERFACE_VALID(ifp));
601 ns_interface_shutdown(ifp);
603 for (disp = 0; disp < ifp->nudpdispatch; disp++)
604 if (ifp->udpdispatch[disp] != NULL) {
605 dns_dispatch_changeattributes(ifp->udpdispatch[disp], 0,
607 dns_dispatch_detach(&(ifp->udpdispatch[disp]));
610 if (ifp->tcpsocket != NULL)
611 isc_socket_detach(&ifp->tcpsocket);
613 DESTROYLOCK(&ifp->lock);
615 ns_interfacemgr_detach(&ifp->mgr);
617 ifp->magic = 0;
618 isc_mem_put(mctx, ifp, sizeof(*ifp));
654 ns_interface_t *ifp;
655 for (ifp = ISC_LIST_HEAD(mgr->interfaces); ifp != NULL;
656 ifp = ISC_LIST_NEXT(ifp, link)) {
657 if (isc_sockaddr_equal(&ifp->addr, addr))
660 return (ifp);
668 ns_interface_t *ifp, *next;
669 for (ifp = ISC_LIST_HEAD(mgr->interfaces); ifp != NULL; ifp = next) {
670 INSIST(NS_INTERFACE_VALID(ifp));
671 next = ISC_LIST_NEXT(ifp, link);
672 if (ifp->generation != mgr->generation) {
674 ISC_LIST_UNLINK(ifp->mgr->interfaces, ifp, link);
675 isc_sockaddr_format(&ifp->addr, sabuf, sizeof(sabuf));
679 ns_interface_shutdown(ifp);
680 ns_interface_detach(&ifp);
803 ns_interface_t *ifp;
861 ifp = find_matching_interface(mgr, &listen_addr);
862 if (ifp != NULL) {
863 ifp->generation = mgr->generation;
864 if (le->dscp != -1 && ifp->dscp == -1)
865 ifp->dscp = le->dscp;
866 else if (le->dscp != ifp->dscp) {
874 sabuf, ifp->dscp);
883 "<any>", &ifp,
888 ifp->flags |= NS_INTERFACEFLAG_ANYADDR;
1049 ifp = find_matching_interface(mgr, &listen_sockaddr);
1050 if (ifp != NULL) {
1051 ifp->generation = mgr->generation;
1052 if (le->dscp != -1 && ifp->dscp == -1)
1053 ifp->dscp = le->dscp;
1054 else if (le->dscp != ifp->dscp) {
1062 sabuf, ifp->dscp);
1098 &ifp,