View | Details | Raw Unified | Return to bug 97673 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/ports/net-mgmt/net-snmp/Makefile (-6 / +2 lines)
Lines 6-13 Link Here
6
 #
6
 #
7
 PORTNAME=	snmp
7
 PORTNAME=	snmp
8
PORTVERSION=	5.2.2
8
PORTVERSION=	5.3.0.1
9
PORTREVISION=	1
9
PORTREVISION=	0
10
 CATEGORIES=	net-mgmt ipv6
10
 CATEGORIES=	net-mgmt ipv6
11
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
11
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
12
 MASTER_SITE_SUBDIR=	net-snmp
12
 MASTER_SITE_SUBDIR=	net-snmp
Lines 16-25 Link Here
16
 MAINTAINER=	kuriyama@FreeBSD.org
16
 MAINTAINER=	kuriyama@FreeBSD.org
17
 COMMENT=	An extendable SNMP implementation
17
 COMMENT=	An extendable SNMP implementation
18
19
.if !defined(WITH_TKMIB)
20
EXTRA_PATCHES+=	${PATCHDIR}/extra-patch-local:Makefile.in
21
.endif
22
 .if defined(WITH_TKMIB)
18
 .if defined(WITH_TKMIB)
23
 RUN_DEPEND=	${SITE_PERL}/${PERL_ARCH}/Tk.pm:${PORTSDIR}/x11-toolkits/p5-Tk
19
 RUN_DEPEND=	${SITE_PERL}/${PERL_ARCH}/Tk.pm:${PORTSDIR}/x11-toolkits/p5-Tk
(-)/usr/ports/net-mgmt/net-snmp/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (net-snmp-5.2.2.tar.gz) = 2d9cdf956d6be5c5fcf2f898b403389b
1
MD5 (net-snmp-5.3.0.1.tar.gz) = db5995ff8fae154cbe7417a4a6f2ca60
2
SHA256 (net-snmp-5.2.2.tar.gz) = 
2
SHA256 (net-snmp-5.3.0.1.tar.gz) = 
3
SIZE (net-snmp-5.2.2.tar.gz) = 3919826
3
SIZE (net-snmp-5.3.0.1.tar.gz) = 4183370
(-)/usr/ports/net-mgmt/net-snmp/files/extra-patch-local:Makefile.in (-11 lines)
Lines 1-11 Link Here
1
--- local/Makefile.in.orig	Tue Oct 11 03:47:48 2005
2
+++ local/Makefile.in	Wed Nov 30 11:32:52 2005
3
@@ -16,7 +16,7 @@
4
 #
5
 SNMPCONFPATH=@SNMPCONFPATH@
6
 PERSISTENT_DIRECTORY=@PERSISTENT_DIRECTORY@
7
-PERLSCRIPTS=snmpcheck tkmib mib2c fixproc ipf-mod.pl snmpconf traptoemail
8
+PERLSCRIPTS=snmpcheck mib2c fixproc ipf-mod.pl snmpconf traptoemail
9
 SHELLSCRIPTS=mib2c-update
10
 SCRIPTSMADEFORPERL=snmpcheck.made tkmib.made mib2c.made fixproc.made \
11
 	ipf-mod.pl.made snmpconf.made traptoemail.made
(-)/usr/ports/net-mgmt/net-snmp/files/patch-Makefile.in (-11 lines)
Lines 1-11 Link Here
1
--- Makefile.in.orig	Tue Oct 11 20:49:23 2005
2
+++ Makefile.in	Wed Nov 30 11:35:12 2005
3
@@ -16,7 +16,7 @@
4
 INSTALLHEADERS=version.h
5
 INCLUDESUBDIR=system
6
 INCLUDESUBDIRHEADERS= aix.h bsd.h bsdi3.h bsdi4.h bsdi.h cygwin.h \
7
-	darwin.h darwin7.h darwin8.h freebsd5.h freebsd6.h \
8
+	darwin.h darwin7.h darwin8.h freebsd5.h freebsd6.h freebsd7.h \
9
 	dynix.h freebsd2.h freebsd3.h freebsd4.h freebsd.h generic.h hpux.h \
10
 	irix.h linux.h mingw32.h mips.h netbsd.h openbsd.h osf5.h \
11
 	solaris2.6.h solaris2.7.h solaris2.8.h solaris2.9.h solaris2.10.h \
(-)/usr/ports/net-mgmt/net-snmp/files/patch-agent_index.c (-13 lines)
Lines 1-13 Link Here
1
--- agent/agent_index.c.orig	Mon Jan 24 09:14:39 2005
2
+++ agent/agent_index.c	Mon Jan 24 09:14:55 2005
3
@@ -39,10 +39,6 @@
4
 #include <netinet/in.h>
5
 #endif
6
7
-#if HAVE_DMALLOC_H
8
-#include <dmalloc.h>
9
-#endif
10
-
11
 #include <net-snmp/net-snmp-includes.h>
12
 #include <net-snmp/agent/net-snmp-agent-includes.h>
13
 #include <net-snmp/agent/agent_callbacks.h>
(-)/usr/ports/net-mgmt/net-snmp/files/patch-agent_read_config.c (-13 lines)
Lines 1-13 Link Here
1
--- agent/agent_read_config.c.orig	Mon Jan 24 09:12:58 2005
2
+++ agent/agent_read_config.c	Mon Jan 24 09:13:13 2005
3
@@ -84,10 +84,6 @@
4
 #include <inet/mib2.h>
5
 #endif
6
7
-#if HAVE_DMALLOC_H
8
-#include <dmalloc.h>
9
-#endif
10
-
11
 #if HAVE_UNISTD_H
12
 #include <unistd.h>
13
 #endif
