a4dca0bf59
*** Security Fix *** Changes 5.3: *** Important Notes *** Several very significant changes have been made in Net-SNMP for this release that warrant special attention. - shared library version number no longer matches the release number. We now follow the versioning scheme recommended by libtool. For the 5.3 release this means that the libraries now have a SONAME ending with ".so.10", e.g. libnetsnmp.so.10. - snmpd has not been truncating log files at startup, as documented in the man pages, for a while now. This default behaviour has been restored. Please use the '-A' flag if you want to continue appending to your log files at startup. - snmptrapd will no longer accept all traps by default. It must be configured with authorized SNMPv1/v2c community strings and/or SNMPv3 users. Non-authorized traps/informs will be dropped. - Due to a copyright statement that didn't allow modifications, snmpnetstat has been completely rewritten. The new version now accepts the same command-line options as the other tools, which has introduced a number of incompatible changes. However, it does now finally support SNMPv3.
134 lines
3.8 KiB
Text
134 lines
3.8 KiB
Text
$NetBSD: patch-an,v 1.3 2006/01/24 22:16:55 adam Exp $
|
|
|
|
--- agent/mibgroup/mibII/route_write.c.orig 2005-09-16 19:00:23.000000000 +0200
|
|
+++ agent/mibgroup/mibII/route_write.c
|
|
@@ -97,7 +97,7 @@
|
|
int
|
|
addRoute(u_long dstip, u_long gwip, u_long iff, u_short flags)
|
|
{
|
|
-#if defined SIOCADDRT && !defined(irix6)
|
|
+#if defined SIOCADDRT && !defined(irix6) && !defined(darwin)
|
|
struct sockaddr_in dst;
|
|
struct sockaddr_in gateway;
|
|
int s, rc;
|
|
@@ -132,6 +132,54 @@ addRoute(u_long dstip, u_long gwip, u_lo
|
|
if (rc < 0)
|
|
snmp_log_perror("ioctl");
|
|
return rc;
|
|
+#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 /* SIOCADDRT */
|
|
return -1;
|
|
@@ -143,7 +191,7 @@ addRoute(u_long dstip, u_long gwip, u_lo
|
|
int
|
|
delRoute(u_long dstip, u_long gwip, u_long iff, u_short flags)
|
|
{
|
|
-#if defined SIOCDELRT && !defined(irix6)
|
|
+#if defined SIOCDELRT && !defined(irix6) && !defined(darwin)
|
|
|
|
struct sockaddr_in dst;
|
|
struct sockaddr_in gateway;
|
|
@@ -178,6 +226,56 @@ delRoute(u_long dstip, u_long gwip, u_lo
|
|
close(s);
|
|
return rc;
|
|
|
|
+#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 /* SIOCDELRT */
|
|
return 0;
|
|
#endif
|