Overview
Comment: | +[OFSystemInfo networkInterface]: Fix some BSDs |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d4ea9e536c22135ce79743218d2742bf |
User & Date: | js on 2023-06-08 21:03:12 |
Other Links: | manifest | tags |
Context
2023-06-08
| ||
21:17 | +[OFSystemInfo networkInterfaces]: Add IPX check-in: ce6b0f02cf user: js tags: trunk | |
21:03 | +[OFSystemInfo networkInterface]: Fix some BSDs check-in: d4ea9e536c user: js tags: trunk | |
2023-06-06
| ||
23:42 | +[OFSystemInfo networkInterfaces]: Windows support check-in: ca4632c14c user: js tags: trunk | |
Changes
Modified src/OFSystemInfo.m from [fabe0e6c7e] to [7301636c5f].
︙ | ︙ | |||
923 924 925 926 927 928 929 930 931 932 933 934 935 | ifrs = malloc(128 * sizeof(struct ifreq)); if (ifrs == NULL) { closesocket(sock); return false; } @try { memset(&ifc, 0, sizeof(ifc)); ifc.ifc_buf = (void *)ifrs; ifc.ifc_len = 128 * sizeof(struct ifreq); if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) return false; | > > | | > | | | | > > > > > > > | 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 | ifrs = malloc(128 * sizeof(struct ifreq)); if (ifrs == NULL) { closesocket(sock); return false; } @try { char *buffer; memset(&ifc, 0, sizeof(ifc)); ifc.ifc_buf = (void *)ifrs; ifc.ifc_len = 128 * sizeof(struct ifreq); if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) return false; buffer = ifc.ifc_buf; while (buffer < ifc.ifc_buf + ifc.ifc_len) { struct ifreq *current = (struct ifreq *)(void *)buffer; OFString *name; OFMutableData *addresses; OFSocketAddress address; if (current->ifr_addr.sa_family != family) goto next; name = [OFString stringWithCString: current->ifr_name encoding: encoding]; if ((interface = [ret objectForKey: name]) == nil) { interface = [OFMutableDictionary dictionary]; [ret setObject: interface forKey: name]; } addresses = [interface objectForKey: key]; if (addresses == nil) { addresses = [OFMutableData dataWithItemSize: sizeof(OFSocketAddress)]; [interface setObject: addresses forKey: key]; } memset(&address, 0, sizeof(address)); address.family = addressFamily; memcpy(&address.sockaddr.in, ¤t->ifr_addr, sockaddrSize); [addresses addItem: &address]; next: # ifdef _SIZEOF_ADDR_IFREQ buffer += _SIZEOF_ADDR_IFREQ(*current); # else buffer += sizeof(struct ifreq); # endif } } @finally { free(ifrs); closesocket(sock); } enumerator = [ret objectEnumerator]; |
︙ | ︙ |