(-)/usr/ports/net-mgmt/net-snmp/files/patch-agent_registry.c (-13 lines)
Lines 1-13 Link Here
1
--- agent/agent_registry.c.orig	Mon Jan 24 09:14:00 2005
2
+++ agent/agent_registry.c	Mon Jan 24 09:14:08 2005
3
@@ -51,10 +51,6 @@
4
 #include <netinet/in.h>
5
 #endif
6
7
-#if HAVE_DMALLOC_H
8
-#include <dmalloc.h>
9
-#endif
10
-
11
 #include <net-snmp/net-snmp-includes.h>
12
 #include <net-snmp/agent/net-snmp-agent-includes.h>
13
 #include <net-snmp/agent/agent_callbacks.h>
(-)/usr/ports/net-mgmt/net-snmp/files/patch-at.c (-12 lines)
Lines 1-12 Link Here
1
--- agent/mibgroup/mibII/at.c.orig	Mon Jan 24 09:08:41 2005
2
+++ agent/mibgroup/mibII/at.c	Mon Jan 24 09:08:58 2005
3
@@ -90,9 +90,6 @@
4
 #if HAVE_WINSOCK_H
5
 #include <winsock.h>
6
 #endif
7
-#if HAVE_DMALLOC_H
8
-#include <dmalloc.h>
9
-#endif
10
11
 #ifdef hpux11
12
 #include <sys/mib.h>
(-)/usr/ports/net-mgmt/net-snmp/files/patch-auto_nlist.c (-13 lines)
Lines 1-13 Link Here
1
--- agent/auto_nlist.c.orig	Mon Jan 24 09:11:07 2005
2
+++ agent/auto_nlist.c	Mon Jan 24 09:11:24 2005
3
@@ -21,10 +21,6 @@
4
 #include <kvm.h>
5
 #endif
6
7
-#if HAVE_DMALLOC_H
8
-#include <dmalloc.h>
9
-#endif
10
-
11
 #include <net-snmp/agent/auto_nlist.h>
12
 #include "autonlist.h"
13
 #include "kernel.h"
(-)/usr/ports/net-mgmt/net-snmp/files/patch-callback.c (-12 lines)
Lines 1-12 Link Here
1
--- snmplib/callback.c.orig	Tue Jan 25 10:19:39 2005
2
+++ snmplib/callback.c	Tue Jan 25 10:19:53 2005
3
@@ -34,6 +34,9 @@
4
 #include <strings.h>
5
 #endif
6
7
+#if HAVE_UNISTD_H
8
+#include <unistd.h>
9
+#endif
10
 #if HAVE_DMALLOC_H
11
 #include <dmalloc.h>
12
 #endif
(-)/usr/ports/net-mgmt/net-snmp/files/patch-configure.in (-38 lines)
Lines 1-38 Link Here
1
--- configure.in.orig	Tue Nov 29 14:16:55 2005
2
+++ configure.in	Wed Nov 30 11:49:24 2005
3
@@ -2075,7 +2075,7 @@
4
   # fall back
5
   CFLAG="-f"
6
 fi
7
-for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix 
8
+for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix 
9
   do
10
   if test -f $i -o $CFLAG $i; then
11
     ac_cv_KERNEL_LOC="$i"
12
@@ -2989,6 +2989,26 @@
13
 # checking for 4.3 vs 4.4 rtentry.
