1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
$NetBSD: patch-al,v 1.3 2005/10/18 04:48:52 grant Exp $
--- agent/mibgroup/host/hr_network.c.orig 2004-01-30 00:54:01.000000000 +1100
+++ agent/mibgroup/host/hr_network.c
@@ -189,6 +189,10 @@ static short HRN_index;
static char HRN_name[MAX_PHYSADDR_LEN];
static nmapi_phystat HRN_ifnet;
#define M_Interface_Scan_Next(a, b, c, d) Interface_Scan_Next(a, b, c)
+#elif defined darwin
+static char HRN_name[IFNAMSIZ];
+static struct if_msghdr HRN_ifnet;
+#define M_Interface_Scan_Next(a, b, c, d) Interface_Scan_Next(a, b, c, d)
#else /* hpux11 */
static char HRN_name[16];
static struct ifnet HRN_ifnet;
@@ -215,7 +219,7 @@ Init_HR_Network(void)
int
Get_Next_HR_Network(void)
{
-#ifndef solaris2
+#if (!defined solaris2 && !defined darwin)
if (M_Interface_Scan_Next(&HRN_index, HRN_name, &HRN_ifnet, NULL))
return (HRDEV_NETWORK << HRDEV_TYPE_SHIFT) + HRN_index;
else
@@ -231,7 +235,11 @@ Save_HR_Network_Info(void)
HRN_savedFlags = HRN_ifnet.if_entry.ifOper;
HRN_savedErrors = HRN_ifnet.if_entry.ifInErrors +
HRN_ifnet.if_entry.ifOutErrors;
-#else /* hpux11 */
+#elif defined(__APPLE__)
+ HRN_savedFlags = HRN_ifnet.ifm_flags;
+ HRN_savedFlags = HRN_ifnet.ifm_data.ifi_ierrors +
+ HRN_ifnet.ifm_data.ifi_oerrors;
+#else
HRN_savedFlags = HRN_ifnet.if_flags;
HRN_savedErrors = HRN_ifnet.if_ierrors + HRN_ifnet.if_oerrors;
#endif /* hpux11 */
|