Lines Matching refs:intf
397 PosixNetworkInterface *intf;
402 intf = (PosixNetworkInterface*)(m->HostInterfaces);
403 while ((intf != NULL) && (strcmp(intf->intfName, intfName) != 0))
404 intf = (PosixNetworkInterface *)(intf->coreIntf.next);
406 return intf;
411 PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces);
412 while (intf && (((mDNSu32)intf->index) != index))
414 intf = (PosixNetworkInterface *)(intf->coreIntf.next);
416 return intf;
420 mDNSlocal void SocketDataReady(mDNS *const m, const PosixNetworkInterface *intf, const int skt, UDPSocket *const sock)
478 if (!intf)
485 if (packetInfo.ipi_ifname[0] != 0) reject = (strcmp(packetInfo.ipi_ifname, intf->intfName) != 0);
486 else if (packetInfo.ipi_ifindex != -1) reject = (packetInfo.ipi_ifindex != intf->index);
506 intf->intfName, intf->index, realIntf->intfName, realIntf->index);
507 intf = realIntf;
515 &intf->coreIntf.ip, intf->intfName, intf->index, skt);
530 &senderAddr, &destAddr, &intf->coreIntf.ip, intf->intfName, intf->index, skt);
538 const mDNSInterfaceID InterfaceID = intf ? intf->coreIntf.InterfaceID : NULL;
1021 PosixNetworkInterface *intf;
1029 intf = (PosixNetworkInterface*)SearchForInterfaceByIndex(m, index);
1030 return (mDNSInterfaceID) intf;
1035 PosixNetworkInterface *intf;
1044 intf = (PosixNetworkInterface*)(m->HostInterfaces);
1045 while ((intf != NULL) && (mDNSInterfaceID) intf != id)
1046 intf = (PosixNetworkInterface *)(intf->coreIntf.next);
1048 if (intf) return intf->index;
1051 intf = gRecentInterfaces;
1052 while ((intf != NULL) && (mDNSInterfaceID) intf != id)
1053 intf = (PosixNetworkInterface *)(intf->coreIntf.next);
1055 return intf ? intf->index : 0;
1060 mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf)
1063 assert(intf != NULL);
1064 if (intf->intfName != NULL) mdns_free(intf->intfName);
1065 if (intf->multicastSocket4 != -1)
1067 rv = close(intf->multicastSocket4);
1071 if (intf->multicastSocket6 != -1)
1073 rv = close(intf->multicastSocket6);
1079 intf->LastSeen = mDNSPlatformUTC();
1080 intf->coreIntf.next = &gRecentInterfaces->coreIntf;
1081 gRecentInterfaces = intf;
1091 PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces);
1092 mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation);
1093 if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName);
1094 FreePosixNetworkInterface(intf);
1375 PosixNetworkInterface *intf;
1385 intf = (PosixNetworkInterface*)mdns_calloc(1, sizeof(*intf));
1386 if (intf == NULL) { assert(0); err = ENOMEM; }
1403 intf->intfName = malloc(len);
1404 if (intf->intfName == NULL) { assert(0); err = ENOMEM; }
1405 memcpy(intf->intfName, intfName, len - 1);
1408 intf->intfName = mdns_strdup(intfName);
1409 if (intf->intfName == NULL) { assert(0); err = ENOMEM; }
1416 SockAddrTomDNSAddr(intfAddr, &intf->coreIntf.ip, NULL);
1417 SockAddrTomDNSAddr(intfMask, &intf->coreIntf.mask, NULL);
1418 if (intfHlen == sizeof(intf->coreIntf.MAC.b))
1420 mDNSPlatformMemCopy(intf->coreIntf.MAC.b, intfHaddr, sizeof(intf->coreIntf.MAC.b));
1426 mDNSPlatformMemCopy(&m->PrimaryMAC, &intf->coreIntf.MAC, sizeof(m->PrimaryMAC));
1429 //LogMsg("SetupOneInterface: %#a %#a", &intf->coreIntf.ip, &intf->coreIntf.mask);
1430 mDNSPlatformStrLCopy(intf->coreIntf.ifname, intfName, sizeof(intf->coreIntf.ifname));
1431 intf->coreIntf.ifname[sizeof(intf->coreIntf.ifname)-1] = 0;
1433 intf->coreIntf.Advertise = m->AdvertiseLocalAddresses;
1434 intf->coreIntf.McastTxRx = mDNStrue;
1437 assert(intf->intfName != NULL); // intf->intfName already set up above
1438 intf->index = intfIndex;
1439 intf->multicastSocket4 = -1;
1441 intf->multicastSocket6 = -1;
1443 alias = SearchForInterfaceByName(m, intf->intfName);
1444 if (alias == NULL) alias = intf;
1445 intf->coreIntf.InterfaceID = (mDNSInterfaceID)alias;
1447 if (alias != intf)
1448 debugf("SetupOneInterface: %s %#a is an alias of %#a", intfName, &intf->coreIntf.ip, &alias->coreIntf.ip);
1455 err = SetupSocket(intfAddr, MulticastDNSPort, intf->index, &alias->multicastSocket4);
1458 err = SetupSocket(intfAddr, MulticastDNSPort, intf->index, &alias->multicastSocket6);
1464 intf->coreIntf.DirectLink = mDNSfalse;
1467 intf->coreIntf.DirectLink = mDNStrue;
1469 intf->coreIntf.SupportsUnicastMDNSResponse = mDNStrue;
1473 err = mDNS_RegisterInterface(m, &intf->coreIntf, NormalActivation);
1479 debugf("SetupOneInterface: %s %#a Registered", intf->intfName, &intf->coreIntf.ip);
1481 fprintf(stderr, "Registered interface %s\n", intf->intfName);
1485 // Use intfName instead of intf->intfName in the next line to avoid dereferencing NULL.
1486 debugf("SetupOneInterface: %s %#a failed to register %d", intfName, &intf->coreIntf.ip, err);
1487 if (intf) { FreePosixNetworkInterface(intf); intf = NULL; }
1490 assert((err == 0) == (intf != NULL));
2151 mDNSexport mDNSBool mDNSPlatformValidQuestionForInterface(const DNSQuestion *const q, const NetworkInterfaceInfo *const intf)
2154 (void) intf;