14
 AC_CACHE_CHECK(type of rtentry structure,ac_cv_RTENTRY_TYPE,
15
 [
16
+
17
+dnl 4.4 compatible but renamed on FreeBSD
18
+AC_TRY_COMPILE([
19
+#include <sys/types.h>
20
+#define KERNEL
21
+#define _KERNEL
22
+#include <sys/socket.h>
23
+#undef KERNEL
24
+#undef _KERNEL
25
+#include <net/route.h>
26
+],[
27
+
28
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
29
+#define rt_dst rt_nodes->rn_key
30
+#endif
31
+
32
+  struct rtentry rt;
33
+  rt.rt_nodes[0].rn_bit = 1;
34
+  rt.rt_dst;
35
+  ], ac_cv_RTENTRY_TYPE="BSD-4.4")
36
37
 # 4.4 compat
38
 AC_TRY_COMPILE([
(-)/usr/ports/net-mgmt/net-snmp/files/patch-default_store.c (-12 lines)
Lines 1-12 Link Here
1
--- snmplib/default_store.c.orig	Tue Jan 25 10:20:31 2005
2
+++ snmplib/default_store.c	Tue Jan 25 10:20:47 2005
3
@@ -145,6 +145,9 @@
4
 #include <winsock.h>
5
 #endif
6
7
+#if HAVE_UNISTD_H
8
+#include <unistd.h>
9
+#endif
10
 #if HAVE_DMALLOC_H
11
 #include <dmalloc.h>
12
 #endif
(-)/usr/ports/net-mgmt/net-snmp/files/patch-freebsd5.h (-10 lines)
Lines 1-10 Link Here
1
--- include/net-snmp/system/freebsd5.h.orig	Wed Sep  1 00:13:46 2004
2
+++ include/net-snmp/system/freebsd5.h	Wed Sep  1 00:13:57 2004
3
@@ -7,6 +7,7 @@
4
 #define freebsd3 1
5
 /* freebsd5 is a superset of freebsd4 */
6
 #define freebsd4 1
7
+#define freebsd5 1
8
9
 #undef IFADDR_SYMBOL
10
 #define IFADDR_SYMBOL "in_ifaddrhead"
(-)/usr/ports/net-mgmt/net-snmp/files/patch-freebsd7.h (-4 lines)
Lines 1-4 Link Here
1
--- include/net-snmp/system/freebsd7.h.orig	Sun Jul 17 22:41:06 2005
2
+++ include/net-snmp/system/freebsd7.h	Sun Jul 17 22:41:28 2005
3
@@ -0,0 +1 @@
4
+#include "freebsd6.h"
(-)/usr/ports/net-mgmt/net-snmp/files/patch-hr_storage.c (-222 lines)
Lines 1-221 Link Here
1
--- agent/mibgroup/host/hr_storage.c.orig	Fri Oct  7 07:55:23 2005
2
+++ agent/mibgroup/host/hr_storage.c	Wed Nov 30 12:01:05 2005
3
@@ -233,6 +233,10 @@
4
 void            sol_get_swapinfo(int *, int *);
5
 #endif
6
7
+#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
8
+void		collect_mbuf(long *long_mbuf, long *long_mbufc);
9
+#endif
10
+
11
 #define	HRSTORE_MEMSIZE		1
12
 #define	HRSTORE_INDEX		2
13
 #define	HRSTORE_TYPE		3
14
@@ -472,7 +476,8 @@
15
     NULL,
16
     "Memory Buffers",           /* HRS_TYPE_MBUF */
17
     "Real Memory",              /* HRS_TYPE_MEM */
18
-    "Swap Space"                /* HRS_TYPE_SWAP */
19
+    "Swap Space",               /* HRS_TYPE_SWAP */
20
+    "Memory Buffer Clusters"    /* HRS_TYPE_MBUFCLUSTER */
21
 };
22
23
24
@@ -611,6 +616,7 @@
25
                 storage_type_id[storage_type_len - 1] = 3;      /* 
26
                 break;
27
             case HRS_TYPE_MBUF:
28
+            case HRS_TYPE_MBUFCLUSTER:
29
                 storage_type_id[storage_type_len - 1] = 1;      /* 
30
                 break;
31
             default:
32
@@ -704,7 +710,7 @@
33
                 long_return = memory_totals.t_vm;
34
 #endif
35
                 break;
36
-#else               /* !linux && !solaris2 && !hpux10 && !hpux11 && ... */
37
+#else
38
             case HRS_TYPE_MEM:
39
                 long_return = physmem;
40
                 break;
41
@@ -726,13 +732,45 @@
42
                      i++)
43
                     long_return += mbstat.m_mtypes[i];
44
 #elif defined(MBSTAT_SYMBOL) && defined(STRUCT_MBSTAT_HAS_M_MBUFS)
45
+#if !defined(__FreeBSD__) || __FreeBSD_version < 500021
46
                 long_return = mbstat.m_mbufs;
47
+#elif defined(__FreeBSD__) && __FreeBSD_version < 500024
48
+		/* mbuf stats disabled */
49
+		return NULL;
50
+#elif defined(__FreeBSD__)
51
+		{
52
+		  size_t mlen = sizeof(int);
53
+		  int nmbufs;
54
+		  if (sysctlbyname("kern.ipc.nmbufs", &nmbufs, &mlen,
55
+				   NULL, 0) < 0) {
56
+		    return NULL;
57
+		  }
58
+		  long_return = nmbufs;
59
+		  break;
60
+		}
61
+#else
62
+#error "XXX"
63
+		/* XXX TODO: implement new method */
64
+		return NULL;
65
+#endif /* __FreeBSD__ */
66
 #elif defined(NO_DUMMY_VALUES)
67
                 goto try_next;
68
 #else
69
                 long_return = 0;
70
 #endif
71
                 break;
72
+#if defined(__FreeBSD__) && __FreeBSD_version >= 500024
73
+	    case HRS_TYPE_MBUFCLUSTER: {
74
+	      size_t mlen = sizeof(int);
75
+	      int nmbclusters;
76
+	      if (sysctlbyname("kern.ipc.nmbclusters", &nmbclusters, &mlen,
77
+			       NULL, 0) < 0) {
78
+		return NULL;
79
+	      }
80
+	      long_return = nmbclusters;
81
+	      break;
82
+	    }
83
+#endif
84
             default:
85
 #if NO_DUMMY_VALUES
86
                 goto try_next;
87
@@ -796,6 +834,12 @@
88
 #endif
89
 #elif defined(MBSTAT_SYMBOL) && defined(STRUCT_MBSTAT_HAS_M_CLUSTERS)
90
                 long_return = mbstat.m_clusters - mbstat.m_clfree; 
91
  /* unlikely, but... */
0
  /* unlikely, but... */
92
+#elif defined(__FreeBSD__) && __FreeBSD_version < 500102
93
+		/* mbuf stats disabled */
94
+		return NULL;
95
+#elif defined(__FreeBSD__)
96
+		collect_mbuf((long*)&long_return, (long*)NULL);
97
+		break;
98
 #elif defined(NO_DUMMY_VALUES)
99
                 goto try_next;
100
 #else
101
@@ -803,6 +847,11 @@
102
 #endif
103
                 break;
104
 #endif                      /* !linux && !solaris2 && !hpux10 && 
105
+#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
106
+	    case HRS_TYPE_MBUFCLUSTER:
107
+	      collect_mbuf(NULL, &long_return);
108
+	      break;
109
+#endif
110
             default:
111
 #if NO_DUMMY_VALUES
112
                 goto try_next;
113
@@ -829,7 +878,11 @@
114
                 break;
115
 #if !defined(linux) && !defined(solaris2) && !defined(hpux10) && 
116
             case HRS_TYPE_MBUF:
117
+#if defined(__FreeBSD__) && __FreeBSD_version >= 502113
118
+                long_return = mbstat.m_mcfail + mbstat.m_mpfail;
119
+#else
120
                 long_return = mbstat.m_drops;
121
+#endif
122
                 break;
123
 #endif                          /* !linux && !solaris2 && !hpux10 && 
124
             default:
125
@@ -955,3 +1008,97 @@
126
     *usedP = ainfo.ani_resv;
127
 }
128
 #endif                          /* solaris2 */
129
+
130
+#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
131
+void
132
+collect_mbuf(long *long_mbuf, long *long_mbufc)
133
+{
134
+#if __FreeBSD_version >= 502113
135
+  size_t mlen;
136
+  struct mbstat mbstat;
137
+
138
+  mlen = sizeof mbstat;
139
+  if (sysctlbyname("kern.ipc.mbstat", &mbstat, &mlen, NULL, 0) < 0) {
140
+    warn("sysctl: retrieving mbstat");
141
+    return;
142
+  }
143
+  if (mbstat.m_mbufs < 0) mbstat.m_mbufs = 0;		/* XXX */
144
+  if (mbstat.m_mclusts < 0) mbstat.m_mclusts = 0;	/* XXX */
145
+  if (long_mbuf) {
146
+    *long_mbuf = mbstat.m_mbufs;
147
+  }
148
+  if (long_mbufc) {
149
+    *long_mbufc = mbstat.m_mclusts;
150
+  }
151
+#else
152
+  int i, j, num_objs;
153
+  size_t mlen;
154
+  u_long totused[2];
155
+  u_long totnum, totfree;
156
+  struct mbstat mbstat;
157
+  struct mbpstat **mbpstat = NULL;
158
+
159
+  if (sysctlbyname("kern.ipc.mb_statpcpu", NULL, &mlen, NULL, 0) < 0) {
160
+    warn("sysctl: retrieving mb_statpcpu len");
161
+    goto err;
162
+  }
163
+  num_objs = (int)(mlen / sizeof(struct mbpstat));
164
+  if ((mbpstat = calloc(num_objs, sizeof(struct mbpstat *))) == NULL) {
165
+    warn("calloc: cannot allocate memory for mbpstats pointers");
166
+    goto err;
167
+  }
168
+  if ((mbpstat[0] = calloc(num_objs, sizeof(struct mbpstat))) == NULL) {
169
+    warn("calloc: cannot allocate memory for mbpstats");
170
+    goto err;
171
+  }
172
+
173
+  if (sysctlbyname("kern.ipc.mb_statpcpu", mbpstat[0], &mlen, NULL, 0) 
174
0) {
175
+    warn("sysctl: retrieving mb_statpcpu");
176
+    goto err;
177
+  }
178
+  mlen = sizeof mbstat;
179
+  if (sysctlbyname("kern.ipc.mbstat", &mbstat, &mlen, NULL, 0) < 0) {
180
+    warn("sysctl: retrieving mbstat");
181
+    goto err;
182
+  }
183
+
184
+  for (i = 0; i < num_objs; i++)
185
+    mbpstat[i] = mbpstat[0] + i;
186
+
187
+#define	GENLST		(num_objs - 1)
188
+
189
+  totnum = mbpstat[GENLST]->mb_mbbucks * mbstat.m_mbperbuck;
190
+  totfree = mbpstat[GENLST]->mb_mbfree;
191
+  for (i = 0; i < (num_objs - 1); i++) {
192
+    if (mbpstat[i]->mb_active == 0)
193
+      continue;
194
+    totnum += mbpstat[i]->mb_mbbucks * mbstat.m_mbperbuck;
195
+    totfree += mbpstat[i]->mb_mbfree;
196
+  }
197
+  totused[0] = totnum - totfree;
198
+  totnum = mbpstat[GENLST]->mb_clbucks * mbstat.m_clperbuck;
199
+  totfree = mbpstat[GENLST]->mb_clfree;
200
+  for (i = 0; i < (num_objs - 1); i++) {
201
+    if (mbpstat[i]->mb_active == 0)
202
+      continue;
203
+    totnum += mbpstat[i]->mb_clbucks * mbstat.m_clperbuck;
204
+    totfree += mbpstat[i]->mb_clfree;
205
+  }
206
+  totused[1] = totnum - totfree;
207
+
208
+  if (long_mbuf) {
209
+    *long_mbuf = totused[0];
210
+  }
211
+  if (long_mbufc) {
212
+    *long_mbufc = totused[1];
213
+  }
214
+
215
+ err:
216
+  if (mbpstat != NULL) {
217
+    if (mbpstat[0] != NULL)
218
+      free(mbpstat[0]);
219
+    free(mbpstat);
220
+  }
221
+#endif
222
+}
223
+#endif
(-)/usr/ports/net-mgmt/net-snmp/files/patch-hr_storage.h (-11 lines)
Lines 1-11 Link Here
1
--- agent/mibgroup/host/hr_storage.h.orig	Tue Feb 25 22:17:48 2003
2
+++ agent/mibgroup/host/hr_storage.h	Wed May  5 15:27:40 2004
3
@@ -12,6 +12,7 @@
4
 #define	HRS_TYPE_MBUF		1
5
 #define	HRS_TYPE_MEM		2
6
 #define	HRS_TYPE_SWAP		3
7
-#define	HRS_TYPE_FIXED_MAX	3     /* the largest fixed type */
8
+#define	HRS_TYPE_MBUFCLUSTER	4
9
+#define	HRS_TYPE_FIXED_MAX	4     /* the largest fixed type */
10
11
 #endif                          /* _MIBGROUP_HRSTORAGE_H */
(-)/usr/ports/net-mgmt/net-snmp/files/patch-hr_swrun.c (-78 lines)
Lines 1-78 Link Here
1
--- agent/mibgroup/host/hr_swrun.c.orig	Thu Oct 20 04:32:20 2005
2
+++ agent/mibgroup/host/hr_swrun.c	Wed Nov 30 12:50:12 2005
3
@@ -585,7 +585,7 @@
4
         string[ sizeof(string)-1 ] = 0;
5
 #endif
6
 #elif HAVE_KVM_GETPROCS
7
-    #if defined(freebsd5)
8
+    #if defined(freebsd5) && __FreeBSD_version >= 500014
9
         strcpy(string, proc_table[LowProcIndex].ki_comm);
10
     #else
11
         strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm);
