diff options
author | kuriyama <kuriyama@FreeBSD.org> | 2004-08-11 10:31:33 +0800 |
---|---|---|
committer | kuriyama <kuriyama@FreeBSD.org> | 2004-08-11 10:31:33 +0800 |
commit | 7877eac7e2b3db6a1e229fa6df3d2fb8514eb16d (patch) | |
tree | b6f6bdbbf21c16957285e44a7aba0e2be669ed29 /net-mgmt/net-snmp-devel | |
parent | 31aef0495c7aeaeb2d003443eedcc754696d3850 (diff) | |
download | freebsd-ports-graphics-7877eac7e2b3db6a1e229fa6df3d2fb8514eb16d.tar.gz freebsd-ports-graphics-7877eac7e2b3db6a1e229fa6df3d2fb8514eb16d.tar.zst freebsd-ports-graphics-7877eac7e2b3db6a1e229fa6df3d2fb8514eb16d.zip |
- Upgrade to 5.1.2.
Numerous patches are integrated into this release.
Diffstat (limited to 'net-mgmt/net-snmp-devel')
-rw-r--r-- | net-mgmt/net-snmp-devel/Makefile | 10 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/distinfo | 4 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-aa | 13 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-auto_nlist.c | 10 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-diskio.c | 56 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-freebsd.h | 11 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-freebsd5.h | 22 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-hr_storage.c | 44 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-hr_swrun.c | 91 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-ipv6.c | 640 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-local:snmpconf | 75 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-memory_freebsd2.c | 37 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-tcpTable.c | 38 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-udpTable.c | 25 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/files/patch-vmstat_freebsd2.c | 14 | ||||
-rw-r--r-- | net-mgmt/net-snmp-devel/pkg-plist | 1 |
16 files changed, 659 insertions, 432 deletions
diff --git a/net-mgmt/net-snmp-devel/Makefile b/net-mgmt/net-snmp-devel/Makefile index f465998d3fc..787b9d8872d 100644 --- a/net-mgmt/net-snmp-devel/Makefile +++ b/net-mgmt/net-snmp-devel/Makefile @@ -6,8 +6,7 @@ # PORTNAME= snmp -PORTVERSION= 5.1.1 -PORTREVISION= 6 +PORTVERSION= 5.1.2 PKGNAMEPREFIX= net- CATEGORIES= net-mgmt ipv6 MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} @@ -127,7 +126,7 @@ MAN3= add_mibdir.3 add_module_replacement.3 default_store.3 \ netsnmp_old_api.3 netsnmp_read_only.3 netsnmp_scalar.3 \ netsnmp_serialize.3 netsnmp_table.3 netsnmp_table_array.3 \ netsnmp_table_data.3 netsnmp_table_dataset.3 \ - netsnmp_table_iterator.3 netsnmp_todo.3 netsnmp_watcher.3 \ + netsnmp_table_iterator.3 netsnmp_watcher.3 \ print_description.3 print_mib.3 print_objid.3 print_value.3 \ print_variable.3 read_all_mibs.3 read_config.3 read_mib.3 \ read_module.3 read_module_node.3 read_objid.3 shutdown_mib.3 \ @@ -142,9 +141,10 @@ MAN3= add_mibdir.3 add_module_replacement.3 default_store.3 \ snmp_sess_send.3 snmp_sess_session.3 snmp_sess_timeout.3 \ snmp_set_mib_warnings.3 snmp_set_save_descriptions.3 \ snmp_timeout.3 snmp_trap_api.3 \ - netsnmp_Container_iterator.3 netsnmp_baby_steps.3 \ + netsnmp_Container_iterator.3 \ + netsnmp_asn1_packet_parse.3 netsnmp_baby_steps.3 \ netsnmp_cache_handler.3 netsnmp_container.3 \ - netsnmp_deprecated.3 netsnmp_iterator_info_s.3 \ + netsnmp_iterator_info_s.3 \ netsnmp_leaf.3 \ netsnmp_row_merge.3 netsnmp_scalar_group_group.3 \ netsnmp_stash_cache.3 netsnmp_utilities.3 diff --git a/net-mgmt/net-snmp-devel/distinfo b/net-mgmt/net-snmp-devel/distinfo index f584b2ca28e..fbf680fd923 100644 --- a/net-mgmt/net-snmp-devel/distinfo +++ b/net-mgmt/net-snmp-devel/distinfo @@ -1,2 +1,2 @@ -MD5 (net-snmp-5.1.1.tar.gz) = 68f6c946387718e4f300cbb8b6c4bd43 -SIZE (net-snmp-5.1.1.tar.gz) = 2977122 +MD5 (net-snmp-5.1.2.tar.gz) = 8080555ab3f90011f25d5122042d9a8d +SIZE (net-snmp-5.1.2.tar.gz) = 3253579 diff --git a/net-mgmt/net-snmp-devel/files/patch-aa b/net-mgmt/net-snmp-devel/files/patch-aa deleted file mode 100644 index 4d371fdbd56..00000000000 --- a/net-mgmt/net-snmp-devel/files/patch-aa +++ /dev/null @@ -1,13 +0,0 @@ ---- snmplib/Makefile.in.orig Wed Jul 17 02:50:49 2002 -+++ snmplib/Makefile.in Mon Jul 22 12:24:37 2002 -@@ -140,6 +140,10 @@ - - libsnmp.$(LIB_EXTENSION)$(LIB_VERSION): ${TOBJS} - $(LIB_LD_CMD) libsnmp.$(LIB_EXTENSION)$(LIB_VERSION) ${TOBJS} -+ ld -Bshareable -soname libsnmp.so.4 \ -+ -o libsnmp.so ${OBJS} -+ ln -f libsnmp.so \ -+ ../libsnmp.so.4 - $(RANLIB) libsnmp.$(LIB_EXTENSION)$(LIB_VERSION) - - #how to build dependencies diff --git a/net-mgmt/net-snmp-devel/files/patch-auto_nlist.c b/net-mgmt/net-snmp-devel/files/patch-auto_nlist.c deleted file mode 100644 index 79feff8f64e..00000000000 --- a/net-mgmt/net-snmp-devel/files/patch-auto_nlist.c +++ /dev/null @@ -1,10 +0,0 @@ ---- agent/auto_nlist.c.orig Sun Feb 29 21:24:25 2004 -+++ agent/auto_nlist.c Sun Feb 29 21:24:43 2004 -@@ -57,6 +57,7 @@ - } - if (*ptr == 0) { - *ptr = (struct autonlist *) malloc(sizeof(struct autonlist)); -+ memset(*ptr, 0, sizeof(struct autonlist)); - it = *ptr; - it->left = 0; - it->right = 0; diff --git a/net-mgmt/net-snmp-devel/files/patch-diskio.c b/net-mgmt/net-snmp-devel/files/patch-diskio.c deleted file mode 100644 index 609168f22e9..00000000000 --- a/net-mgmt/net-snmp-devel/files/patch-diskio.c +++ /dev/null @@ -1,56 +0,0 @@ ---- agent/mibgroup/ucd-snmp/diskio.c.orig Thu Mar 6 07:55:01 2003 -+++ agent/mibgroup/ucd-snmp/diskio.c Sat Mar 29 22:41:29 2003 -@@ -49,7 +49,12 @@ - #endif /* bsdi */ - - #if defined (freebsd4) || defined(freebsd5) -+#include <sys/param.h> -+#if __FreeBSD_version >= 500101 -+#include <sys/resource.h> -+#else - #include <sys/dkstat.h> -+#endif - #include <devstat.h> - #endif /* freebsd */ - -@@ -380,7 +385,11 @@ - } - memset(stat->dinfo, 0, sizeof(struct devinfo)); - -+#if defined(freebsd5) && (__FreeBSD_version >= 500107) -+ if ((devstat_getdevs(NULL, stat)) == -1) { -+#else - if ((getdevs(stat)) == -1) { -+#endif - fprintf(stderr, "Can't get devices:%s\n", devstat_errbuf); - return 1; - } -@@ -429,6 +438,20 @@ - case DISKIO_DEVICE: - *var_len = strlen(stat->dinfo->devices[indx].device_name); - return (u_char *) stat->dinfo->devices[indx].device_name; -+#if defined(freebsd5) && (__FreeBSD_version >= 500107) -+ case DISKIO_NREAD: -+ long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_READ]; -+ return (u_char *) & long_ret; -+ case DISKIO_NWRITTEN: -+ long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_WRITE]; -+ return (u_char *) & long_ret; -+ case DISKIO_READS: -+ long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_READ]; -+ return (u_char *) & long_ret; -+ case DISKIO_WRITES: -+ long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_WRITE]; -+ return (u_char *) & long_ret; -+#else - case DISKIO_NREAD: - long_ret = (signed long) stat->dinfo->devices[indx].bytes_read; - return (u_char *) & long_ret; -@@ -441,6 +464,7 @@ - case DISKIO_WRITES: - long_ret = (signed long) stat->dinfo->devices[indx].num_writes; - return (u_char *) & long_ret; -+#endif - - default: - ERROR_MSG("diskio.c: don't know how to handle this request."); diff --git a/net-mgmt/net-snmp-devel/files/patch-freebsd.h b/net-mgmt/net-snmp-devel/files/patch-freebsd.h deleted file mode 100644 index c445b0abeb5..00000000000 --- a/net-mgmt/net-snmp-devel/files/patch-freebsd.h +++ /dev/null @@ -1,11 +0,0 @@ ---- include/net-snmp/system/freebsd.h.orig Sat Apr 3 14:56:45 2004 -+++ include/net-snmp/system/freebsd.h Sat Apr 3 14:56:59 2004 -@@ -6,7 +6,7 @@ - * udp_inpcb list symbol - */ - #undef INP_NEXT_SYMBOL --#define INP_NEXT_SYMBOL inp_next -+#define INP_NEXT_SYMBOL inp_list.le_next - - #undef TCP_TTL_SYMBOL - #define TCP_TTL_SYMBOL "ip_defttl" diff --git a/net-mgmt/net-snmp-devel/files/patch-freebsd5.h b/net-mgmt/net-snmp-devel/files/patch-freebsd5.h deleted file mode 100644 index 697589ec48b..00000000000 --- a/net-mgmt/net-snmp-devel/files/patch-freebsd5.h +++ /dev/null @@ -1,22 +0,0 @@ ---- /dev/null Sat Aug 16 16:33:01 2003 -+++ include/net-snmp/system/freebsd5.h Sat Aug 16 16:42:08 2003 -@@ -0,0 +1,19 @@ -+#include "freebsd.h" -+ -+/* -+ * freebsd4 is a superset of freebsd2 and freebsd3 -+ */ -+#define freebsd2 1 -+#define freebsd3 1 -+#define freebsd4 1 -+ -+#undef IFADDR_SYMBOL -+#define IFADDR_SYMBOL "in_ifaddrhead" -+ -+#undef PROC_SYMBOL -+#define PROC_SYMBOL "allproc" -+ -+#undef NPROC_SYMBOL -+#define NPROC_SYMBOL "nprocs" -+ -+#undef TOTAL_MEMORY_SYMBOL diff --git a/net-mgmt/net-snmp-devel/files/patch-hr_storage.c b/net-mgmt/net-snmp-devel/files/patch-hr_storage.c index df54986a93f..b8185f23c26 100644 --- a/net-mgmt/net-snmp-devel/files/patch-hr_storage.c +++ b/net-mgmt/net-snmp-devel/files/patch-hr_storage.c @@ -1,15 +1,6 @@ ---- agent/mibgroup/host/hr_storage.c.orig Thu Jan 29 22:53:59 2004 -+++ agent/mibgroup/host/hr_storage.c Wed Jun 23 11:50:55 2004 -@@ -148,7 +148,7 @@ - #define HRFS_mount mnt_mountp - #define HRFS_statfs statvfs - --#elif defined(HAVE_STATVFS) -+#elif defined(HAVE_STATVFS) && defined(HAVE_MNTENT) - - extern struct mntent *HRFS_entry; - extern int fscount; -@@ -193,6 +193,10 @@ +--- agent/mibgroup/host/hr_storage.c.orig Sat Jun 19 03:39:14 2004 ++++ agent/mibgroup/host/hr_storage.c Mon Jul 5 16:38:55 2004 +@@ -212,6 +212,10 @@ void sol_get_swapinfo(int *, int *); #endif @@ -20,7 +11,7 @@ #define HRSTORE_MEMSIZE 1 #define HRSTORE_INDEX 2 #define HRSTORE_TYPE 3 -@@ -431,7 +435,8 @@ +@@ -450,7 +454,8 @@ NULL, "Memory Buffers", /* HRS_TYPE_MBUF */ "Real Memory", /* HRS_TYPE_MEM */ @@ -30,7 +21,7 @@ }; -@@ -546,6 +551,7 @@ +@@ -565,6 +570,7 @@ storage_type_id[storage_type_len - 1] = 3; /* Virtual Mem */ break; case HRS_TYPE_MBUF: @@ -38,16 +29,7 @@ storage_type_id[storage_type_len - 1] = 1; /* Other */ break; default: -@@ -567,7 +573,7 @@ - } - case HRSTORE_UNITS: - if (store_idx > HRS_TYPE_FIXED_MAX) --#if STRUCT_STATVFS_HAS_F_FRSIZE -+#if defined(STRUCT_STATVFS_HAS_F_FRSIZE) && defined(HAVE_MNTENT) - long_return = stat_buf.f_frsize; - #else - long_return = stat_buf.f_bsize; -@@ -631,7 +637,7 @@ +@@ -650,7 +656,7 @@ case HRS_TYPE_SWAP: long_return = memory_totals.t_vm; break; @@ -56,7 +38,7 @@ case HRS_TYPE_MEM: long_return = physmem; break; -@@ -641,6 +647,8 @@ +@@ -660,6 +666,8 @@ #endif long_return = 0; break; @@ -65,7 +47,7 @@ case HRS_TYPE_MBUF: #if HAVE_SYS_POOL_H long_return = 0; -@@ -650,7 +658,26 @@ +@@ -669,7 +677,26 @@ i++) long_return += mbstat.m_mtypes[i]; #elif defined(MBSTAT_SYMBOL) @@ -92,7 +74,7 @@ #elif defined(NO_DUMMY_VALUES) goto try_next; #else -@@ -658,6 +685,18 @@ +@@ -677,6 +704,18 @@ #endif break; #endif /* !linux && !solaris2 && !hpux10 && !hpux11 && ... */ @@ -111,7 +93,7 @@ default: #if NO_DUMMY_VALUES goto try_next; -@@ -708,7 +747,18 @@ +@@ -727,7 +766,18 @@ * mbpool.pr_size + (mclpool.pr_nget - mclpool.pr_nput) * mclpool.pr_size; #elif defined(MBSTAT_SYMBOL) @@ -130,7 +112,7 @@ #elif defined(NO_DUMMY_VALUES) goto try_next; #else -@@ -716,6 +766,11 @@ +@@ -735,6 +785,11 @@ #endif break; #endif /* !linux && !solaris2 && !hpux10 && !hpux11 && ... */ @@ -142,7 +124,7 @@ default: #if NO_DUMMY_VALUES goto try_next; -@@ -742,7 +797,11 @@ +@@ -761,7 +816,11 @@ break; #if !defined(linux) && !defined(solaris2) && !defined(hpux10) && !defined(hpux11) && defined(MBSTAT_SYMBOL) case HRS_TYPE_MBUF: @@ -154,7 +136,7 @@ break; #endif /* !linux && !solaris2 && !hpux10 && !hpux11 && MBSTAT_SYMBOL */ default: -@@ -853,3 +912,97 @@ +@@ -872,3 +931,97 @@ *usedP = ainfo.ani_resv; } #endif /* solaris2 */ diff --git a/net-mgmt/net-snmp-devel/files/patch-hr_swrun.c b/net-mgmt/net-snmp-devel/files/patch-hr_swrun.c index 5ff95f18ca7..3bd1e7800e7 100644 --- a/net-mgmt/net-snmp-devel/files/patch-hr_swrun.c +++ b/net-mgmt/net-snmp-devel/files/patch-hr_swrun.c @@ -1,60 +1,48 @@ ---- agent/mibgroup/host/hr_swrun.c.orig Fri Dec 20 00:07:30 2002 -+++ agent/mibgroup/host/hr_swrun.c Sat Aug 16 17:10:54 2003 -@@ -561,7 +561,11 @@ +--- agent/mibgroup/host/hr_swrun.c.orig Wed Jun 9 05:56:03 2004 ++++ agent/mibgroup/host/hr_swrun.c Fri Jun 25 10:56:38 2004 +@@ -585,7 +585,7 @@ string[ sizeof(string)-1 ] = 0; #endif #elif HAVE_KVM_GETPROCS -+#if defined(freebsd5) && __FreeBSD_version >= 500014 -+ strcpy(string, proc_table[LowProcIndex].ki_comm); -+#else +- #if defined(freebsd5) ++ #if defined(freebsd5) && __FreeBSD_version >= 500014 + strcpy(string, proc_table[LowProcIndex].ki_comm); + #else strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm); -+#endif - #elif defined(linux) - sprintf(string, "/proc/%d/status", pid); - if ((fp = fopen(string, "r")) == NULL) -@@ -666,7 +670,11 @@ +@@ -694,7 +694,7 @@ *cp1 = 0; #endif #elif HAVE_KVM_GETPROCS -+#if defined(freebsd5) && __FreeBSD_version >= 500014 -+ strcpy(string, proc_table[LowProcIndex].ki_comm); -+#else +- #if defined(freebsd5) ++ #if defined(freebsd5) && __FreeBSD_version >= 500014 + strcpy(string, proc_table[LowProcIndex].ki_comm); + #else strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm); -+#endif - #elif defined(linux) - sprintf(string, "/proc/%d/cmdline", pid); - if ((fp = fopen(string, "r")) == NULL) -@@ -857,7 +865,11 @@ +@@ -889,7 +889,7 @@ } #else #if HAVE_KVM_GETPROCS -+#if defined(freebsd5) && __FreeBSD_version >= 500014 -+ switch ( proc_table[LowProcIndex].ki_stat ) { -+#else +- #if defined(freebsd5) ++ #if defined(freebsd5) && __FreeBSD_version >= 500014 + switch (proc_table[LowProcIndex].ki_stat) { + #else switch (proc_table[LowProcIndex].kp_proc.p_stat) { -+#endif - #elif defined(dynix) - switch (lowpsinfo.pr_state) { - #elif defined(solaris2) -@@ -952,9 +964,17 @@ +@@ -988,7 +988,13 @@ long_return = proc_buf->p_utime * 100 + proc_buf->p_stime * 100; #endif #elif HAVE_KVM_GETPROCS -+#if defined(freebsd5) && __FreeBSD_version >= 500014 -+ /* XXX: Accessing ki_paddr causes sig10 ... -+ long_return = proc_table[LowProcIndex].ki_paddr->p_uticks + -+ proc_table[LowProcIndex].ki_paddr->p_sticks + -+ proc_table[LowProcIndex].ki_paddr->p_iticks; */ -+ long_return = 0; -+#else +- #if defined(freebsd5) ++ #if defined(freebsd5) && __FreeBSD_version >= 500014 ++ /* XXX: Accessing ki_paddr causes sig10 ... ++ long_return = proc_table[LowProcIndex].ki_paddr->p_uticks + ++ proc_table[LowProcIndex].ki_paddr->p_sticks + ++ proc_table[LowProcIndex].ki_paddr->p_iticks; */ ++ long_return = 0; ++ #elif defined(freebsd5) + long_return = proc_table[LowProcIndex].ki_runtime / 100000; + #else long_return = proc_table[LowProcIndex].kp_proc.p_uticks + - proc_table[LowProcIndex].kp_proc.p_sticks + - proc_table[LowProcIndex].kp_proc.p_iticks; -+#endif - #elif defined(linux) - sprintf(string, "/proc/%d/stat", pid); - if ((fp = fopen(string, "r")) == NULL) -@@ -1023,7 +1043,14 @@ +@@ -1063,7 +1069,14 @@ long_return = proc_buf->p_swrss; #endif #elif HAVE_KVM_GETPROCS @@ -68,19 +56,14 @@ + long_return = 0; +#elif defined(freebsd3) && !defined(darwin) long_return = - proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024; - #else -@@ -1303,8 +1330,13 @@ + #if defined(freebsd5) + proc_table[LowProcIndex].ki_size / 1024; +@@ -1349,7 +1362,7 @@ #elif defined(solaris2) return proc_table[current_proc_entry++]; #elif HAVE_KVM_GETPROCS -+#if defined(freebsd5) && __FreeBSD_version >= 500014 -+ if ( proc_table[current_proc_entry].ki_stat != 0 ) -+ return proc_table[current_proc_entry++].ki_pid; -+#else - if (proc_table[current_proc_entry].kp_proc.p_stat != 0) - return proc_table[current_proc_entry++].kp_proc.p_pid; -+#endif - #else - if (proc_table[current_proc_entry].p_stat != 0) - return proc_table[current_proc_entry++].p_pid; +- #if defined(freebsd5) ++ #if defined(freebsd5) && __FreeBSD_version >= 500014 + if (proc_table[current_proc_entry].ki_stat != 0) + return proc_table[current_proc_entry++].ki_pid; + #else diff --git a/net-mgmt/net-snmp-devel/files/patch-ipv6.c b/net-mgmt/net-snmp-devel/files/patch-ipv6.c index 0ee3f76c99a..81e4807403c 100644 --- a/net-mgmt/net-snmp-devel/files/patch-ipv6.c +++ b/net-mgmt/net-snmp-devel/files/patch-ipv6.c @@ -1,113 +1,605 @@ ---- agent/mibgroup/mibII/ipv6.c.orig Fri Feb 28 18:13:36 2003 -+++ agent/mibgroup/mibII/ipv6.c Wed Nov 19 00:16:27 2003 -@@ -1238,6 +1238,7 @@ +--- agent/mibgroup/mibII/ipv6.c.orig Wed Jun 30 22:35:24 2004 ++++ agent/mibgroup/mibII/ipv6.c Mon Jul 5 18:31:11 2004 +@@ -8,10 +8,22 @@ + #define _KERNEL 1 + #define _I_DEFINED_KERNEL + #endif ++ ++/* make this source a wee bit more readable */ ++#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ ++#define OS_NET_BSD_16_OR_LATER 1 ++#endif ++#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin) ++#define OS_NOT_FREEBSD_NOR_DARWIN 1 ++#endif ++#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) ++#define OS_FREEBSD_OR_DARWIN 1 ++#endif ++ + #include <sys/types.h> + #include <sys/param.h> + #include <sys/socket.h> +-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) ++#if OS_FREEBSD_OR_DARWIN + # if HAVE_SYS_SOCKETVAR_H + # include <sys/socketvar.h> + # endif +@@ -80,7 +92,7 @@ + # include <netinet6/ip6_var.h> + #endif + #include <net/route.h> +-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) ++#if OS_FREEBSD_OR_DARWIN + # if HAVE_NETINET_IN_PCB_H + # include <netinet/in_pcb.h> + # endif +@@ -575,7 +587,7 @@ + memcpy(result, &tmp, sizeof(tmp)); + return 0; + } +-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) ++#if OS_FREEBSD_OR_DARWIN + q = (caddr_t) TAILQ_NEXT(&tmp, if_link); + #else + # if defined(__NetBSD__) || defined(__OpenBSD__) +@@ -806,7 +818,7 @@ + + if (if_getifnet(interface, &ifnet) < 0) + break; +-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) ++#if OS_FREEBSD_OR_DARWIN + ifa = (caddr_t) TAILQ_FIRST(&ifnet.if_addrhead); + #else + # if defined(__NetBSD__) || defined(__OpenBSD__) +@@ -827,7 +839,7 @@ + *var_len = sdl.sdl_alen; + return (u_char *) (sdl.sdl_data + sdl.sdl_nlen); + } +-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) ++#if OS_FREEBSD_OR_DARWIN + ifa = (caddr_t) TAILQ_NEXT(&ifaddr, ifa_link); + #else + # if defined(__NetBSD__) || defined(__OpenBSD__) +@@ -1220,32 +1232,33 @@ + size_t * length, + int exact, size_t * var_len, WriteMethod ** write_method) + { +- oid newname[MAX_OID_LEN]; +- oid savname[MAX_OID_LEN]; ++ oid newname[MAX_OID_LEN], savname[MAX_OID_LEN]; + int result; + int i, j; + caddr_t p; +- static struct in6pcb in6pcb, savpcb; ++ static struct in6pcb tstpcb, savpcb; + int found, savnameLen; +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ ++#if OS_NOT_FREEBSD_NOR_DARWIN ++ static struct in6pcb udb6; ++#endif ++#if OS_NET_BSD_16_OR_LATER + struct inpcbtable udbtable; + caddr_t first; +-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) ++#endif ++#if OS_FREEBSD_OR_DARWIN + char *sysctl_buf; + struct xinpgen *xig, *oxig; +-#else +- static struct in6pcb udb6; + #endif + + DEBUGMSGTL(("mibII/ipv6", "var_udp6: ")); + DEBUGMSGOID(("mibII/ipv6", name, *length)); + DEBUGMSG(("mibII/ipv6", " %d\n", exact)); + +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ ++#if OS_NET_BSD_16_OR_LATER + if (!auto_nlist("udbtable", (char *) &udbtable, sizeof(udbtable))) + return NULL; + first = p = (caddr_t)udbtable.inpt_queue.cqh_first; +-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin) ++#elif OS_NOT_FREEBSD_NOR_DARWIN if (!auto_nlist("udb6", (char *) &udb6, sizeof(udb6))) return NULL; p = (caddr_t) udb6.in6p_next; -+ DEBUGMSGTL(("mibII/ipv6", "start: p=%x\n", p)); - #else - { - const char *udblist = "net.inet.udp.pcblist"; -@@ -1254,11 +1255,11 @@ - oxig = (struct xinpgen *) sysctl_buf; - xig = (struct xinpgen *) ((char *) oxig + oxig->xig_len); - } -+ DEBUGMSGTL(("mibII/ipv6", "start: xig=%p\n", xig)); - #endif - found = hitnext = 0; - memcpy((char *) newname, (char *) vp->name, +@@ -1274,41 +1287,44 @@ (int) vp->namelen * sizeof(oid)); -- DEBUGMSGTL(("mibII/ipv6", "start: p=%x\n", p)); + DEBUGMSGTL(("mibII/ipv6", "start: p=%x\n", p)); while ( - #if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ ++#if OS_NET_BSD_16_OR_LATER + p && p != first +-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin) ++#elif OS_NOT_FREEBSD_NOR_DARWIN p && (u_long) p != auto_nlist_value("udb6") -@@ -1266,12 +1267,16 @@ + #else xig->xig_len > sizeof(struct xinpgen) #endif ++ ) { -- DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p)); + DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p)); - #if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) -+ DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p)); - klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb)); +-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin) +- if (klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb)) < 0) { ++#if OS_NOT_FREEBSD_NOR_DARWIN ++ if (klookup((u_long) p, (char *) &tstpcb, sizeof(tstpcb)) < 0) { + DEBUGMSGTL(("mibII/ipv6", "klookup fail for udb6 at %x\n", + p)); + found = 0; + break; + } #else - in6pcb = ((struct xinpcb *) xig)->xi_inp; -+ if (!(in6pcb.inp_vflag & 0x02)) { /* Skip non-IPv6 pcb */ -+ xig = (struct xinpgen *) ((char *) xig + xig->xig_len); -+ continue; -+ } +- in6pcb = ((struct xinpcb *) xig)->xi_inp; ++ tstpcb = ((struct xinpcb *) xig)->xi_inp; #endif +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ +- if (in6pcb.in6p_af != AF_INET6) ++#if OS_NET_BSD_16_OR_LATER ++ if (tstpcb.in6p_af != AF_INET6) { ++ p = (caddr_t)tstpcb.in6p_queue.cqe_next; + goto skip; +-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) +- if (0 == (in6pcb.inp_vflag & INP_IPV6)) ++ } ++#elif OS_FREEBSD_OR_DARWIN ++ if (0 == (tstpcb.inp_vflag & INP_IPV6PROTO)) + goto skip; + #endif + j = (int) vp->namelen; for (i = 0; i < sizeof(struct in6_addr); i++) -@@ -1283,8 +1288,8 @@ +- newname[j++] = in6pcb.in6p_laddr.s6_addr[i]; +- newname[j++] = ntohs(in6pcb.in6p_lport); +- if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr)) ++ newname[j++] = tstpcb.in6p_laddr.s6_addr[i]; ++ newname[j++] = ntohs(tstpcb.in6p_lport); ++ if (IN6_IS_ADDR_LINKLOCAL(&tstpcb.in6p_laddr)) + newname[j++] = +- ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]); ++ ntohs(*(u_int16_t *) & tstpcb.in6p_laddr.s6_addr[2]); else newname[j++] = 0; /*XXX*/ -- DEBUGMSGTL(("mibII/ipv6", "var_udp6 new: %d %d ", -- (int) vp->namelen, j)); -+ DEBUGMSGTL(("mibII/ipv6", "var_udp6 new: %d %d ", -+ (int) vp->namelen, j)); - DEBUGMSGOID(("mibII/ipv6", newname, j)); - DEBUGMSG(("mibII/ipv6", " %d\n", exact)); +@@ -1319,7 +1335,7 @@ + + result = snmp_oid_compare(name, *length, newname, j); + if (exact && (result == 0)) { +- memcpy(&savpcb, &in6pcb, sizeof(savpcb)); ++ memcpy(&savpcb, &tstpcb, sizeof(savpcb)); + savnameLen = j; + memcpy(savname, newname, j * sizeof(oid)); + found++; +@@ -1330,7 +1346,7 @@ + */ + if ((savnameLen == 0) || + (snmp_oid_compare(savname, savnameLen, newname, j) > 0)) { +- memcpy(&savpcb, &in6pcb, sizeof(savpcb)); ++ memcpy(&savpcb, &tstpcb, sizeof(savpcb)); + savnameLen = j; + memcpy(savname, newname, j * sizeof(oid)); + found++; +@@ -1338,15 +1354,15 @@ + } + + skip: +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ +- p = (caddr_t)in6pcb.in6p_queue.cqe_next; +-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin) +- p = (caddr_t) in6pcb.in6p_next; ++#if OS_NET_BSD_16_OR_LATER ++ p = (caddr_t)tstpcb.in6p_queue.cqe_next; ++#elif OS_NOT_FREEBSD_NOR_DARWIN ++ p = (caddr_t) tstpcb.in6p_next; + #else + xig = (struct xinpgen *) ((char *) xig + xig->xig_len); + #endif + } +-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) ++#if OS_FREEBSD_OR_DARWIN + free(sysctl_buf); + #endif + DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found)); +@@ -1354,7 +1370,7 @@ + return NULL; + *length = savnameLen; + memcpy((char *) name, (char *) savname, *length * sizeof(oid)); +- memcpy(&in6pcb, &savpcb, sizeof(savpcb)); ++ memcpy(&tstpcb, &savpcb, sizeof(savpcb)); + *write_method = 0; + *var_len = sizeof(long); /* default to 'long' results */ + +@@ -1367,14 +1383,14 @@ + switch (vp->magic) { + case IPV6UDPLOCALADDRESS: + *var_len = sizeof(struct in6_addr); +- return in6pcb.in6p_laddr.s6_addr; ++ return savpcb.in6p_laddr.s6_addr; + case IPV6UDPLOCALPORT: +- long_return = ntohs(in6pcb.in6p_lport); ++ long_return = ntohs(savpcb.in6p_lport); + return (u_char *) & long_return; + case IPV6UDPIFINDEX: +- if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr)) ++ if (IN6_IS_ADDR_LINKLOCAL(&savpcb.in6p_laddr)) + long_return = +- ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]); ++ ntohs(*(u_int16_t *) & savpcb.in6p_laddr.s6_addr[2]); + else + long_return = 0; + /*XXX*/ return (u_char *) & long_return; +@@ -1392,24 +1408,24 @@ + size_t * length, + int exact, size_t * var_len, WriteMethod ** write_method) + { +- oid newname[MAX_OID_LEN]; +- oid savname[MAX_OID_LEN]; ++ oid newname[MAX_OID_LEN], savname[MAX_OID_LEN]; + int result; + int i, j; + caddr_t p; +- static struct in6pcb in6pcb, savpcb; ++ static struct in6pcb tstpcb, savpcb; + struct tcp6cb tcp6cb; + int found, savnameLen; + static int tcp6statemap[TCP6_NSTATES]; + static int initialized = 0; +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ ++#if OS_NOT_FREEBSD_NOR_DARWIN ++ static struct in6pcb tcb6; ++#endif ++#if OS_NET_BSD_16_OR_LATER + struct inpcbtable tcbtable; + caddr_t first; +-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) ++#elif OS_FREEBSD_OR_DARWIN + char *sysctl_buf; + struct xinpgen *xig, *oxig; +-#else +- static struct in6pcb tcb6; + #endif -@@ -1447,9 +1452,6 @@ + if (!initialized) { +@@ -1431,11 +1447,11 @@ + DEBUGMSGOID(("mibII/ipv6", name, *length)); + DEBUGMSG(("mibII/ipv6", " %d\n", exact)); + +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ ++#if OS_NET_BSD_16_OR_LATER + if (!auto_nlist("tcbtable", (char *) &tcbtable, sizeof(tcbtable))) + return NULL; + first = p = (caddr_t)tcbtable.inpt_queue.cqh_first; +-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin) ++#elif OS_NOT_FREEBSD_NOR_DARWIN + if (!auto_nlist("tcb6", (char *) &tcb6, sizeof(tcb6))) + return NULL; + p = (caddr_t) tcb6.in6p_next; +@@ -1464,9 +1480,10 @@ + (int) vp->namelen * sizeof(oid)); + DEBUGMSGTL(("mibII/ipv6", "start: p=%x\n", p)); + while ( +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ ++#if OS_NET_BSD_16_OR_LATER + p && p != first +-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin) ++#elif OS_NOT_FREEBSD_NOR_DARWIN ++ + p && (u_long) p != auto_nlist_value("tcb6") + #else + xig->xig_len > sizeof(struct xinpgen) +@@ -1474,41 +1491,43 @@ + ) { + DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p)); + +-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin) +- if (klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb)) < 0) { ++#if OS_NOT_FREEBSD_NOR_DARWIN ++ if (klookup((u_long) p, (char *) &tstpcb, sizeof(tstpcb)) < 0) { + DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6 at %x\n", p)); + found = 0; break; } --#else + #else - in6pcb = ((struct xinpcb *) xig)->xi_inp; --#endif ++ tstpcb = ((struct xinpcb *) xig)->xi_inp; + #endif +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ +- if (in6pcb.in6p_af != AF_INET6) ++#if OS_NET_BSD_16_OR_LATER ++ if (tstpcb.in6p_af != AF_INET6) { ++ p = (caddr_t)tstpcb.in6p_queue.cqe_next; + goto skip; +-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) +- if (0 == (in6pcb.inp_vflag & INP_IPV6)) ++ } ++#elif OS_FREEBSD_OR_DARWIN ++ if (0 == (tstpcb.inp_vflag & INP_IPV6PROTO)) + goto skip; + #endif if (klookup - ((u_long) in6pcb.in6p_ppcb, (char *) &tcp6cb, sizeof(tcp6cb)) +- ((u_long) in6pcb.in6p_ppcb, (char *) &tcp6cb, sizeof(tcp6cb)) ++ ((u_long) tstpcb.in6p_ppcb, (char *) &tcp6cb, sizeof(tcp6cb)) < 0) { -@@ -1457,6 +1459,14 @@ - in6pcb.in6p_ppcb)); + DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6.tcp6cb at %x\n", +- in6pcb.in6p_ppcb)); ++ tstpcb.in6p_ppcb)); + found = 0; break; } -+#else -+ in6pcb = ((struct xinpcb *) xig)->xi_inp; -+ struct xtcpcb *xp = (struct xtcpcb *)xig; -+ tcp6cb = xp->xt_tp; -+ if (!(in6pcb.inp_vflag & 0x02)) { /* Skip non-IPv6 pcb */ -+ goto skip; -+ } -+#endif j = (int) vp->namelen; for (i = 0; i < sizeof(struct in6_addr); i++) - newname[j++] = in6pcb.in6p_laddr.s6_addr[i]; -@@ -1590,6 +1600,7 @@ - #if defined(__FreeBSD__) && __FreeBSD__ >= 3 +- newname[j++] = in6pcb.in6p_laddr.s6_addr[i]; +- newname[j++] = ntohs(in6pcb.in6p_lport); ++ newname[j++] = tstpcb.in6p_laddr.s6_addr[i]; ++ newname[j++] = ntohs(tstpcb.in6p_lport); + for (i = 0; i < sizeof(struct in6_addr); i++) +- newname[j++] = in6pcb.in6p_faddr.s6_addr[i]; +- newname[j++] = ntohs(in6pcb.in6p_fport); +- if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr)) ++ newname[j++] = tstpcb.in6p_faddr.s6_addr[i]; ++ newname[j++] = ntohs(tstpcb.in6p_fport); ++ if (IN6_IS_ADDR_LINKLOCAL(&tstpcb.in6p_laddr)) + newname[j++] = +- ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]); ++ ntohs(*(u_int16_t *) & tstpcb.in6p_laddr.s6_addr[2]); + else + newname[j++] = 0; + /*XXX*/ newname[j++] = tcp6statemap[tcp6cb.t_state]; +@@ -1519,13 +1538,13 @@ + DEBUGMSG(("mibII/ipv6", " %d\n", exact)); + + #if 1 /* this is very odd but sometimes happen, and cause infinite loop */ +- if (ntohs(in6pcb.in6p_lport) == 0) ++ if (ntohs(tstpcb.in6p_lport) == 0) + goto skip; + #endif + + result = snmp_oid_compare(name, *length, newname, j); + if (exact && (result == 0)) { +- memcpy(&savpcb, &in6pcb, sizeof(savpcb)); ++ memcpy(&savpcb, &tstpcb, sizeof(savpcb)); + savnameLen = j; + memcpy(savname, newname, j * sizeof(oid)); + found++; +@@ -1536,7 +1555,7 @@ + */ + if ((savnameLen == 0) || + (snmp_oid_compare(savname, savnameLen, newname, j) > 0)) { +- memcpy(&savpcb, &in6pcb, sizeof(savpcb)); ++ memcpy(&savpcb, &tstpcb, sizeof(savpcb)); + savnameLen = j; + memcpy(savname, newname, j * sizeof(oid)); + found++; +@@ -1544,15 +1563,15 @@ + } + + skip: +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ +- p = (caddr_t)in6pcb.in6p_queue.cqe_next; +-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin) +- p = (caddr_t) in6pcb.in6p_next; ++#if OS_NET_BSD_16_OR_LATER ++ p = (caddr_t)tstpcb.in6p_queue.cqe_next; ++#elif OS_NOT_FREEBSD_NOR_DARWIN ++ p = (caddr_t) tstpcb.in6p_next; + #else + xig = (struct xinpgen *) ((char *) xig + xig->xig_len); + #endif + } +-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) ++#if OS_FREEBSD_OR_DARWIN + free(sysctl_buf); + #endif + DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found)); +@@ -1573,20 +1592,20 @@ + switch (vp->magic) { + case IPV6TCPLOCALADDR: + *var_len = sizeof(struct in6_addr); +- return (u_char *) & in6pcb.in6p_laddr.s6_addr[0]; ++ return (u_char *) & savpcb.in6p_laddr.s6_addr[0]; + case IPV6TCPLOCALPORT: +- long_return = ntohs(in6pcb.in6p_lport); ++ long_return = ntohs(savpcb.in6p_lport); + return (u_char *) & long_return; + case IPV6TCPREMOTEADDR: + *var_len = sizeof(struct in6_addr); +- return (u_char *) & in6pcb.in6p_faddr.s6_addr[0]; ++ return (u_char *) & savpcb.in6p_faddr.s6_addr[0]; + case IPV6TCPREMOTEPORT: +- long_return = ntohs(in6pcb.in6p_fport); ++ long_return = ntohs(savpcb.in6p_fport); + return (u_char *) & long_return; + case IPV6TCPIFINDEX: +- if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr)) ++ if (IN6_IS_ADDR_LINKLOCAL(&savpcb.in6p_laddr)) + long_return = +- ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]); ++ ntohs(*(u_int16_t *) & savpcb.in6p_laddr.s6_addr[2]); + else + long_return = 0; + /*XXX*/ return (u_char *) & long_return; +@@ -1633,22 +1652,23 @@ + size_t * length, + int exact, size_t * var_len, WriteMethod ** write_method) + { +- oid newname[MAX_OID_LEN]; +- oid savname[MAX_OID_LEN]; ++ oid newname[MAX_OID_LEN], savname[MAX_OID_LEN]; + int result; + int i, j; + caddr_t p; +- static struct in6pcb in6pcb, savpcb; ++ static struct in6pcb tstpcb, savpcb; + struct tcpcb tcpcb; + int found, savnameLen; +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ ++#if OS_NOT_FREEBSD_NOR_DARWIN ++ static struct in6pcb tcb6; ++#endif ++#if OS_NET_BSD_16_OR_LATER + struct inpcbtable tcbtable; + caddr_t first; +-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) ++#endif ++#if OS_FREEBSD_OR_DARWIN char *sysctl_buf; struct xinpgen *xig, *oxig; -+ struct xtcpcb *xp; - #endif /* defined(__FreeBSD__) && __FreeBSD__ >= 3 */ +-#else +- static struct in6pcb tcb6; + #endif - if (!initialized) { -@@ -1646,11 +1657,7 @@ + DEBUGMSGTL(("mibII/ipv6", "var_tcp6: ")); +@@ -1688,9 +1708,9 @@ + (int) vp->namelen * sizeof(oid)); + DEBUGMSGTL(("mibII/ipv6", "start: p=%x\n", p)); + while ( +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ ++#if OS_NET_BSD_16_OR_LATER + p && p != first +-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin) ++#elif OS_NOT_FREEBSD_NOR_DARWIN + p && (u_long) p != auto_nlist_value("tcb6") + #else + xig->xig_len > sizeof(struct xinpgen) +@@ -1698,41 +1718,43 @@ + ) { DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p)); - #if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) -- if (klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb)) < 0) --#else -- in6pcb = ((struct xinpcb *) xig)->xi_inp; --#endif -- { -+ if (klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb)) < 0) { - DEBUGMSGTL(("mibII/ipv6", "klookup fail for in6pcb at %x\n", +-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin) +- if (klookup((u_long) p, (char *) &in6pcb, sizeof(in6pcb)) < 0) { ++#if OS_NOT_FREEBSD_NOR_DARWIN ++ if (klookup((u_long) p, (char *) &tstpcb, sizeof(tstpcb)) < 0) { + DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6 at %x\n", p)); + found = 0; break; -@@ -1662,6 +1669,14 @@ - in6pcb.in6p_ppcb)); + } + #else +- in6pcb = ((struct xinpcb *) xig)->xi_inp; ++ tstpcb = ((struct xinpcb *) xig)->xi_inp; + #endif +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ +- if (in6pcb.in6p_af != AF_INET6) ++#if OS_NET_BSD_16_OR_LATER ++ if (tstpcb.in6p_af != AF_INET6) { ++ p = (caddr_t)tstpcb.in6p_queue.cqe_next; + goto skip; +-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) +- if (0 == (in6pcb.inp_vflag & INP_IPV6)) ++ } ++#elif OS_FREEBSD_OR_DARWIN ++ if (0 == (tstpcb.inp_vflag & INP_IPV6PROTO)) + goto skip; + #endif + if (klookup +- ((u_long) in6pcb.in6p_ppcb, (char *) &tcpcb, sizeof(tcpcb)) ++ ((u_long) tstpcb.in6p_ppcb, (char *) &tcpcb, sizeof(tcpcb)) + < 0) { +- DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6.tcpcb at %x\n", +- in6pcb.in6p_ppcb)); ++ DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6.tcp6cb at %x\n", ++ tstpcb.in6p_ppcb)); + found = 0; break; } -+#else -+ in6pcb = ((struct xinpcb *) xig)->xi_inp; -+ xp = (struct xtcpcb *)xig; -+ tcp6cb = xp->xt_tp; -+ if (!(in6pcb.inp_vflag & 0x02)) { /* Skip non-IPv6 pcb */ -+ goto skip; -+ } -+#endif j = (int) vp->namelen; for (i = 0; i < sizeof(struct in6_addr); i++) - newname[j++] = in6pcb.in6p_laddr.s6_addr[i]; +- newname[j++] = in6pcb.in6p_laddr.s6_addr[i]; +- newname[j++] = ntohs(in6pcb.in6p_lport); ++ newname[j++] = tstpcb.in6p_laddr.s6_addr[i]; ++ newname[j++] = ntohs(tstpcb.in6p_lport); + for (i = 0; i < sizeof(struct in6_addr); i++) +- newname[j++] = in6pcb.in6p_faddr.s6_addr[i]; +- newname[j++] = ntohs(in6pcb.in6p_fport); +- if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr)) ++ newname[j++] = tstpcb.in6p_faddr.s6_addr[i]; ++ newname[j++] = ntohs(tstpcb.in6p_fport); ++ if (IN6_IS_ADDR_LINKLOCAL(&tstpcb.in6p_laddr)) + newname[j++] = +- ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]); ++ ntohs(*(u_int16_t *) & tstpcb.in6p_laddr.s6_addr[2]); + else + newname[j++] = 0; + /*XXX*/ newname[j++] = mapTcpState((int)tcpcb.t_state); +@@ -1743,12 +1765,12 @@ + DEBUGMSG(("mibII/ipv6", " %d\n", exact)); + + #if 1 /* this is very odd but sometimes happen, and cause infinite loop */ +- if (ntohs(in6pcb.in6p_lport) == 0) ++ if (ntohs(tstpcb.in6p_lport) == 0) + goto skip; + #endif + result = snmp_oid_compare(name, *length, newname, j); + if (exact && (result == 0)) { +- memcpy(&savpcb, &in6pcb, sizeof(savpcb)); ++ memcpy(&savpcb, &tstpcb, sizeof(savpcb)); + savnameLen = j; + memcpy(savname, newname, j * sizeof(oid)); + found++; +@@ -1759,7 +1781,7 @@ + */ + if ((savnameLen == 0) || + (snmp_oid_compare(savname, savnameLen, newname, j) > 0)) { +- memcpy(&savpcb, &in6pcb, sizeof(savpcb)); ++ memcpy(&savpcb, &tstpcb, sizeof(savpcb)); + savnameLen = j; + memcpy(savname, newname, j * sizeof(oid)); + found++; +@@ -1767,15 +1789,15 @@ + } + + skip: +-#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/ +- p = (caddr_t)in6pcb.in6p_queue.cqe_next; +-#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin) +- p = (caddr_t) in6pcb.in6p_next; ++#if OS_NET_BSD_16_OR_LATER ++ p = (caddr_t)tstpcb.in6p_queue.cqe_next; ++#elif OS_NOT_FREEBSD_NOR_DARWIN ++ p = (caddr_t) tstpcb.in6p_next; + #else + xig = (struct xinpgen *) ((char *) xig + xig->xig_len); + #endif + } +-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin) ++#if OS_FREEBSD_OR_DARWIN + free(sysctl_buf); + #endif + DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found)); +@@ -1783,7 +1805,7 @@ + return NULL; + *length = savnameLen; + memcpy((char *) name, (char *) savname, *length * sizeof(oid)); +- memcpy(&in6pcb, &savpcb, sizeof(savpcb)); ++ memcpy(&tstpcb, &savpcb, sizeof(savpcb)); + *write_method = 0; + *var_len = sizeof(long); /* default to 'long' results */ + +@@ -1796,20 +1818,20 @@ + switch (vp->magic) { + case IPV6TCPLOCALADDR: + *var_len = sizeof(struct in6_addr); +- return (u_char *) & in6pcb.in6p_laddr.s6_addr[0]; ++ return (u_char *) & savpcb.in6p_laddr.s6_addr[0]; + case IPV6TCPLOCALPORT: +- long_return = ntohs(in6pcb.in6p_lport); ++ long_return = ntohs(savpcb.in6p_lport); + return (u_char *) & long_return; + case IPV6TCPREMOTEADDR: + *var_len = sizeof(struct in6_addr); +- return (u_char *) & in6pcb.in6p_faddr.s6_addr[0]; ++ return (u_char *) & savpcb.in6p_faddr.s6_addr[0]; + case IPV6TCPREMOTEPORT: +- long_return = ntohs(in6pcb.in6p_fport); ++ long_return = ntohs(savpcb.in6p_fport); + return (u_char *) & long_return; + case IPV6TCPIFINDEX: +- if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr)) ++ if (IN6_IS_ADDR_LINKLOCAL(&savpcb.in6p_laddr)) + long_return = +- ntohs(*(u_int16_t *) & in6pcb.in6p_laddr.s6_addr[2]); ++ ntohs(*(u_int16_t *) & savpcb.in6p_laddr.s6_addr[2]); + else + long_return = 0; + /*XXX*/ return (u_char *) & long_return; diff --git a/net-mgmt/net-snmp-devel/files/patch-local:snmpconf b/net-mgmt/net-snmp-devel/files/patch-local:snmpconf index 080b0347900..584e473e27d 100644 --- a/net-mgmt/net-snmp-devel/files/patch-local:snmpconf +++ b/net-mgmt/net-snmp-devel/files/patch-local:snmpconf @@ -1,62 +1,53 @@ ---- local/snmpconf.orig Wed Feb 11 01:33:42 2004 -+++ local/snmpconf Wed May 12 11:51:15 2004 +--- local/snmpconf.orig Tue Apr 20 23:20:51 2004 ++++ local/snmpconf Thu Jun 24 23:12:06 2004 @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!%%PERL%% -w # # A simple configuration file builder based on questions listed in -@@ -17,7 +17,7 @@ - %arrayitems=qw(question 1 validanswer 1); +@@ -21,7 +21,7 @@ + $opts{'c'} = "$ENV{SNMPSHAREPATH}/snmpconf-data"; + } + else { +- $opts{'c'} = "/usr/local/share/snmp/snmpconf-data"; ++ $opts{'c'} = "%%PREFIX%%/share/snmp/snmpconf-data"; + } - #defaults --$opts{'c'} = "/usr/local/share/snmp/snmpconf-data"; -+$opts{'c'} = "%%PREFIX%%/share/snmp/snmpconf-data"; + # default config file path +@@ -29,7 +29,7 @@ + $confpath = "$ENV{SNMPCONFPATH}"; + } + else { +- $confpath = "/usr/local/share/snmp"; ++ $confpath = "%%PREFIX%%/share/snmp"; + } - # read the argument string - getopts("qadhfc:piI:r:R:g:G", \%opts); -@@ -27,7 +27,7 @@ - print "$0 [options] [FILETOCREATE...]\n"; - print "options:\n"; - print " -f overwrite existing files without prompting\n"; -- print " -i install created files into /usr/local/share/snmp.\n"; -+ print " -i install created files into %%PREFIX%%/share/snmp.\n"; - print " -p install created files into $ENV{HOME}/.snmp.\n"; - print " -I DIR install created files into DIR.\n"; - print " -a Don't ask any questions, just read in current\n"; -@@ -63,7 +63,7 @@ + # home environment variable +@@ -84,7 +84,7 @@ # # Find existing files to possibly read in. # --my @searchpath = (qw(/usr/local/share/snmp /usr/local/etc/snmp .), "$ENV{HOME}/.snmp"); -+my @searchpath = (qw(%%PREFIX%%/share/snmp %%PREFIX%%/etc/snmp .), "$ENV{HOME}/.snmp"); +-my @searchpath = ("$confpath","/usr/local/etc/snmp", ".", "$home"); ++my @searchpath = ("$confpath","%%PREFIX%%/etc/snmp", ".", "$home"); push @searchpath, $opts{I} if ($opts{I}); foreach my $i (@searchpath) { debug("searching $i\n"); -@@ -160,7 +160,7 @@ - foreach my $i (@didfiles) { - if ($didfile{$i} ne "1") { +@@ -183,7 +183,7 @@ if ($opts{'i'} || $opts{'I'}) { -- $opts{'I'} = "/usr/local/share/snmp" if (!$opts{'I'}); -+ $opts{'I'} = "%%PREFIX%%/share/snmp" if (!$opts{'I'}); - - move ("$opts{'I'}/$i", "$opts{'I'}/$i.bak") if (-f "$opts{'I'}/$i"); - if (move ("$didfile{$i}", "$opts{'I'}")) { -@@ -171,7 +171,7 @@ + $opts{'I'} = "$confpath" if (!$opts{'I'}); + +- if (! (-d "$opts{'I'}") && ! (mkdir ("$opts{'I'}"))) { ++ if (! (-d "$opts{'I'}") && ! (mkdir ("$opts{'I'}", 0777))) { + print "\nCould not create $opts{'I'} directory: $!\n"; print ("File $didfile{$i} left in current directory\n"); } +@@ -198,7 +198,7 @@ + } + } } elsif ($opts{'p'}) { -- if (! (-d "$ENV{HOME}/.snmp") && ! (mkdir ("$ENV{HOME}/.snmp"))) { -+ if (! (-d "$ENV{HOME}/.snmp") && ! (mkdir("$ENV{HOME}/.snmp", 0777))) { - print "\nCould not create $ENV{HOME}/.snmp directory: $!\n"; +- if (! (-d "$home") && ! (mkdir ("$home"))) { ++ if (! (-d "$home") && ! (mkdir ("$home", 0777))) { + print "\nCould not create $home directory: $!\n"; print ("File $didfile{$i} left in current directory\n"); } -@@ -198,7 +198,7 @@ - } - - if (!$opts{'p'} && !$opts{'i'} && !$opts{'I'}) { -- Print("\nThese files should be moved to /usr/local/share/snmp/ if you -+ Print("\nThese files should be moved to %%PREFIX%%/share/snmp/ if you - want them used by everyone on the system. In the future, if you add - the -i option to the command line I'll copy them there automatically for you. - diff --git a/net-mgmt/net-snmp-devel/files/patch-memory_freebsd2.c b/net-mgmt/net-snmp-devel/files/patch-memory_freebsd2.c deleted file mode 100644 index caffe13901b..00000000000 --- a/net-mgmt/net-snmp-devel/files/patch-memory_freebsd2.c +++ /dev/null @@ -1,37 +0,0 @@ ---- agent/mibgroup/ucd-snmp/memory_freebsd2.c.orig Sat Nov 9 15:59:53 2002 -+++ agent/mibgroup/ucd-snmp/memory_freebsd2.c Sat Feb 21 11:55:05 2004 -@@ -204,6 +204,7 @@ - if (kd == NULL) - kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL); - -+#if !defined(freebsd5) - auto_nlist(NSWDEV_SYMBOL, (char *) &nswdev, sizeof(nswdev)); - auto_nlist(DMMAX_SYMBOL, (char *) &dmmax, sizeof(dmmax)); - -@@ -212,6 +213,7 @@ - return; - - auto_nlist(SWDEVT_SYMBOL, (char *) sw, nswdev * sizeof(*sw)); -+#endif - - n = kvm_getswapinfo(kd, kswap, sizeof(kswap) / sizeof(kswap[0]), 0); - -@@ -242,7 +244,9 @@ - swapUsed *= pagesize; - swapFree *= pagesize; - -+#if !defined(freebsd5) - free(sw); -+#endif - } - #endif - -@@ -274,7 +278,7 @@ - size_t total_size = sizeof(total); - int total_mib[] = { CTL_VM, VM_METER }; - -- long phys_mem; -+ u_long phys_mem; - size_t phys_mem_size = sizeof(phys_mem); - int phys_mem_mib[] = { CTL_HW, HW_USERMEM }; - diff --git a/net-mgmt/net-snmp-devel/files/patch-tcpTable.c b/net-mgmt/net-snmp-devel/files/patch-tcpTable.c index 0d33547108b..d96d0976189 100644 --- a/net-mgmt/net-snmp-devel/files/patch-tcpTable.c +++ b/net-mgmt/net-snmp-devel/files/patch-tcpTable.c @@ -1,14 +1,5 @@ ---- agent/mibgroup/mibII/tcpTable.c.orig Tue Mar 16 08:27:45 2004 -+++ agent/mibgroup/mibII/tcpTable.c Wed Apr 14 09:40:00 2004 -@@ -95,6 +95,8 @@ - #define TCPTABLE_REMOTEADDRESS pcb.inp_faddr.s_addr - #define TCPTABLE_REMOTEPORT pcb.inp_fport - #define TCPTABLE_IS_LINKED_LIST -+#undef INP_NEXT_SYMBOL -+#define INP_NEXT_SYMBOL inp_next - - #endif /* linux */ - #endif /* WIN32 */ +--- agent/mibgroup/mibII/tcpTable.c.orig Wed Jun 9 05:53:17 2004 ++++ agent/mibgroup/mibII/tcpTable.c Thu Jun 24 23:21:32 2004 @@ -275,6 +277,9 @@ int @@ -19,28 +10,3 @@ return tcp_estab; } -@@ -691,6 +696,7 @@ - struct xinpgen *xig = NULL; - netsnmp_inpcb *nnew; - int StateMap[] = { 1, 2, 3, 4, 5, 8, 6, 10, 9, 7, 11 }; -+ struct tcpcb *tp = NULL; - - tcpTable_free(NULL, NULL); - -@@ -717,12 +723,13 @@ - nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb); - if (!nnew) - break; -- nnew->state = StateMap[((struct xinpcb *) xig)->xt_tp.t_state]; -+ tp = &((struct xtcpcb *)xig)->xt_tp; -+ nnew->state = StateMap[tp->t_state]; - if (nnew->state == 5 /* established */ || - nnew->state == 8 /* closeWait */ ) - tcp_estab++; -- memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xt_inp), -- sizeof(struct inpcb)); -+ memcpy(&(nnew->pcb), &(((struct xtcpcb *) xig)->xt_tp), -+ sizeof(struct tcpcb)); - - nnew->inp_next = tcp_head; - tcp_head = nnew; diff --git a/net-mgmt/net-snmp-devel/files/patch-udpTable.c b/net-mgmt/net-snmp-devel/files/patch-udpTable.c deleted file mode 100644 index 83364a9a338..00000000000 --- a/net-mgmt/net-snmp-devel/files/patch-udpTable.c +++ /dev/null @@ -1,25 +0,0 @@ ---- agent/mibgroup/mibII/udpTable.c.orig Fri Nov 14 15:14:52 2003 -+++ agent/mibgroup/mibII/udpTable.c Fri Nov 14 15:18:08 2003 -@@ -577,6 +577,7 @@ - * Unpick this into the constituent 'xinpgen' structures, and extract - * the 'inpcb' elements into a linked list (built in reverse) - */ -+#if 0 - xig = (struct xinpgen *) udpcb_buf; - xig = (struct xinpgen *) ((char *) xig + xig->xig_len); - -@@ -584,12 +585,13 @@ - nnew = SNMP_MALLOC_TYPEDEF(struct inpcb); - if (!nnew) - break; -- memcpy(nnew, ((struct xinpcb *) xig)->xi_inp, sizeof(struct inpcb)); -+ memcpy(nnew, &((struct xinpcb *) xig)->xi_inp, sizeof(struct inpcb)); - - nnew->next = udp_head; /* XXX - ?? Check 'next' pointer */ - udp_head = nnew; - xig = (struct xinpgen *) ((char *) xig + xig->xig_len); - } -+#endif - - free(udpcb_buf); - if (udp_head) { diff --git a/net-mgmt/net-snmp-devel/files/patch-vmstat_freebsd2.c b/net-mgmt/net-snmp-devel/files/patch-vmstat_freebsd2.c deleted file mode 100644 index 7e64f3979bc..00000000000 --- a/net-mgmt/net-snmp-devel/files/patch-vmstat_freebsd2.c +++ /dev/null @@ -1,14 +0,0 @@ ---- agent/mibgroup/ucd-snmp/vmstat_freebsd2.c.orig Thu May 23 17:39:41 2002 -+++ agent/mibgroup/ucd-snmp/vmstat_freebsd2.c Thu Feb 20 08:08:20 2003 -@@ -10,7 +10,11 @@ - #include <sys/param.h> - #include <sys/time.h> - #include <sys/proc.h> -+#if defined(freebsd5) && __FreeBSD_version >= 500101 -+#include <sys/resource.h> -+#else - #include <sys/dkstat.h> -+#endif - #ifdef freebsd5 - #include <sys/bio.h> - #endif diff --git a/net-mgmt/net-snmp-devel/pkg-plist b/net-mgmt/net-snmp-devel/pkg-plist index 1940232f873..8353bb71678 100644 --- a/net-mgmt/net-snmp-devel/pkg-plist +++ b/net-mgmt/net-snmp-devel/pkg-plist @@ -275,6 +275,7 @@ sbin/snmptrapd %%DATADIR%%/mibs/SNMP-PROXY-MIB.txt %%DATADIR%%/mibs/SNMP-TARGET-MIB.txt %%DATADIR%%/mibs/SNMP-USER-BASED-SM-MIB.txt +%%DATADIR%%/mibs/SNMP-USM-AES-MIB.txt %%DATADIR%%/mibs/SNMP-VIEW-BASED-ACM-MIB.txt %%DATADIR%%/mibs/SNMPv2-CONF.txt %%DATADIR%%/mibs/SNMPv2-MIB.txt |