2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 /* getifinfo.c retrives the IP configuration information for the machine.
12 * NT stores this information in different places depending on the type
16 #include <afs/param.h>
24 #include <WINNT/syscfg.h>
30 int addrs[MAXIPADDRS];
31 int masks[MAXIPADDRS];
33 int flags[MAXIPADDRS];
35 main(int ac, char **av)
42 rxi_numNetAddrs = MAXIPADDRS;
44 if ((maxAddrs = syscfg_GetIFInfo(&rxi_numNetAddrs,
45 addrs, masks, mtus, flags)) < 0) {
46 printf("Failed reading interface information\n");
48 printf("Found %d useable addresses, max = %d\n",
49 rxi_numNetAddrs, maxAddrs);
51 for (i=0; i<rxi_numNetAddrs; i++) {
52 ina.S_un.S_addr = htonl((unsigned long)addrs[i]);
53 (void) strcpy(addrStr, inet_ntoa(ina));
54 ina.S_un.S_addr = htonl((unsigned long)masks[i]);
55 printf("IP: 0x%x %s MASK: 0x%x %s\n",
56 addrs[i], addrStr, masks[i],