12
@@ -698,7 +698,7 @@
13
         *cp1 = 0;
14
 #endif
15
 #elif HAVE_KVM_GETPROCS
16
-    #if defined(freebsd5)
17
+    #if defined(freebsd5) && __FreeBSD_version >= 500014
18
         strcpy(string, proc_table[LowProcIndex].ki_comm);
19
     #else
20
         strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm);
21
@@ -868,8 +868,23 @@
22
         if (pid < PID_MAXSYS)
23
             long_return = 2;    /* operatingSystem */
24
         else
25
-#endif
26
             long_return = 4;    /* application */
27
+#elif HAVE_KVM_GETPROCS
28
+    #if defined(freebsd5) && __FreeBSD_version >= 500014
29
+        if (proc_table[LowProcIndex].ki_flag & P_SYSTEM) {
30
+            if (proc_table[LowProcIndex].ki_pri.pri_class == PRI_ITHD)
31
+                long_return = 3;/* deviceDriver */
32
+            else
33
+                long_return = 2;/* operatingSystem */
34
+        } else
35
+            long_return = 4;    /* application */
36
+#else
37
+        if (proc_table[LowProcIndex].kp_proc.p_flag & P_SYSTEM)
38
+            long_return = 2;    /* operatingSystem */
39
+        else
40
+            long_return = 4;    /* application */
41
+#endif
42
+#endif
43
         return (u_char *) & long_return;
