summaryrefslogtreecommitdiff
path: root/net/net-snmp
diff options
context:
space:
mode:
authorrtr <rtr>2005-07-31 02:30:18 +0000
committerrtr <rtr>2005-07-31 02:30:18 +0000
commit3ae0636e22bd616c62ae9f2745b10ba02171007c (patch)
tree00cdcbc54673a9afbfef97a6cade887c8ea4143f /net/net-snmp
parentd7dd632387800f4e8d28ac2037929ba56428c7fa (diff)
downloadpkgsrc-3ae0636e22bd616c62ae9f2745b10ba02171007c.tar.gz
make net-snmp build on darwin 8.2.0 patches from darwin sources
Diffstat (limited to 'net/net-snmp')
-rw-r--r--net/net-snmp/patches/patch-ak21
-rw-r--r--net/net-snmp/patches/patch-al44
-rw-r--r--net/net-snmp/patches/patch-am11
-rw-r--r--net/net-snmp/patches/patch-an133
4 files changed, 209 insertions, 0 deletions
diff --git a/net/net-snmp/patches/patch-ak b/net/net-snmp/patches/patch-ak
new file mode 100644
index 00000000000..1d7c0f3d158
--- /dev/null
+++ b/net/net-snmp/patches/patch-ak
@@ -0,0 +1,21 @@
+--- agent/mibgroup/ucd-snmp/disk.c.orig 2005-07-30 18:48:29.000000000 +1000
++++ agent/mibgroup/ucd-snmp/disk.c 2005-07-30 18:49:20.000000000 +1000
+@@ -73,15 +73,17 @@
+ #if HAVE_SYS_VFS_H
+ #include <sys/vfs.h>
+ #endif
+-#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
++#ifdef HAVE_STATFS
+ #if HAVE_SYS_MOUNT_H
+ #include <sys/mount.h>
+ #endif
+ #if HAVE_SYS_SYSCTL_H
+ #include <sys/sysctl.h>
+ #endif
++#ifndef HAVE_STATVFS
+ #define statvfs statfs
+ #endif
++#endif
+ #if HAVE_VM_VM_H
+ #include <vm/vm.h>
+ #endif
diff --git a/net/net-snmp/patches/patch-al b/net/net-snmp/patches/patch-al
new file mode 100644
index 00000000000..fc9a43d0067
--- /dev/null
+++ b/net/net-snmp/patches/patch-al
@@ -0,0 +1,44 @@
+--- agent/mibgroup/host/hr_network.c.orig 2005-07-30 19:20:48.000000000 +1000
++++ agent/mibgroup/host/hr_network.c 2005-07-30 19:21:25.000000000 +1000
+@@ -189,6 +189,10 @@
+ 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;
+@@ -207,7 +211,7 @@
+ void
+ Init_HR_Network(void)
+ {
+-#ifndef solaris2
++#ifndef solaris2 &&
+ Interface_Scan_Init();
+ #endif
+ }
+@@ -215,7 +219,7 @@
+ 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 @@
+ 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 */
diff --git a/net/net-snmp/patches/patch-am b/net/net-snmp/patches/patch-am
new file mode 100644
index 00000000000..366c2b492cb
--- /dev/null
+++ b/net/net-snmp/patches/patch-am
@@ -0,0 +1,11 @@
+--- agent/mibgroup/host/hr_swrun.c.orig 2005-07-30 21:47:42.000000000 +1000
++++ agent/mibgroup/host/hr_swrun.c 2005-07-30 21:47:46.000000000 +1000
+@@ -1070,6 +1070,8 @@
+ #else
+ proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024;
+ #endif
++#elif defined darwin
++ long_return = -1;
+ #else
+ long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize +
+ proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize +
diff --git a/net/net-snmp/patches/patch-an b/net/net-snmp/patches/patch-an
new file mode 100644
index 00000000000..2715da4ce81
--- /dev/null
+++ b/net/net-snmp/patches/patch-an
@@ -0,0 +1,133 @@
+--- agent/mibgroup/mibII/route_write.c.orig 2005-07-30 22:18:06.000000000 +1000
++++ agent/mibgroup/mibII/route_write.c 2005-07-30 22:18:28.000000000 +1000
+@@ -102,7 +102,7 @@
+ int
+ addRoute(u_long dstip, u_long gwip, u_long iff, u_short flags)
+ {
+-#ifndef dynix
++#if !(defined dynix || defined darwin)
+ struct sockaddr_in dst;
+ struct sockaddr_in gateway;
+ int s, rc;
+@@ -141,6 +141,55 @@
+ return rc;
+ #endif
+
++#elif defined darwin
++ size_t sa_in_size = sizeof(struct sockaddr_in);
++ int s, rc;
++ struct sockaddr_in dst;
++ struct sockaddr_in gateway;
++ struct {
++ struct rt_msghdr hdr;
++ char space[512];
++ } rtmsg;
++
++ s = socket(PF_ROUTE, SOCK_RAW, 0);
++ if (s < 0) {
++ snmp_log_perror("socket");
++ return -1;
++ }
++
++ shutdown(s, SHUT_RD);
++ /* possible panic otherwise */
++ flags |= (RTF_UP | RTF_GATEWAY);
++
++ bzero((char *)&dst, sa_in_size);
++ dst.sin_len = sa_in_size;
++ dst.sin_family = AF_INET;
++ dst.sin_addr.s_addr = htonl(dstip);
++
++ bzero((char *)&gateway, sa_in_size);
++ gateway.sin_len = sa_in_size;
++ gateway.sin_family = AF_INET;
++ gateway.sin_addr.s_addr = htonl(gwip);
++
++ bzero((char *)&rtmsg, sizeof(rtmsg));
++ rtmsg.hdr.rtm_type = RTM_ADD;
++ rtmsg.hdr.rtm_version = RTM_VERSION;
++ rtmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;
++ rtmsg.hdr.rtm_flags = RTF_GATEWAY;
++
++ bcopy((char *)&dst, rtmsg.space, sa_in_size);
++ bcopy((char *)&gateway, (rtmsg.space+sa_in_size), sa_in_size);
++
++ rc = sizeof(struct rt_msghdr) + sa_in_size + sa_in_size;
++ rtmsg.hdr.rtm_msglen = rc;
++
++ if ((rc = write(s, (char *)&rtmsg, rc)) < 0) {
++ snmp_log_perror("writing to routing socket");
++ return -1;
++ }
++
++ return (rc);
++
+ #else /* dynix */
+ /*
+ * Throws up the following errors:
+@@ -166,7 +215,7 @@
+ int
+ delRoute(u_long dstip, u_long gwip, u_long iff, u_short flags)
+ {
+-#ifndef dynix
++#if !(defined dynix || defined darwin)
+
+ struct sockaddr_in dst;
+ struct sockaddr_in gateway;
+@@ -205,6 +254,56 @@
+ return rc;
+ #endif
+
++#elif defined darwin
++ size_t sa_in_size = sizeof(struct sockaddr_in);
++ int s, rc;
++ struct sockaddr_in dst;
++ struct sockaddr_in gateway;
++ struct {
++ struct rt_msghdr hdr;
++ char space[512];
++ } rtmsg;
++
++ s = socket(PF_ROUTE, SOCK_RAW, 0);
++
++ if (s < 0) {
++ snmp_log_perror("socket");
++ return -1;
++ }
++
++ shutdown(s, SHUT_RD);
++ /* possible panic otherwise */
++ flags |= (RTF_UP | RTF_GATEWAY);
++
++ bzero((char *)&dst, sa_in_size);
++ dst.sin_len = sa_in_size;
++ dst.sin_family = AF_INET;
++ dst.sin_addr.s_addr = htonl(dstip);
++
++ bzero((char *)&gateway, sa_in_size);
++ gateway.sin_len = sa_in_size;
++ gateway.sin_family = AF_INET;
++ gateway.sin_addr.s_addr = htonl(gwip);
++
++ bzero((char *)&rtmsg, sizeof(rtmsg));
++ rtmsg.hdr.rtm_type = RTM_DELETE;
++ rtmsg.hdr.rtm_version = RTM_VERSION;
++ rtmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;
++ rtmsg.hdr.rtm_flags = RTF_GATEWAY;
++
++ bcopy((char *)&dst, rtmsg.space, sa_in_size);
++ bcopy((char *)&gateway, (rtmsg.space+sa_in_size), sa_in_size);
++
++ rc = sizeof(struct rt_msghdr) + sa_in_size + sa_in_size;
++ rtmsg.hdr.rtm_msglen = rc;
++
++ if ((rc = write(s, (char *)&rtmsg, rc)) < 0) {
++ snmp_log_perror("writing to routing socket");
++ return -1;
++ }
++
++ return rc;
++
+ #else /* dynix */
+ /*
+ * See 'addRoute' for the list of errors.