aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt/net-snmp-devel/files
diff options
context:
space:
mode:
authorkuriyama <kuriyama@FreeBSD.org>2004-03-10 21:40:41 +0800
committerkuriyama <kuriyama@FreeBSD.org>2004-03-10 21:40:41 +0800
commitba0dbd234c8ca7e3af2dfb3968f61531f59824e4 (patch)
tree43c8236bd074b4ab27317509a4054ea4765e6755 /net-mgmt/net-snmp-devel/files
parent66e9a290d9561243b7ed5cefbdd76378a7c3a672 (diff)
downloadfreebsd-ports-gnome-ba0dbd234c8ca7e3af2dfb3968f61531f59824e4.tar.gz
freebsd-ports-gnome-ba0dbd234c8ca7e3af2dfb3968f61531f59824e4.tar.zst
freebsd-ports-gnome-ba0dbd234c8ca7e3af2dfb3968f61531f59824e4.zip
Various fixes / improvements.
See PR for details. PR: ports/63759 Submitted by: Cyrille Lefevre <cyrille.lefevre@laposte.net>
Diffstat (limited to 'net-mgmt/net-snmp-devel/files')
-rw-r--r--net-mgmt/net-snmp-devel/files/extra-patch-local:Makefile.in11
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-configure.in52
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-hr_storage.c4
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-hr_system.c24
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-local:Makefile.in11
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-local:fixproc138
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-local:ipf-mod.pl21
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-local:mib2c20
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-local:snmpcheck.def8
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-local:snmpconf53
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-local:tkmib9
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-local:traptoemail16
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-memory_freebsd2.c14
-rw-r--r--net-mgmt/net-snmp-devel/files/snmpd.sh.sample7
-rw-r--r--net-mgmt/net-snmp-devel/files/snmptrapd.sh.sample35
15 files changed, 376 insertions, 47 deletions
diff --git a/net-mgmt/net-snmp-devel/files/extra-patch-local:Makefile.in b/net-mgmt/net-snmp-devel/files/extra-patch-local:Makefile.in
new file mode 100644
index 000000000000..7f648103d7aa
--- /dev/null
+++ b/net-mgmt/net-snmp-devel/files/extra-patch-local:Makefile.in
@@ -0,0 +1,11 @@
+--- local/Makefile.in.orig Sat Apr 20 16:30:13 2002
++++ local/Makefile.in Wed Apr 24 01:45:55 2002
+@@ -12,7 +12,7 @@
+ # local info
+ #
+ SNMPCONFPATH=@SNMPCONFPATH@
+-PERLSCRIPTS=snmpcheck tkmib mib2c fixproc ipf-mod.pl snmpconf traptoemail
++PERLSCRIPTS=snmpcheck mib2c fixproc ipf-mod.pl snmpconf traptoemail
+ SCRIPTSMADEFORPERL=snmpcheck.made tkmib.made mib2c.made fixproc.made \
+ ipf-mod.pl.made snmpconf.made traptoemail.made
+ PERLPROG=@PERLPROG@
diff --git a/net-mgmt/net-snmp-devel/files/patch-configure.in b/net-mgmt/net-snmp-devel/files/patch-configure.in
index c3a85b528ce2..bc45eecc20b7 100644
--- a/net-mgmt/net-snmp-devel/files/patch-configure.in
+++ b/net-mgmt/net-snmp-devel/files/patch-configure.in
@@ -1,19 +1,47 @@
---- configure.in.orig Fri Nov 14 13:32:10 2003
-+++ configure.in Fri Nov 14 13:36:27 2003
-@@ -1357,7 +1357,7 @@
- # fall back
+--- configure.in.orig Thu Mar 6 07:41:13 2003
++++ configure.in Tue May 27 14:53:22 2003
+@@ -1246,7 +1246,7 @@
+ dnl fall back
CFLAG="-f"
fi
-for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd /mach_kernel
-+for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd /mach_kernel /boot/kernel/kernel
++for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd /mach_kernel /boot/kernel/kernel /dev/null
do
if test -f $i -o $CFLAG $i; then
ac_cv_KERNEL_LOC="$i"
-@@ -1376,6 +1376,7 @@
- # Check for mount table location
- #
+@@ -1659,7 +1659,7 @@
+ AC_HEADER_SYS_WAIT
+ AC_CHECK_HEADERS(stdarg.h string.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h netinet/tcpip.h netinet/in.h netinet/ip.h netinet/ip_icmp.h net/if.h netdb.h sys/dmap.h machine/pte.h xti.h sys/sockio.h sys/socket.h sys/un.h fstab.h sys/fs.h mtab.h ufs/fs.h ufs/ffs/fs.h sys/fixpoint.h machine/param.h sys/vm.h vm/vm.h sys/vmmeter.h sys/vmparam.h sys/vmmac.h sys/vmsystm.h sys/mbuf.h sys/time.h sys/swap.h inet/mib2.h sys/statvfs.h sys/vfs.h sys/mnttab.h sys/user.h sys/proc.h sys/select.h mntent.h sys/mntent.h kstat.h utsname.h sys/utsname.h sys/cdefs.h getopt.h locale.h pthread.h sys/loadavg.h regex.h linux/tasks.h pwd.h grp.h utmpx.h)
+ # FreeBSD required headers
+-AC_CHECK_HEADERS(malloc.h sys/param.h net/if_dl.h sys/sysctl.h stdlib.h net/if_mib.h net/if_types.h net/if_var.h sys/queue.h osreldate.h machine/types.h sys/socketvar.h)
++AC_CHECK_HEADERS(malloc.h sys/param.h net/if_dl.h sys/sysctl.h stdlib.h net/if_mib.h net/if_types.h net/if_var.h sys/queue.h osreldate.h sys/socketvar.h)
+ # Linux
+ AC_CHECK_HEADERS(sys/conf.h netinet/in_systm.h netinet/tcp.h netinet/udp.h netinet/in_var.h netinet/if_ether.h netinet/ip_var.h netinet/tcp_timer.h netinet/tcp_var.h netinet/tcp_fsm.h netinet/udp_var.h netinet/icmp_var.h sys/protosw.h nlist.h ioctls.h asm/page.h netipx/ipx.h)
+ # NetBSD required headers
+@@ -1866,6 +1866,26 @@
+ dnl checking for 4.3 vs 4.4 rtentry.
+ AC_CACHE_CHECK(type of rtentry structure,ac_cv_RTENTRY_TYPE,
+ [
++
++dnl 4.4 compatible but renamed on FreeBSD
++AC_TRY_COMPILE([
++#include <sys/types.h>
++#define KERNEL
++#define _KERNEL
++#include <sys/socket.h>
++#undef KERNEL
++#undef _KERNEL
++#include <net/route.h>
++],[
++
++#ifndef STRUCT_RTENTRY_HAS_RT_DST
++#define rt_dst rt_nodes->rn_key
++#endif
++
++ struct rtentry rt;
++ rt.rt_nodes[0].rn_bit = 1;
++ rt.rt_dst;
++ ], ac_cv_RTENTRY_TYPE="BSD-4.4")
-+# kuriyama: should /var/db/mounttab be used?
- AC_CACHE_CHECK(for mount table location,ac_cv_ETC_MNTTAB,
- [ac_cv_ETC_MNTTAB="unknown"
- for i in /etc/mnttab /etc/mtab /etc/filesystems
+ dnl 4.4 compat
+ AC_TRY_COMPILE([
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 a1eff0ab8301..e5638709fbfa 100644
--- a/net-mgmt/net-snmp-devel/files/patch-hr_storage.c
+++ b/net-mgmt/net-snmp-devel/files/patch-hr_storage.c
@@ -24,7 +24,7 @@
#elif defined(MBSTAT_SYMBOL)
+#if !defined(__FreeBSD__) || __FreeBSD_version < 500021
long_return = mbstat.m_mbufs;
-+#elif __FreeBSD_version < 500024
++#elif defined(freebsd5) && __FreeBSD_version < 500024
+ /* mbuf stats disabled */
+ return NULL;
+#else
@@ -40,7 +40,7 @@
#elif defined(MBSTAT_SYMBOL)
+#if !defined(__FreeBSD__) || __FreeBSD_version < 500021
long_return = mbstat.m_clusters - mbstat.m_clfree; /* unlikely, but... */
-+#elif __FreeBSD_version < 500024
++#elif defined(freebsd5) && __FreeBSD_version < 500024
+ /* mbuf stats disabled */
+ return NULL;
+#else
diff --git a/net-mgmt/net-snmp-devel/files/patch-hr_system.c b/net-mgmt/net-snmp-devel/files/patch-hr_system.c
index ee1f01228bfd..a0271bdaf052 100644
--- a/net-mgmt/net-snmp-devel/files/patch-hr_system.c
+++ b/net-mgmt/net-snmp-devel/files/patch-hr_system.c
@@ -1,23 +1,21 @@
---- agent/mibgroup/host/hr_system.c.orig Fri Nov 14 14:45:55 2003
-+++ agent/mibgroup/host/hr_system.c Fri Nov 14 14:46:01 2003
-@@ -276,11 +276,10 @@
- struct utmp *utmp_p;
- #endif
-
-+#ifndef UTMP_HAS_NO_TYPE
- setutent();
+--- agent/mibgroup/host/hr_system.c.orig Sat Mar 1 05:35:13 2003
++++ agent/mibgroup/host/hr_system.c Sun Feb 8 17:39:50 2004
+@@ -280,7 +280,6 @@
while ((utmp_p = getutent()) != NULL) {
--#ifndef UTMP_HAS_NO_TYPE
+ #ifndef UTMP_HAS_NO_TYPE
if (utmp_p->ut_type == USER_PROCESS) {
-#endif
/* This block of code fixes zombie user PIDs in the
utmp/utmpx file that would otherwise be counted as a
current user */
-@@ -293,6 +292,7 @@
+@@ -291,6 +290,10 @@
+ }
+ ++total;
}
++#else
++ if (*utmp_p->ut_name != '~')
++ ++total;
++#endif
}
endutent();
-+#endif
return total;
- }
-
diff --git a/net-mgmt/net-snmp-devel/files/patch-local:Makefile.in b/net-mgmt/net-snmp-devel/files/patch-local:Makefile.in
index 7f648103d7aa..e69de29bb2d1 100644
--- a/net-mgmt/net-snmp-devel/files/patch-local:Makefile.in
+++ b/net-mgmt/net-snmp-devel/files/patch-local:Makefile.in
@@ -1,11 +0,0 @@
---- local/Makefile.in.orig Sat Apr 20 16:30:13 2002
-+++ local/Makefile.in Wed Apr 24 01:45:55 2002
-@@ -12,7 +12,7 @@
- # local info
- #
- SNMPCONFPATH=@SNMPCONFPATH@
--PERLSCRIPTS=snmpcheck tkmib mib2c fixproc ipf-mod.pl snmpconf traptoemail
-+PERLSCRIPTS=snmpcheck mib2c fixproc ipf-mod.pl snmpconf traptoemail
- SCRIPTSMADEFORPERL=snmpcheck.made tkmib.made mib2c.made fixproc.made \
- ipf-mod.pl.made snmpconf.made traptoemail.made
- PERLPROG=@PERLPROG@
diff --git a/net-mgmt/net-snmp-devel/files/patch-local:fixproc b/net-mgmt/net-snmp-devel/files/patch-local:fixproc
new file mode 100644
index 000000000000..5d6e3515467d
--- /dev/null
+++ b/net-mgmt/net-snmp-devel/files/patch-local:fixproc
@@ -0,0 +1,138 @@
+--- local/fixproc.orig Sat Apr 20 09:30:13 2002
++++ local/fixproc Sat Mar 6 01:59:59 2004
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl
++#!%%PERL%%
+ #
+ # fixproc [-min n] [-max n] [-check | -kill | -restart | -exist | -fix] proc ...
+ #
+@@ -129,7 +129,7 @@
+ #
+ # Timothy Kong 3/1995
+
+-$database_file = '/local/etc/fixproc.conf';
++$database_file = '%%PREFIX%%/etc/fixproc.conf';
+
+ $debug = 0; # specify debug level using -dN
+ # currently defined: -d1
+@@ -155,6 +155,14 @@
+ $shell_header = "#!/bin/sh\n";
+ $shell_end_marker = 'shell_end_marker';
+
++open(command, "/bin/ps -p $$ |") || die "$0: can't run ps command\n";
++if (split(' ', <command>) > 4) {
++ $ps_opts = 'ax';
++} else {
++ $ps_opts = '-e';
++}
++close command;
++
+ &read_args();
+ &read_database();
+ # &dump_database(); # debug only
+@@ -203,7 +211,9 @@
+ $i++;
+ }
+ close (file);
+- system "chmod +x $file";
++ ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
++ $atime,$mtime,$ctime,$blksize,$blocks) = stat($file);
++ chmod $mode | 0111, $file;
+ return file;
+ }
+
+@@ -237,8 +247,8 @@
+
+ # return code is number divided by 256
+ $error_code = (system "$tmpfile") / 256;
+- system "rm $tmpfile";
+- return ($fix_failed_error) if ($error_code != 0);
++ unlink $tmpfile;
++ return ($cannot_fix_error) if ($error_code != 0);
+ # sleep needed here?
+ return &do_exist ($proc);
+ }
+@@ -268,7 +278,7 @@
+
+ # return code is number divided by 256
+ $error_code = (system "$tmpfile") / 256;
+- system "rm $tmpfile";
++ unlink $tmpfile;
+ return ($check_failed_error) if ($error_code != 0);
+
+ # check passed, continue
+@@ -285,10 +295,12 @@
+
+ # do ps, check to see if min <= no. of processes <= max
+ $! = $fixproc_error;
+- open (command, "/bin/ps -e | /bin/grep $proc | /bin/wc -l |")
++ open (command, "/bin/ps $ps_opts |")
+ || die "$0: can't run ps-grep-wc command\n";
+- $proc_count = <command>;
+- if (($proc_count < $min{$proc}) || ($proc_count > $max{$proc}))
++ @allprocs = <command>;
++ close command;
++ @procs = grep(/$proc/, @allprocs);
++ if (($#procs < $min{$proc}) || ($#procs > $max{$proc}))
+ {
+ return $check_failed_error;
+ }
+@@ -305,41 +317,48 @@
+
+ # first try kill
+ $! = $fixproc_error;
+- open (command, "/bin/ps -e | /bin/grep $proc |")
++ open (command, "/bin/ps $ps_opts |")
+ || die "$0: can't run ps-grep-awk command\n";
+ while (<command>)
+ {
+- # match the first field of ps -e
++ if /$proc/ {
++ # match the first field of ps $ps_opts
+ $! = $fixproc_error;
+- /^\s*(\d+)\s/ || die "$0: can't match ps -e output\n";
+- system "kill $1";
++ /^\s*(\d+)\s/ || die "$0: can't match ps $ps_opts output\n";
++ kill 15, $1;
++ }
+ }
++ close command;
+
+ # if process still exist, try kill -9
+ sleep 2;
+ $! = $fixproc_error;
+- open (command, "/bin/ps -e | /bin/grep $proc |")
++ open (command, "/bin/ps $ps_opts |")
+ || die "$0: can't run ps-grep-awk command\n";
+ $second_kill_needed = 0;
+ while (<command>)
+ {
+- # match the first field of ps -e
++ if /$proc/ {
++ # match the first field of ps $ps_opts
+ $! = $fixproc_error;
+- /^\s*(\d+)\s/ || die "$0: can't match ps -e output\n";
+- system "kill -9 $1";
++ /^\s*(\d+)\s/ || die "$0: can't match ps $ps_opts output\n";
++ kill 9, $1;
+ $second_kill_needed = 1;
++ }
+ }
++ close command;
+ return ($no_error) if ($second_kill_needed == 0);
+
+ # see if kill -9 worked
+ sleep 2;
+ $! = $fixproc_error;
+- open (command, "/bin/ps -e | /bin/grep $proc |")
++ open (command, "/bin/ps $ps_opts |")
+ || die "$0: can't run ps-grep-awk command\n";
+ while (<command>)
+ { # a process still exist, return error
+- return $cannot_kill_error;
++ return $cannot_kill_error if /$proc/;
+ }
++ close command;
+ return $no_error; # good, all dead
+ }
+
diff --git a/net-mgmt/net-snmp-devel/files/patch-local:ipf-mod.pl b/net-mgmt/net-snmp-devel/files/patch-local:ipf-mod.pl
new file mode 100644
index 000000000000..8bf98d4f1d52
--- /dev/null
+++ b/net-mgmt/net-snmp-devel/files/patch-local:ipf-mod.pl
@@ -0,0 +1,21 @@
+--- local/ipf-mod.pl.orig Thu May 29 05:30:19 2003
++++ local/ipf-mod.pl Thu May 29 05:40:13 2003
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl -s
++#!%%PERL%% -s
+ ##
+ ## IP Filter UCD-SNMP pass module
+ ##
+@@ -9,10 +9,10 @@
+ ## Date: $ Tue Dec 1 10:24:08 EET 1998 $
+ ## Version: 1.1a
+
+-# Put this file in /usr/local/bin/ipf-mod.pl and then add the following
++# Put this file in %%PREFIX%%/bin/ipf-mod.pl and then add the following
+ # line to your snmpd.conf file (without the # at the front):
+ #
+-# pass .1.3.6.1.4.1.2021.13.2 /usr/local/bin/ipf-mod.pl
++# pass .1.3.6.1.4.1.2021.13.2 %%PREFIX%%/bin/ipf-mod.pl
+
+ # enterprises.ucdavis.ucdExperimental.ipFilter = .1.3.6.1.4.1.2021.13.2
+ # ipfInTable.ipfInEntry.ipfInIndex integer = 1.1.1
diff --git a/net-mgmt/net-snmp-devel/files/patch-local:mib2c b/net-mgmt/net-snmp-devel/files/patch-local:mib2c
new file mode 100644
index 000000000000..6609d77609c9
--- /dev/null
+++ b/net-mgmt/net-snmp-devel/files/patch-local:mib2c
@@ -0,0 +1,20 @@
+--- local/mib2c.orig Fri Nov 14 02:28:39 2003
++++ local/mib2c Wed Feb 4 09:05:44 2004
+@@ -1,5 +1,4 @@
+-#!/usr/bin/perl
+-#!/usr/bin/perl -w
++#!%%PERL%%
+
+ #
+ # $Id: mib2c,v 5.36 2003/11/14 01:28:39 rstory Exp $
+@@ -56,8 +55,8 @@
+ if($ENV{MIB2C_DIR}) {
+ push @def_search_dirs, $ENV{MIB2C_DIR};
+ }
+-push @def_search_dirs, "/usr/local/share/snmp/";
+-
++push @def_search_dirs, "%%PREFIX%%/share/snmp/";
++push @def_search_dirs, "%%PREFIX%%/etc/snmp/";
+
+ sub usage {
+ print "$0 [-h] [-c configfile] [-f prefix] mibNode\n\n";
diff --git a/net-mgmt/net-snmp-devel/files/patch-local:snmpcheck.def b/net-mgmt/net-snmp-devel/files/patch-local:snmpcheck.def
new file mode 100644
index 000000000000..4f3b4a2491da
--- /dev/null
+++ b/net-mgmt/net-snmp-devel/files/patch-local:snmpcheck.def
@@ -0,0 +1,8 @@
+--- local/snmpcheck.def.orig Thu May 29 05:28:22 2003
++++ local/snmpcheck.def Thu May 29 05:29:49 2003
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/perl -w
++#!%%PERL%% -w
+
+ use strict 'refs';
+ require Net::Ping;
diff --git a/net-mgmt/net-snmp-devel/files/patch-local:snmpconf b/net-mgmt/net-snmp-devel/files/patch-local:snmpconf
new file mode 100644
index 000000000000..3b9d20968d1d
--- /dev/null
+++ b/net-mgmt/net-snmp-devel/files/patch-local:snmpconf
@@ -0,0 +1,53 @@
+--- local/snmpconf.orig Thu May 29 05:30:19 2003
++++ local/snmpconf Thu May 29 05:34:45 2003
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl -w
++#!%%PERL%% -w
+
+ #
+ # A simple configuration file builder based on questions listed in
+@@ -16,7 +16,7 @@
+ %arrayitems=qw(question 1 validanswer 1);
+
+ #defaults
+-$opts{'c'} = "/usr/local/share/snmp/snmpconf-data";
++$opts{'c'} = "%%PREFIX%%/share/snmp/snmpconf-data";
+
+ # read the argument string
+ getopts("qadhfc:piI:r:R:g:G", \%opts);
+@@ -26,7 +26,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";
+@@ -62,7 +62,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");
+ push @searchpath, $opts{I} if ($opts{I});
+ foreach my $i (@searchpath) {
+ debug("searching $i\n");
+@@ -159,7 +159,7 @@
+ foreach my $i (@didfiles) {
+ if ($didfile{$i} ne "1") {
+ if ($opts{'i'} || $opts{'I'}) {
+- $opts{'I'} = "/usr/local/share/snmp" if (!$opts{'I'});
++ $opts{'I'} = "%%PREFIX%%/share/snmp" if (!$opts{'I'});
+ system("mv $opts{'I'}/$i $opts{'I'}/$i.bak") if (-f "$opts{'I'}/$i");
+ system("mv $didfile{$i} $opts{'I'}");
+ Print(" $didfile{$i} installed in $opts{'I'}\n");
+@@ -180,7 +180,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-local:tkmib b/net-mgmt/net-snmp-devel/files/patch-local:tkmib
new file mode 100644
index 000000000000..3278d27c3809
--- /dev/null
+++ b/net-mgmt/net-snmp-devel/files/patch-local:tkmib
@@ -0,0 +1,9 @@
+--- local/tkmib.orig Thu May 29 05:30:19 2003
++++ local/tkmib Thu May 29 05:31:46 2003
+@@ -1,5 +1,4 @@
+-#!/usr/bin/perl
+-#!/usr/bin/perl -w
++#!%%PERL%% -w
+
+ require 5;
+
diff --git a/net-mgmt/net-snmp-devel/files/patch-local:traptoemail b/net-mgmt/net-snmp-devel/files/patch-local:traptoemail
new file mode 100644
index 000000000000..402506b540c6
--- /dev/null
+++ b/net-mgmt/net-snmp-devel/files/patch-local:traptoemail
@@ -0,0 +1,16 @@
+--- local/traptoemail.orig Thu May 29 05:30:19 2003
++++ local/traptoemail Thu May 29 05:35:13 2003
+@@ -1,11 +1,11 @@
+-#!/usr/bin/perl
++#!%%PERL%%
+
+ # This is a snmptrapd handler script to convert snmp traps into email
+ # messages.
+
+ # Usage:
+ # Put a line like the following in your snmptrapd.conf file:
+-# traphandle TRAPOID|default /usr/local/bin/traptoemail [-f FROM] [-s SMTPSERVER]b ADDRESSES
++# traphandle TRAPOID|default %%PREFIX%%/bin/traptoemail [-f FROM] [-s SMTPSERVER]b ADDRESSES
+ # FROM defaults to "root"
+ # SMTPSERVER defaults to "localhost"
+
diff --git a/net-mgmt/net-snmp-devel/files/patch-memory_freebsd2.c b/net-mgmt/net-snmp-devel/files/patch-memory_freebsd2.c
index 47f5da45ccc7..caffe13901b9 100644
--- a/net-mgmt/net-snmp-devel/files/patch-memory_freebsd2.c
+++ b/net-mgmt/net-snmp-devel/files/patch-memory_freebsd2.c
@@ -1,12 +1,14 @@
---- agent/mibgroup/ucd-snmp/memory_freebsd2.c.orig Sat Nov 9 23:59:53 2002
-+++ agent/mibgroup/ucd-snmp/memory_freebsd2.c Sat Aug 16 17:09:01 2003
-@@ -207,11 +207,13 @@
+--- 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));
-+#if !defined(freebsd5)
- sw = (struct swdevt *) malloc(nswdev * sizeof(*sw));
- if (sw == NULL)
+@@ -212,6 +213,7 @@
return;
auto_nlist(SWDEVT_SYMBOL, (char *) sw, nswdev * sizeof(*sw));
diff --git a/net-mgmt/net-snmp-devel/files/snmpd.sh.sample b/net-mgmt/net-snmp-devel/files/snmpd.sh.sample
index f56301232645..814c0b7ac701 100644
--- a/net-mgmt/net-snmp-devel/files/snmpd.sh.sample
+++ b/net-mgmt/net-snmp-devel/files/snmpd.sh.sample
@@ -28,8 +28,9 @@ fi
name=snmpd
rcvar=`set_rcvar`
-command=%%PREFIX%%/sbin/snmpd
-pidfile='/var/run/snmpd.pid'
+command=%%PREFIX%%/sbin/${name}
+pidfile=/var/run/${name}.pid
+sig_stop=-KILL
-load_rc_config $name
+load_rc_config ${name}
run_rc_command "$1"
diff --git a/net-mgmt/net-snmp-devel/files/snmptrapd.sh.sample b/net-mgmt/net-snmp-devel/files/snmptrapd.sh.sample
new file mode 100644
index 000000000000..760c260ccfe4
--- /dev/null
+++ b/net-mgmt/net-snmp-devel/files/snmptrapd.sh.sample
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: snmptrapd
+# REQUIRE: DAEMON
+# KEYWORD: FreeBSD
+#
+# Add the following line to /etc/rc.conf to enable snmptrapd:
+#
+# snmptrapd_enable="YES"
+#
+
+snmptrapd_enable="NO"
+snmptrapd_flags="-p /var/run/snmptrapd.pid"
+
+. %%RC_SUBR%%
+
+load_rc_config net_snmptrapd
+
+if [ ! -z "$net_snmptrapd_enable" ]; then
+ echo "Warning: \$net_snmptrapd_enable is obsoleted."
+ echo " Use \$snmptrapd_enable instead."
+ snmptrapd_enable="$net_snmptrapd_enable"
+ [ ! -z "$net_snmptrapd_flags" ] && snmptrapd_flags="$net_snmptrapd_flags"
+fi
+
+name=snmptrapd
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/${name}
+pidfile=/var/run/${name}.pid
+
+load_rc_config ${name}
+run_rc_command "$1"