44
     case HRSWRUN_STATUS:
45
 #if defined(cygwin)
46
@@ -901,7 +916,7 @@
47
         }
48
 #else
49
 #if HAVE_KVM_GETPROCS
50
-    #if defined(freebsd5)
51
+    #if defined(freebsd5) && __FreeBSD_version >= 500014
52
         switch (proc_table[LowProcIndex].ki_stat) {
53
     #else
54
         switch (proc_table[LowProcIndex].kp_proc.p_stat) {
55
@@ -1000,7 +1015,13 @@
56
         long_return = proc_buf->p_utime * 100 + proc_buf->p_stime * 100;
57
 #endif
58
 #elif HAVE_KVM_GETPROCS
59
-    #if defined(freebsd5)
60
+    #if defined(freebsd5) && __FreeBSD_version >= 500014
61
+        /* XXX: Accessing ki_paddr causes sig10 ...
62
+        long_return = proc_table[LowProcIndex].ki_paddr->p_uticks +
63
+            proc_table[LowProcIndex].ki_paddr->p_sticks +
64
+            proc_table[LowProcIndex].ki_paddr->p_iticks; */
65
+        long_return = 0;
66
+    #elif defined(freebsd5)
67
         long_return = proc_table[LowProcIndex].ki_runtime / 100000;
68
     #else
69
         long_return = proc_table[LowProcIndex].kp_proc.p_uticks +
70
@@ -1365,7 +1386,7 @@
71
 #elif defined(solaris2)
72
         return proc_table[current_proc_entry++];
73
 #elif HAVE_KVM_GETPROCS
74
-    #if defined(freebsd5)
75
+    #if defined(freebsd5) && __FreeBSD_version >= 500014
76
         if (proc_table[current_proc_entry].ki_stat != 0)
77
             return proc_table[current_proc_entry++].ki_pid;
78
     #else
(-)/usr/ports/net-mgmt/net-snmp/files/patch-hr_system.c (-1 / +1 lines)
Lines 1-6 Link Here
1
 --- agent/mibgroup/host/hr_system.c.orig	Mon Feb 23 02:29:34 2004
1
 --- agent/mibgroup/host/hr_system.c.orig	Mon Feb 23 02:29:34 2004
2
 +++ agent/mibgroup/host/hr_system.c	Sat Apr  3 00:00:24 2004
2
 +++ agent/mibgroup/host/hr_system.c	Sat Apr  3 00:00:24 2004
3
@@ -596,6 +596,8 @@
3
@@ -613,6 +613,8 @@
4
  #ifndef UTMP_HAS_NO_TYPE
4
  #ifndef UTMP_HAS_NO_TYPE
5
          if (utmp_p->ut_type != USER_PROCESS)
5
          if (utmp_p->ut_type != USER_PROCESS)
6
              continue;
6
              continue;
(-)/usr/ports/net-mgmt/net-snmp/files/patch-interfaces.c (-293 lines)
Lines 1-293 Link Here
1
--- agent/mibgroup/mibII/interfaces.c.orig	Tue Jan  4 00:51:32 2005
2
+++ agent/mibgroup/mibII/interfaces.c	Thu Apr  7 11:47:45 2005
3
@@ -399,6 +399,133 @@
4
     return NULL;
5
 }
6
7
+#if defined(freebsd2)
8
+static char    *physaddrbuf;
9
+static int      nphysaddrs;
10
+struct sockaddr_dl **physaddrs;
11
+
12
+void
13
+init_interfaces_setup(void)
14
+{
15
+    int             naddrs, ilen, bit;
16
+    static int      mib[6]
17
+    = { CTL_NET, PF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0 };
18
+    char           *cp;
19
+    size_t          len;
20
+    struct rt_msghdr *rtm;
21
+    struct if_msghdr *ifm;
22
+    struct ifa_msghdr *ifam;
23
+    struct sockaddr *sa;
24
+
25
+    naddrs = 0;
26
+    if (physaddrs)
27
+        free(physaddrs);
28
+    if (physaddrbuf)
29
+        free(physaddrbuf);
30
+    physaddrbuf = 0;
31
+    physaddrs = 0;
32
+    nphysaddrs = 0;
33
+    len = 0;
34
+    if (sysctl(mib, 6, 0, &len, 0, 0) < 0)
35
+        return;
36
+
37
+    cp = physaddrbuf = malloc(len);
38
+    if (physaddrbuf == 0)
39
+        return;
40
+    if (sysctl(mib, 6, physaddrbuf, &len, 0, 0) < 0) {
41
+        free(physaddrbuf);
42
+        physaddrbuf = 0;
43
+        return;
44
+    }
45
+
46
+  loop:
47
+    ilen = len;
48
+    cp = physaddrbuf;
49
+    while (ilen > 0) {
50
+        rtm = (struct rt_msghdr *) cp;
51
+        if (rtm->rtm_version != RTM_VERSION || rtm->rtm_type != 
52
+            free(physaddrs);
53
+            physaddrs = 0;
54
+            free(physaddrbuf);
55
+            physaddrbuf = 0;
56
+        }
57
+        ifm = (struct if_msghdr *) rtm;
58
+#if defined(freebsd3) || defined(freebsd4) || defined(freebsd5)
59
+        if (physaddrs != 0)
60
+            physaddrs[naddrs] = (void *) (ifm + 1);
61
+        naddrs++;
62
+#endif
63
+        ilen -= ifm->ifm_msglen;
64
+        cp += ifm->ifm_msglen;
65
+        rtm = (struct rt_msghdr *) cp;
66
+        while (ilen > 0 && rtm->rtm_type == RTM_NEWADDR) {
67
+#if defined(freebsd3) || defined(freebsd4) || defined(freebsd5)
68
+            ilen -= rtm->rtm_msglen;
69
+            cp += rtm->rtm_msglen;
70
+#else
71
+            int             is_alias = 0;
72
+            ifam = (struct ifa_msghdr *) rtm;
73
+            ilen -= sizeof(*ifam);
74
+            cp += sizeof(*ifam);
75
+            sa = (struct sockaddr *) cp;
76
+#define ROUND(x) (((x) + sizeof(long) - 1) & ~sizeof(long))
77
+            for (bit = 1; bit && ilen > 0; bit <<= 1) {
78
+                if (!(ifam->ifam_addrs & bit))
79
+                    continue;
80
+                ilen -= ROUND(sa->sa_len);
81
+                cp += ROUND(sa->sa_len);
82
+
83
+                if (bit == RTA_IFA) {
84
+                    if (physaddrs)
85
+#define satosdl(sa) ((struct sockaddr_dl *)(sa))
86
+                        physaddrs[naddrs++]
87
+                            = satosdl(sa);
88
+                    else
89
+                        naddrs++;
90
+                }
91
+                sa = (struct sockaddr *) cp;
92
+            }
93
+#endif
94
+            rtm = (struct rt_msghdr *) cp;
95
+        }
96
+    }
97
+    if (physaddrs) {
98
+        nphysaddrs = naddrs;
99
+        return;
100
+    }
101
+    physaddrs = malloc(naddrs * sizeof(*physaddrs));
102
+    if (physaddrs == 0)
103
+        return;
104
+    naddrs = 0;
105
+    goto loop;
106
+
107
+}
108
+
109
+static int
110
+get_phys_address(int iindex, char **ap, int *len)
111
+{
112
+    int             i;
113
+    int             once = 1;
114
+
115
+    do {
116
+        for (i = 0; i < nphysaddrs; i++) {
117
+            if (physaddrs[i]->sdl_index == iindex)
118
+                break;
119
+        }
120
+        if (i < nphysaddrs)
121
+            break;
122
+        init_interfaces_setup();
123
+    } while (once--);
124
+
125
+    if (i < nphysaddrs) {
126
+        *ap = LLADDR(physaddrs[i]);
127
+        *len = physaddrs[i]->sdl_alen;
128
+        return 0;
129
+    }
130
+    return -1;
131
+}
132
+#endif
133
+
134
 #ifdef USE_SYSCTL_IFLIST
135
136
 static u_char  *if_list = 0;
137
@@ -607,10 +734,20 @@
138
         }
