*/
#include <afsconfig.h>
-#ifdef KERNEL
-#include "afs/param.h"
-#else
#include <afs/param.h>
-#include <roken.h>
-#endif
+#ifndef KERNEL
+# include <roken.h>
+
+# ifdef AFS_NT40_ENV
+# include <rpc.h>
+# else
+# include <net/if.h>
+# if !defined(AFS_LINUX20_ENV) && !defined(AFS_ARM_DARWIN_ENV)
+# include <netinet/if_ether.h>
+# endif
+# endif
+
+#include "afsutil.h"
-#ifdef KERNEL
-#include "afs/sysincludes.h"
-#include "afsincludes.h"
-#else /* KERNEL */
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#ifdef AFS_NT40_ENV
-#include <rpc.h>
-#include <winsock2.h>
-#include <process.h>
#else
-#include <sys/file.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#ifndef ITIMER_REAL
-#include <sys/time.h>
-#endif /* ITIMER_REAL */
-#include <net/if.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+# include "afs/sysincludes.h"
+# include "afsincludes.h"
#endif
-#include <stdlib.h>
+#ifdef UKERNEL
+# include "rx/rx_prototypes.h"
#endif
-#include <sys/stat.h>
-#include <fcntl.h>
-#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_ARM_DARWIN_ENV)
-#include <netinet/if_ether.h>
-#endif
-#include "afsutil.h"
-#endif /* KERNEL */
-
typedef struct {
char eaddr[6]; /* 6 bytes of ethernet hardware address */
* +--------------------------...-----+
*/
-afsUUID afs_uuid_g_nil_uuid = { 0 };
+afsUUID afs_uuid_g_nil_uuid;
static uuid_time_t time_now, time_last;
static u_short uuid_time_adjust, clock_seq;
static afs_uint32 rand_m, rand_ia, rand_ib, rand_irand, uuid_init_done = 0;
uuid_get_address(uuid_address_p_t addr)
{
afs_int32 code;
- afs_uint32 addr1;
- struct hostent *he;
+ afs_uint32 addr1 = 0;
+ struct hostent *he = NULL;
code = gethostname(hostName1, 64);
- if (code) {
- printf("gethostname() failed\n");
-#ifdef AFS_NT40_ENV
- return ENOENT;
-#else
- return errno;
+ if (!code)
+ he = gethostbyname(hostName1);
+
+ if (he)
+ memcpy(&addr1, he->h_addr_list[0], 4);
+#ifdef UKERNEL
+ else
+ addr1=rxi_getaddr();
#endif
- }
- he = gethostbyname(hostName1);
- if (!he) {
- printf("Can't find address for '%s'\n", hostName1);
+
+ if (!addr1) {
#ifdef AFS_NT40_ENV
return ENOENT;
#else
return errno;
#endif
- } else {
- memcpy(&addr1, he->h_addr_list[0], 4);
- addr1 = ntohl(addr1);
- memcpy(addr->eaddr, &addr1, 4);
- addr->eaddr[4] = 0xaa;
- addr->eaddr[5] = 0x77;
+ }
+
+ addr1 = ntohl(addr1);
+ memcpy(addr->eaddr, &addr1, 4);
+ addr->eaddr[4] = 0xaa;
+ addr->eaddr[5] = 0x77;
#ifdef UUID_DEBUG
- printf("uuid_get_address: %02x-%02x-%02x-%02x-%02x-%02x\n",
- addr->eaddr[0], addr->eaddr[1], addr->eaddr[2], addr->eaddr[3],
- addr->eaddr[4], addr->eaddr[5]);
+ printf("uuid_get_address: %02x-%02x-%02x-%02x-%02x-%02x\n",
+ addr->eaddr[0], addr->eaddr[1], addr->eaddr[2], addr->eaddr[3],
+ addr->eaddr[4], addr->eaddr[5]);
#endif
- }
return 0;
}