1/* 2 * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 7 unchanged lines hidden (view full) --- 16 * written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 * Internet, ethernet, port, and protocol string to address 22 * and address to string conversion routines 23 * |
24 * $FreeBSD: head/contrib/tcpdump/addrtoname.c 127675 2004-03-31 14:57:24Z bms $ |
25 */ 26#ifndef lint |
27static const char rcsid[] _U_ = 28 "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.96.2.6 2004/03/24 04:14:31 guy Exp $ (LBL)"; |
29#endif 30 31#ifdef HAVE_CONFIG_H 32#include "config.h" 33#endif 34 |
35#include <tcpdump-stdinc.h> |
36 |
37#ifdef USE_ETHER_NTOHOST 38#ifdef HAVE_NETINET_IF_ETHER_H 39struct mbuf; /* Squelch compiler warnings on some platforms for */ 40struct rtentry; /* declarations in <net/if.h> */ 41#include <net/if.h> /* for "struct ifnet" in "struct arpcom" on Solaris */ 42#include <netinet/if_ether.h> 43#endif /* HAVE_NETINET_IF_ETHER_H */ |
44#ifdef HAVE_NETINET_ETHER_H 45#include <netinet/ether.h> /* ether_ntohost on linux */ 46#endif /* HAVE_NETINET_ETHER_H */ |
47#endif /* USE_ETHER_NTOHOST */ 48 |
49#include <pcap.h> 50#include <pcap-namedb.h> 51#include <signal.h> 52#include <stdio.h> 53#include <string.h> 54#include <stdlib.h> |
55 56#include "interface.h" 57#include "addrtoname.h" 58#include "llc.h" 59#include "setsignal.h" 60 |
61/* 62 * hash tables for whatever-to-name translations |
63 * 64 * XXX there has to be error checks against strdup(3) failure |
65 */ 66 67#define HASHNAMESIZE 4096 68 69struct hnamemem { 70 u_int32_t addr; 71 const char *name; 72 struct hnamemem *nxt; 73}; 74 75struct hnamemem hnametable[HASHNAMESIZE]; 76struct hnamemem tporttable[HASHNAMESIZE]; 77struct hnamemem uporttable[HASHNAMESIZE]; 78struct hnamemem eprototable[HASHNAMESIZE]; 79struct hnamemem dnaddrtable[HASHNAMESIZE]; 80struct hnamemem llcsaptable[HASHNAMESIZE]; |
81struct hnamemem ipxsaptable[HASHNAMESIZE]; |
82 |
83#if defined(INET6) && defined(WIN32) 84/* 85 * fake gethostbyaddr for Win2k/XP 86 * gethostbyaddr() returns incorrect value when AF_INET6 is passed 87 * to 3rd argument. 88 * 89 * h_name in struct hostent is only valid. 90 */ 91static struct hostent * 92win32_gethostbyaddr(const char *addr, int len, int type) 93{ 94 static struct hostent host; 95 static char hostbuf[NI_MAXHOST]; 96 char hname[NI_MAXHOST]; 97 struct sockaddr_in6 addr6; 98 99 host.h_name = hostbuf; 100 switch (type) { 101 case AF_INET: 102 return gethostbyaddr(addr, len, type); 103 break; 104 case AF_INET6: 105 memset(&addr6, 0, sizeof(addr6)); 106 addr6.sin6_family = AF_INET6; 107 memcpy(&addr6.sin6_addr, addr, len); 108#ifdef __MINGW32__ 109 /* MinGW doesn't provide getnameinfo */ 110 return NULL; 111#else 112 if (getnameinfo((struct sockaddr *)&addr6, sizeof(addr6), 113 hname, sizeof(hname), NULL, 0, 0)) { 114 return NULL; 115 } else { 116 strcpy(host.h_name, hname); 117 return &host; 118 } 119#endif /* __MINGW32__ */ 120 break; 121 default: 122 return NULL; 123 } 124} 125#define gethostbyaddr win32_gethostbyaddr 126#endif /* INET6 & WIN32*/ 127 |
128#ifdef INET6 129struct h6namemem { 130 struct in6_addr addr; 131 char *name; 132 struct h6namemem *nxt; 133}; 134 135struct h6namemem h6nametable[HASHNAMESIZE]; --- 52 unchanged lines hidden (view full) --- 188 addr >>= 8; 189 } while (--n > 0); 190 191 return cp + 1; 192} 193 194static u_int32_t f_netmask; 195static u_int32_t f_localnet; |
196 197/* |
198 * Return a name for the IP address pointed to by ap. This address 199 * is assumed to be in network byte order. |
200 * 201 * NOTE: ap is *NOT* necessarily part of the packet data (not even if 202 * this is being called with the "ipaddr_string()" macro), so you 203 * *CANNOT* use the TCHECK{2}/TTEST{2} macros on it. Furthermore, 204 * even in cases where it *is* part of the packet data, the caller 205 * would still have to check for a null return value, even if it's 206 * just printing the return value with "%s" - not all versions of 207 * printf print "(null)" with "%s" and a null pointer, some of them 208 * don't check for a null pointer and crash in that case. 209 * 210 * The callers of this routine should, before handing this routine 211 * a pointer to packet data, be sure that the data is present in 212 * the packet buffer. They should probably do those checks anyway, 213 * as other data at that layer might not be IP addresses, and it 214 * also needs to check whether they're present in the packet buffer. |
215 */ 216const char * 217getname(const u_char *ap) 218{ 219 register struct hostent *hp; 220 u_int32_t addr; 221 static struct hnamemem *p; /* static for longjmp() */ 222 223 memcpy(&addr, ap, sizeof(addr)); 224 p = &hnametable[addr & (HASHNAMESIZE-1)]; 225 for (; p->nxt; p = p->nxt) { 226 if (p->addr == addr) 227 return (p->name); 228 } 229 p->addr = addr; 230 p->nxt = newhnamemem(); 231 232 /* |
233 * Print names unless: 234 * (1) -n was given. |
235 * (2) Address is foreign and -f was given. (If -f was not |
236 * given, f_netmask and f_localnet are 0 and the test |
237 * evaluates to true) |
238 */ 239 if (!nflag && |
240 (addr & f_netmask) == f_localnet) { 241 hp = gethostbyaddr((char *)&addr, 4, AF_INET); 242 if (hp) { 243 char *dotp; |
244 |
245 p->name = strdup(hp->h_name); 246 if (Nflag) { 247 /* Remove domain qualifications */ 248 dotp = strchr(p->name, '.'); 249 if (dotp) 250 *dotp = '\0'; |
251 } |
252 return (p->name); |
253 } 254 } 255 p->name = strdup(intoa(addr)); 256 return (p->name); 257} 258 259#ifdef INET6 260/* --- 14 unchanged lines hidden (view full) --- 275 for (; p->nxt; p = p->nxt) { 276 if (memcmp(&p->addr, &addr, sizeof(addr)) == 0) 277 return (p->name); 278 } 279 p->addr = addr; 280 p->nxt = newh6namemem(); 281 282 /* |
283 * Do not print names if -n was given. |
284 */ |
285 if (!nflag) { 286 hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET6); 287 if (hp) { 288 char *dotp; |
289 |
290 p->name = strdup(hp->h_name); 291 if (Nflag) { 292 /* Remove domain qualifications */ 293 dotp = strchr(p->name, '.'); 294 if (dotp) 295 *dotp = '\0'; |
296 } |
297 return (p->name); |
298 } 299 } 300 cp = inet_ntop(AF_INET6, &addr, ntop_buf, sizeof(ntop_buf)); 301 p->name = strdup(cp); 302 return (p->name); 303} 304#endif /* INET6 */ 305 --- 26 unchanged lines hidden (view full) --- 332 tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp)); 333 if (tp->e_nxt == NULL) 334 error("lookup_emem: calloc"); 335 336 return tp; 337} 338 339/* |
340 * Find the hash node that corresponds to the bytestring 'bs' |
341 * with length 'nlen' 342 */ 343 344static inline struct enamemem * 345lookup_bytestring(register const u_char *bs, const unsigned int nlen) 346{ 347 struct enamemem *tp; 348 register u_int i, j, k; --- 101 unchanged lines hidden (view full) --- 450 error("lookup_protoid: calloc"); 451 452 return tp; 453} 454 455const char * 456etheraddr_string(register const u_char *ep) 457{ |
458 register u_int i; |
459 register char *cp; 460 register struct enamemem *tp; 461 char buf[sizeof("00:00:00:00:00:00")]; 462 463 tp = lookup_emem(ep); 464 if (tp->e_name) 465 return (tp->e_name); 466#ifdef USE_ETHER_NTOHOST 467 if (!nflag) { |
468 char buf2[128]; 469 if (ether_ntohost(buf2, (const struct ether_addr *)ep) == 0) { 470 tp->e_name = strdup(buf2); |
471 return (tp->e_name); 472 } 473 } 474#endif 475 cp = buf; |
476 *cp++ = hex[*ep >> 4 ]; |
477 *cp++ = hex[*ep++ & 0xf]; 478 for (i = 5; (int)--i >= 0;) { 479 *cp++ = ':'; |
480 *cp++ = hex[*ep >> 4 ]; |
481 *cp++ = hex[*ep++ & 0xf]; 482 } 483 *cp = '\0'; 484 tp->e_name = strdup(buf); 485 return (tp->e_name); 486} 487 488const char * 489linkaddr_string(const u_char *ep, const unsigned int len) 490{ 491 register u_int i, j; 492 register char *cp; 493 register struct enamemem *tp; 494 495 if (len == 6) /* XXX not totally correct... */ 496 return etheraddr_string(ep); |
497 |
498 tp = lookup_bytestring(ep, len); 499 if (tp->e_name) 500 return (tp->e_name); 501 502 tp->e_name = cp = (char *)malloc(len*3); 503 if (tp->e_name == NULL) 504 error("linkaddr_string: malloc"); 505 if ((j = *ep >> 4) != 0) --- 140 unchanged lines hidden (view full) --- 646 tp->addr = i; 647 tp->nxt = newhnamemem(); 648 649 (void)snprintf(buf, sizeof(buf), "%u", i); 650 tp->name = strdup(buf); 651 return (tp->name); 652} 653 |
654const char * 655ipxsap_string(u_short port) 656{ 657 register char *cp; 658 register struct hnamemem *tp; 659 register u_int32_t i = port; 660 char buf[sizeof("0000")]; 661 662 for (tp = &ipxsaptable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt) 663 if (tp->addr == i) 664 return (tp->name); 665 666 tp->addr = i; 667 tp->nxt = newhnamemem(); 668 669 cp = buf; 670 NTOHS(port); 671 *cp++ = hex[port >> 12 & 0xf]; 672 *cp++ = hex[port >> 8 & 0xf]; 673 *cp++ = hex[port >> 4 & 0xf]; 674 *cp++ = hex[port & 0xf]; 675 *cp++ = '\0'; 676 tp->name = strdup(buf); 677 return (tp->name); 678} 679 |
680static void 681init_servarray(void) 682{ 683 struct servent *sv; 684 register struct hnamemem *table; 685 register int i; 686 char buf[sizeof("0000000000")]; 687 --- 16 unchanged lines hidden (view full) --- 704 table->name = strdup(sv->s_name); 705 table->addr = port; 706 table->nxt = newhnamemem(); 707 } 708 endservent(); 709} 710 711/*XXX from libbpfc.a */ |
712#ifndef WIN32 |
713extern struct eproto { |
714#else 715__declspec( dllimport) struct eproto { 716#endif |
717 char *s; 718 u_short p; 719} eproto_db[]; 720 721static void 722init_eprotoarray(void) 723{ 724 register int i; 725 register struct hnamemem *table; 726 727 for (i = 0; eproto_db[i].s; i++) { |
728 int j = htons(eproto_db[i].p) & (HASHNAMESIZE-1); |
729 table = &eprototable[j]; 730 while (table->name) 731 table = table->nxt; 732 table->name = eproto_db[i].s; |
733 table->addr = htons(eproto_db[i].p); |
734 table->nxt = newhnamemem(); 735 } 736} 737 738static struct protoidlist { 739 const u_char protoid[5]; 740 const char *name; 741} protoidlist[] = { --- 129 unchanged lines hidden (view full) --- 871 while (table->name) 872 table = table->nxt; 873 table->name = llcsap_db[i].s; 874 table->addr = llcsap_db[i].v; 875 table->nxt = newhnamemem(); 876 } 877} 878 |
879static struct tok ipxsap_db[] = { 880 { 0x0000, "Unknown" }, 881 { 0x0001, "User" }, 882 { 0x0002, "User Group" }, 883 { 0x0003, "PrintQueue" }, 884 { 0x0004, "FileServer" }, 885 { 0x0005, "JobServer" }, 886 { 0x0006, "Gateway" }, 887 { 0x0007, "PrintServer" }, 888 { 0x0008, "ArchiveQueue" }, 889 { 0x0009, "ArchiveServer" }, 890 { 0x000a, "JobQueue" }, 891 { 0x000b, "Administration" }, 892 { 0x000F, "Novell TI-RPC" }, 893 { 0x0017, "Diagnostics" }, 894 { 0x0020, "NetBIOS" }, 895 { 0x0021, "NAS SNA Gateway" }, 896 { 0x0023, "NACS AsyncGateway" }, 897 { 0x0024, "RemoteBridge/RoutingService" }, 898 { 0x0026, "BridgeServer" }, 899 { 0x0027, "TCP/IP Gateway" }, 900 { 0x0028, "Point-to-point X.25 BridgeServer" }, 901 { 0x0029, "3270 Gateway" }, 902 { 0x002a, "CHI Corp" }, 903 { 0x002c, "PC Chalkboard" }, 904 { 0x002d, "TimeSynchServer" }, 905 { 0x002e, "ARCserve5.0/PalindromeBackup" }, 906 { 0x0045, "DI3270 Gateway" }, 907 { 0x0047, "AdvertisingPrintServer" }, 908 { 0x004a, "NetBlazerModems" }, 909 { 0x004b, "BtrieveVAP" }, 910 { 0x004c, "NetwareSQL" }, 911 { 0x004d, "XtreeNetwork" }, 912 { 0x0050, "BtrieveVAP4.11" }, 913 { 0x0052, "QuickLink" }, 914 { 0x0053, "PrintQueueUser" }, 915 { 0x0058, "Multipoint X.25 Router" }, 916 { 0x0060, "STLB/NLM" }, 917 { 0x0064, "ARCserve" }, 918 { 0x0066, "ARCserve3.0" }, 919 { 0x0072, "WAN CopyUtility" }, 920 { 0x007a, "TES-NetwareVMS" }, 921 { 0x0092, "WATCOM Debugger/EmeraldTapeBackupServer" }, 922 { 0x0095, "DDA OBGYN" }, 923 { 0x0098, "NetwareAccessServer" }, 924 { 0x009a, "Netware for VMS II/NamedPipeServer" }, 925 { 0x009b, "NetwareAccessServer" }, 926 { 0x009e, "PortableNetwareServer/SunLinkNVT" }, 927 { 0x00a1, "PowerchuteAPC UPS" }, 928 { 0x00aa, "LAWserve" }, 929 { 0x00ac, "CompaqIDA StatusMonitor" }, 930 { 0x0100, "PIPE STAIL" }, 931 { 0x0102, "LAN ProtectBindery" }, 932 { 0x0103, "OracleDataBaseServer" }, 933 { 0x0107, "Netware386/RSPX RemoteConsole" }, 934 { 0x010f, "NovellSNA Gateway" }, 935 { 0x0111, "TestServer" }, 936 { 0x0112, "HP PrintServer" }, 937 { 0x0114, "CSA MUX" }, 938 { 0x0115, "CSA LCA" }, 939 { 0x0116, "CSA CM" }, 940 { 0x0117, "CSA SMA" }, 941 { 0x0118, "CSA DBA" }, 942 { 0x0119, "CSA NMA" }, 943 { 0x011a, "CSA SSA" }, 944 { 0x011b, "CSA STATUS" }, 945 { 0x011e, "CSA APPC" }, 946 { 0x0126, "SNA TEST SSA Profile" }, 947 { 0x012a, "CSA TRACE" }, 948 { 0x012b, "NetwareSAA" }, 949 { 0x012e, "IKARUS VirusScan" }, 950 { 0x0130, "CommunicationsExecutive" }, 951 { 0x0133, "NNS DomainServer/NetwareNamingServicesDomain" }, 952 { 0x0135, "NetwareNamingServicesProfile" }, 953 { 0x0137, "Netware386 PrintQueue/NNS PrintQueue" }, 954 { 0x0141, "LAN SpoolServer" }, 955 { 0x0152, "IRMALAN Gateway" }, 956 { 0x0154, "NamedPipeServer" }, 957 { 0x0166, "NetWareManagement" }, 958 { 0x0168, "Intel PICKIT CommServer/Intel CAS TalkServer" }, 959 { 0x0173, "Compaq" }, 960 { 0x0174, "Compaq SNMP Agent" }, 961 { 0x0175, "Compaq" }, 962 { 0x0180, "XTreeServer/XTreeTools" }, 963 { 0x018A, "NASI ServicesBroadcastServer" }, 964 { 0x01b0, "GARP Gateway" }, 965 { 0x01b1, "Binfview" }, 966 { 0x01bf, "IntelLanDeskManager" }, 967 { 0x01ca, "AXTEC" }, 968 { 0x01cb, "ShivaNetModem/E" }, 969 { 0x01cc, "ShivaLanRover/E" }, 970 { 0x01cd, "ShivaLanRover/T" }, 971 { 0x01ce, "ShivaUniversal" }, 972 { 0x01d8, "CastelleFAXPressServer" }, 973 { 0x01da, "CastelleLANPressPrintServer" }, 974 { 0x01dc, "CastelleFAX/Xerox7033 FaxServer/ExcelLanFax" }, 975 { 0x01f0, "LEGATO" }, 976 { 0x01f5, "LEGATO" }, 977 { 0x0233, "NMS Agent/NetwareManagementAgent" }, 978 { 0x0237, "NMS IPX Discovery/LANternReadWriteChannel" }, 979 { 0x0238, "NMS IP Discovery/LANternTrapAlarmChannel" }, 980 { 0x023a, "LANtern" }, 981 { 0x023c, "MAVERICK" }, 982 { 0x023f, "NovellSMDR" }, 983 { 0x024e, "NetwareConnect" }, 984 { 0x024f, "NASI ServerBroadcast Cisco" }, 985 { 0x026a, "NMS ServiceConsole" }, 986 { 0x026b, "TimeSynchronizationServer Netware 4.x" }, 987 { 0x0278, "DirectoryServer Netware 4.x" }, 988 { 0x027b, "NetwareManagementAgent" }, 989 { 0x0280, "Novell File and Printer Sharing Service for PC" }, 990 { 0x0304, "NovellSAA Gateway" }, 991 { 0x0308, "COM/VERMED" }, 992 { 0x030a, "GalacticommWorldgroupServer" }, 993 { 0x030c, "IntelNetport2/HP JetDirect/HP Quicksilver" }, 994 { 0x0320, "AttachmateGateway" }, 995 { 0x0327, "MicrosoftDiagnostiocs" }, 996 { 0x0328, "WATCOM SQL Server" }, 997 { 0x0335, "MultiTechSystems MultisynchCommServer" }, 998 { 0x0343, "Xylogics RemoteAccessServer/LANModem" }, 999 { 0x0355, "ArcadaBackupExec" }, 1000 { 0x0358, "MSLCD1" }, 1001 { 0x0361, "NETINELO" }, 1002 { 0x037e, "Powerchute UPS Monitoring" }, 1003 { 0x037f, "ViruSafeNotify" }, 1004 { 0x0386, "HP Bridge" }, 1005 { 0x0387, "HP Hub" }, 1006 { 0x0394, "NetWare SAA Gateway" }, 1007 { 0x039b, "LotusNotes" }, 1008 { 0x03b7, "CertusAntiVirus" }, 1009 { 0x03c4, "ARCserve4.0" }, 1010 { 0x03c7, "LANspool3.5" }, 1011 { 0x03d7, "LexmarkPrinterServer" }, 1012 { 0x03d8, "LexmarkXLE PrinterServer" }, 1013 { 0x03dd, "BanyanENS NetwareClient" }, 1014 { 0x03de, "GuptaSequelBaseServer/NetWareSQL" }, 1015 { 0x03e1, "UnivelUnixware" }, 1016 { 0x03e4, "UnivelUnixware" }, 1017 { 0x03fc, "IntelNetport" }, 1018 { 0x03fd, "PrintServerQueue" }, 1019 { 0x040A, "ipnServer" }, 1020 { 0x040D, "LVERRMAN" }, 1021 { 0x040E, "LVLIC" }, 1022 { 0x0414, "NET Silicon (DPI)/Kyocera" }, 1023 { 0x0429, "SiteLockVirus" }, 1024 { 0x0432, "UFHELPR???" }, 1025 { 0x0433, "Synoptics281xAdvancedSNMPAgent" }, 1026 { 0x0444, "MicrosoftNT SNA Server" }, 1027 { 0x0448, "Oracle" }, 1028 { 0x044c, "ARCserve5.01" }, 1029 { 0x0457, "CanonGP55" }, 1030 { 0x045a, "QMS Printers" }, 1031 { 0x045b, "DellSCSI Array" }, 1032 { 0x0491, "NetBlazerModems" }, 1033 { 0x04ac, "OnTimeScheduler" }, 1034 { 0x04b0, "CD-Net" }, 1035 { 0x0513, "EmulexNQA" }, 1036 { 0x0520, "SiteLockChecks" }, 1037 { 0x0529, "SiteLockChecks" }, 1038 { 0x052d, "CitrixOS2 AppServer" }, 1039 { 0x0535, "Tektronix" }, 1040 { 0x0536, "Milan" }, 1041 { 0x055d, "Attachmate SNA gateway" }, 1042 { 0x056b, "IBM8235 ModemServer" }, 1043 { 0x056c, "ShivaLanRover/E PLUS" }, 1044 { 0x056d, "ShivaLanRover/T PLUS" }, 1045 { 0x0580, "McAfeeNetShield" }, 1046 { 0x05B8, "NLM to workstation communication (Revelation Software)" }, 1047 { 0x05BA, "CompatibleSystemsRouters" }, 1048 { 0x05BE, "CheyenneHierarchicalStorageManager" }, 1049 { 0x0606, "JCWatermarkImaging" }, 1050 { 0x060c, "AXISNetworkPrinter" }, 1051 { 0x0610, "AdaptecSCSIManagement" }, 1052 { 0x0621, "IBM AntiVirus" }, 1053 { 0x0640, "Windows95 RemoteRegistryService" }, 1054 { 0x064e, "MicrosoftIIS" }, 1055 { 0x067b, "Microsoft Win95/98 File and Print Sharing for NetWare" }, 1056 { 0x067c, "Microsoft Win95/98 File and Print Sharing for NetWare" }, 1057 { 0x076C, "Xerox" }, 1058 { 0x079b, "ShivaLanRover/E 115" }, 1059 { 0x079c, "ShivaLanRover/T 115" }, 1060 { 0x07B4, "CubixWorldDesk" }, 1061 { 0x07c2, "Quarterdeck IWare Connect V2.x NLM" }, 1062 { 0x07c1, "Quarterdeck IWare Connect V3.x NLM" }, 1063 { 0x0810, "ELAN License Server Demo" }, 1064 { 0x0824, "ShivaLanRoverAccessSwitch/E" }, 1065 { 0x086a, "ISSC Collector" }, 1066 { 0x087f, "ISSC DAS AgentAIX" }, 1067 { 0x0880, "Intel Netport PRO" }, 1068 { 0x0881, "Intel Netport PRO" }, 1069 { 0x0b29, "SiteLock" }, 1070 { 0x0c29, "SiteLockApplications" }, 1071 { 0x0c2c, "LicensingServer" }, 1072 { 0x2101, "PerformanceTechnologyInstantInternet" }, 1073 { 0x2380, "LAI SiteLock" }, 1074 { 0x238c, "MeetingMaker" }, 1075 { 0x4808, "SiteLockServer/SiteLockMetering" }, 1076 { 0x5555, "SiteLockUser" }, 1077 { 0x6312, "Tapeware" }, 1078 { 0x6f00, "RabbitGateway" }, 1079 { 0x7703, "MODEM" }, 1080 { 0x8002, "NetPortPrinters" }, 1081 { 0x8008, "WordPerfectNetworkVersion" }, 1082 { 0x85BE, "Cisco EIGRP" }, 1083 { 0x8888, "WordPerfectNetworkVersion/QuickNetworkManagement" }, 1084 { 0x9000, "McAfeeNetShield" }, 1085 { 0x9604, "CSA-NT_MON" }, 1086 { 0xb6a8, "OceanIsleReachoutRemoteControl" }, 1087 { 0xf11f, "SiteLockMetering" }, 1088 { 0xf1ff, "SiteLock" }, 1089 { 0xf503, "Microsoft SQL Server" }, 1090 { 0xF905, "IBM TimeAndPlace" }, 1091 { 0xfbfb, "TopCallIII FaxServer" }, 1092 { 0xffff, "AnyService/Wildcard" }, 1093 { 0, (char *)0 } 1094}; 1095 1096static void 1097init_ipxsaparray(void) 1098{ 1099 register int i; 1100 register struct hnamemem *table; 1101 1102 for (i = 0; ipxsap_db[i].s != NULL; i++) { 1103 int j = htons(ipxsap_db[i].v) & (HASHNAMESIZE-1); 1104 table = &ipxsaptable[j]; 1105 while (table->name) 1106 table = table->nxt; 1107 table->name = ipxsap_db[i].s; 1108 table->addr = htons(ipxsap_db[i].v); 1109 table->nxt = newhnamemem(); 1110 } 1111} 1112 |
1113/* 1114 * Initialize the address to name translation machinery. We map all 1115 * non-local IP addresses to numeric addresses if fflag is true (i.e., 1116 * to prevent blocking on the nameserver). localnet is the IP address 1117 * of the local network. mask is its subnet mask. 1118 */ 1119void 1120init_addrtoname(u_int32_t localnet, u_int32_t mask) 1121{ |
1122 if (fflag) { 1123 f_localnet = localnet; 1124 f_netmask = mask; 1125 } 1126 if (nflag) 1127 /* 1128 * Simplest way to suppress names. 1129 */ 1130 return; 1131 1132 init_etherarray(); 1133 init_servarray(); 1134 init_eprotoarray(); 1135 init_llcsaparray(); 1136 init_protoidarray(); |
1137 init_ipxsaparray(); |
1138} 1139 1140const char * 1141dnaddr_string(u_short dnaddr) 1142{ 1143 register struct hnamemem *tp; 1144 1145 for (tp = &dnaddrtable[dnaddr & (HASHNAMESIZE-1)]; tp->nxt != 0; --- 53 unchanged lines hidden --- |