139
         return (u_char *) & long_return;
140
     case IFPHYSADDRESS:
141
+#if defined(freebsd2)
142
+        {
143
+            char           *cp;
144
+            if (get_phys_address(interface, &cp, var_len))
145
+                return NULL;
146
+            else
147
+                return cp;
148
+        }
149
+#else
150
         /*
151
          * XXX
152
          */
153
         return NULL;
154
+#endif
155
     case IFADMINSTATUS:
156
         long_return = if_msg.ifm_flags & IFF_UP ? 1 : 2;
157
         return (u_char *) & long_return;
158
@@ -2250,129 +2387,17 @@
159
 u_char         *var_ifEntry(struct variable *, oid *, size_t *, int,
160
                             size_t *, WriteMethod ** write);
161
162
-static char    *physaddrbuf;
163
-static int      nphysaddrs;
164
-struct sockaddr_dl **physaddrs;
165
-
166
 void
167
-init_interfaces_setup(void)
168
+Interface_Scan_Init(void)
169
 {
170
-    int             naddrs, ilen, bit;
171
-    static int      mib[6]
172
-    = { CTL_NET, PF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0 };
173
-    char           *cp;
174
-    size_t          len;
175
-    struct rt_msghdr *rtm;
176
-    struct if_msghdr *ifm;
177
-    struct ifa_msghdr *ifam;
178
-    struct sockaddr *sa;
179
-
180
-    naddrs = 0;
181
-    if (physaddrs)
182
-        free(physaddrs);
183
-    if (physaddrbuf)
184
-        free(physaddrbuf);
185
-    physaddrbuf = 0;
186
-    physaddrs = 0;
187
-    nphysaddrs = 0;
188
-    len = 0;
189
-    if (sysctl(mib, 6, 0, &len, 0, 0) < 0)
190
-        return;
191
-
192
-    cp = physaddrbuf = malloc(len);
193
-    if (physaddrbuf == 0)
194
-        return;
195
-    if (sysctl(mib, 6, physaddrbuf, &len, 0, 0) < 0) {
196
-        free(physaddrbuf);
197
-        physaddrbuf = 0;
198
-        return;
199
-    }
200
-
201
-  loop:
202
-    ilen = len;
203
-    cp = physaddrbuf;
204
-    while (ilen > 0) {
205
-        rtm = (struct rt_msghdr *) cp;
206
-        if (rtm->rtm_version != RTM_VERSION || rtm->rtm_type != 
207
-            free(physaddrs);
208
-            physaddrs = 0;
209
-            free(physaddrbuf);
210
-            physaddrbuf = 0;
211
-        }
212
-        ifm = (struct if_msghdr *) rtm;
213
-#if defined(freebsd3) || defined(freebsd4) || defined(freebsd5)
214
-        if (physaddrs != 0)
215
-            physaddrs[naddrs] = (void *) (ifm + 1);
216
-        naddrs++;
217
-#endif
218
-        ilen -= ifm->ifm_msglen;
219
-        cp += ifm->ifm_msglen;
220
-        rtm = (struct rt_msghdr *) cp;
221
-        while (ilen > 0 && rtm->rtm_type == RTM_NEWADDR) {
222
-#if defined(freebsd3) || defined(freebsd4) || defined(freebsd5)
223
-            ilen -= rtm->rtm_msglen;
224
-            cp += rtm->rtm_msglen;
225
-#else
226
-            int             is_alias = 0;
227
-            ifam = (struct ifa_msghdr *) rtm;
228
-            ilen -= sizeof(*ifam);
229
-            cp += sizeof(*ifam);
230
-            sa = (struct sockaddr *) cp;
231
-#define ROUND(x) (((x) + sizeof(long) - 1) & ~sizeof(long))
232
-            for (bit = 1; bit && ilen > 0; bit <<= 1) {
233
-                if (!(ifam->ifam_addrs & bit))
234
-                    continue;
235
-                ilen -= ROUND(sa->sa_len);
236
-                cp += ROUND(sa->sa_len);
237
-
238
-                if (bit == RTA_IFA) {
239
-                    if (physaddrs)
240
-#define satosdl(sa) ((struct sockaddr_dl *)(sa))
241
-                        physaddrs[naddrs++]
242
-                            = satosdl(sa);
243
-                    else
244
-                        naddrs++;
245
-                }
246
-                sa = (struct sockaddr *) cp;
247
-            }
248
-#endif
249
-            rtm = (struct rt_msghdr *) cp;
250
-        }
251
-    }
252
-    if (physaddrs) {
253
-        nphysaddrs = naddrs;
254
-        return;
255
-    }
256
-    physaddrs = malloc(naddrs * sizeof(*physaddrs));
257
-    if (physaddrs == 0)
258
-        return;
259
-    naddrs = 0;
260
-    goto loop;
261
-
262
 }
263
264
-static int
265
-get_phys_address(int iindex, char **ap, int *len)
266
+int
267
+Interface_Scan_Next(short *Index,
268
+                    char *Name,
269
+                    struct ifnet *Retifnet, struct in_ifaddr 
270
 {
271
-    int             i;
272
-    int             once = 1;
273
-
274
-    do {
275
-        for (i = 0; i < nphysaddrs; i++) {
276
-            if (physaddrs[i]->sdl_index == iindex)
277
-                break;
278
-        }
279
-        if (i < nphysaddrs)
280
-            break;
281
-        init_interfaces_setup();
282
-    } while (once--);
283
-
284
-    if (i < nphysaddrs) {
285
-        *ap = LLADDR(physaddrs[i]);
286
-        *len = physaddrs[i]->sdl_alen;
287
-        return 0;
288
-    }
289
-    return -1;
290
+    return 0;
291
 }
292
293
 int
(-)/usr/ports/net-mgmt/net-snmp/files/patch-master.c (-13 lines)
Lines 1-13 Link Here
1
--- agent/mibgroup/agentx/master.c.orig	Mon Jan 24 09:16:00 2005
2
+++ agent/mibgroup/agentx/master.c	Mon Jan 24 09:16:21 2005
3
@@ -39,10 +39,6 @@
4
 #endif
5
 #include <errno.h>
6
7
-#if HAVE_DMALLOC_H
8
-#include <dmalloc.h>
9
-#endif
10
-
11
 #if HAVE_UNISTD_H
12
 #include <unistd.h>
13
 #endif
(-)/usr/ports/net-mgmt/net-snmp/files/patch-master_admin.c (-12 lines)
Lines 1-12 Link Here
1
--- agent/mibgroup/agentx/master_admin.c.orig	Mon Jan 24 09:18:07 2005
2
+++ agent/mibgroup/agentx/master_admin.c	Mon Jan 24 09:18:15 2005
3
@@ -35,9 +35,6 @@
4
 #if HAVE_SYS_SOCKET_H
5
 #include <sys/socket.h>
6
 #endif
7
-#if HAVE_DMALLOC_H
8
-#include <dmalloc.h>
9
-#endif
10
11
 #include <net-snmp/net-snmp-includes.h>
12
 #include <net-snmp/agent/net-snmp-agent-includes.h>
(-)/usr/ports/net-mgmt/net-snmp/files/patch-oid_stash.c (-13 lines)
Lines 1-13 Link Here
1
--- snmplib/oid_stash.c.orig	Mon Jan 24 09:43:04 2005
2
+++ snmplib/oid_stash.c	Mon Jan 24 09:43:14 2005
3
@@ -5,10 +5,6 @@
4
 #include <stdlib.h>
5
 #include <sys/types.h>
6
7
-#if HAVE_DMALLOC_H
8
-#include <dmalloc.h>
9
-#endif
10
-
11
 #include <net-snmp/net-snmp-includes.h>
12
13
 /** @defgroup oid_stash Store and retrieve data referenced by an OID.
(-)/usr/ports/net-mgmt/net-snmp/files/patch-snmpUDPDomain.c (-11 lines)
Lines 1-11 Link Here
1
--- snmplib/snmpUDPDomain.c.orig	Mon Jan 24 10:47:16 2005
2
+++ snmplib/snmpUDPDomain.c	Mon Jan 24 10:47:41 2005
3
@@ -88,7 +88,7 @@
4
     } else {
5
 	char tmp[64];
6
7
-        sprintf(tmp, "UDP: [%s]:%hd",
8
+        sprintf(tmp, "UDP: [%s]:%hu",
9
                 inet_ntoa(to->sin_addr), ntohs(to->sin_port));
10
         return strdup(tmp);
11
     }
(-)/usr/ports/net-mgmt/net-snmp/files/patch-snmp_vars.c (-13 lines)
Lines 1-13 Link Here
1
--- agent/snmp_vars.c.orig	Mon Jan 24 09:12:09 2005
2
+++ agent/snmp_vars.c	Mon Jan 24 09:12:23 2005
3
@@ -136,10 +136,6 @@
4
 #include <inet/mib2.h>
5
 #endif
6
7
-#if HAVE_DMALLOC_H
8
-#include <dmalloc.h>
9
-#endif
10
-
11
 #include <net-snmp/net-snmp-includes.h>
12
 #include <net-snmp/agent/net-snmp-agent-includes.h>
13
 #include <net-snmp/agent/mib_modules.h>
(-)/usr/ports/net-mgmt/net-snmp/files/patch-snmpd.8.def (-4 / +3 lines)
Lines 1-13 Link Here
1
 --- man/snmpd.8.def.orig	Wed Feb 26 04:11:19 2003
1
 --- man/snmpd.8.def.orig	Wed Feb 26 04:11:19 2003
2
 +++ man/snmpd.8.def	Sat Mar 29 22:05:07 2003
2
 +++ man/snmpd.8.def	Sat Mar 29 22:05:07 2003
3
@@ -211,6 +211,10 @@
3
@@ -233,6 +233,9 @@
4
  the error "Error opening specified endpoint".  Likewise, since AAL5
4
  the error "Error opening specified endpoint".  Likewise, since AAL5
5
  PVC support is only currently available on Linux, it will fail with
5
  PVC support is only currently available on Linux, it will fail with
6
  the same error on other platforms.
6
  the same error on other platforms.
7
 +.PP
7
 +.PP
8
+.B snmpd
9
 +uses libwrap's access control if configured by --with-libwrap.
8
 +uses libwrap's access control if configured by --with-libwrap.
10
 +Access control patterns may only reference IP addresses.
9
 +Access control patterns may only reference IP addresses.
11
12
 .RE
13
  .SH CONFIGURATION FILES
10
  .SH CONFIGURATION FILES
11
 .PP
12
 .B snmpd
(-)/usr/ports/net-mgmt/net-snmp/files/patch-subagent.c (-13 lines)
Lines 1-13 Link Here
1
--- agent/mibgroup/agentx/subagent.c.orig	Mon Jan 24 09:17:08 2005
2
+++ agent/mibgroup/agentx/subagent.c	Mon Jan 24 09:17:12 2005
3
@@ -36,10 +36,6 @@
4
 #include <netinet/in.h>
5
 #endif
6
7
-#if HAVE_DMALLOC_H
8
-#include <dmalloc.h>
9
-#endif
10
-
11
 #include <net-snmp/net-snmp-includes.h>
12
 #include <net-snmp/agent/net-snmp-agent-includes.h>
13
 #include <net-snmp/library/snmp_assert.h>
(-)/usr/ports/net-mgmt/net-snmp/files/patch-sysORTable.c (-13 lines)
Lines 1-13 Link Here
1
--- agent/mibgroup/mibII/sysORTable.c.orig	Mon Jan 24 08:27:58 2005
2
+++ agent/mibgroup/mibII/sysORTable.c	Mon Jan 24 08:28:10 2005
3
@@ -34,10 +34,6 @@
4
 #include <netinet/in.h>
5
 #endif
6
7
-#if HAVE_DMALLOC_H
8
-#include <dmalloc.h>
9
-#endif
10
-
11
 #include <net-snmp/net-snmp-includes.h>
12
 #include <net-snmp/agent/net-snmp-agent-includes.h>
13
 #include <net-snmp/agent/agent_callbacks.h>
(-)/usr/ports/net-mgmt/net-snmp/files/patch-ucd_snmp.h (-11 lines)
Lines 1-11 Link Here
1
--- agent/mibgroup/ucd_snmp.h.orig	Mon Oct 25 21:36:55 2004
2
+++ agent/mibgroup/ucd_snmp.h	Mon Oct 25 21:37:20 2004
3
@@ -39,6 +39,8 @@
4
 config_arch_require(freebsd4, ucd-snmp/memory_freebsd2)
5
 config_arch_require(freebsd5, ucd-snmp/vmstat_freebsd2)
6
 config_arch_require(freebsd5, ucd-snmp/memory_freebsd2)
7
+config_arch_require(freebsd6, ucd-snmp/vmstat_freebsd2)
8
+config_arch_require(freebsd6, ucd-snmp/memory_freebsd2)
9
 config_arch_require(netbsd1, ucd-snmp/vmstat_netbsd1)
10
 config_arch_require(netbsd1, ucd-snmp/memory_netbsd1)
11
 config_arch_require(openbsd2, ucd-snmp/vmstat_netbsd1)

Return to bug 97673