1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00

net-mgmt/mrtg: fix regression with gcc14 / clang16

- fix shebangfix

- use textproc/p5-Pod-Parser
Obtained from: NetBSD

- add ubiquiti to cfgmaker
- fix HC detection in cfgmaker
This commit is contained in:
Dirk Meyer 2024-10-18 16:24:47 +02:00
parent e188141cab
commit e25d62fc9b
6 changed files with 111 additions and 6 deletions

View File

@ -1,6 +1,6 @@
PORTNAME= mrtg
DISTVERSION= 2.17.10
PORTREVISION= 2
PORTREVISION= 3
PORTEPOCH= 1
CATEGORIES= net-mgmt
MASTER_SITES= https://github.com/oetiker/${PORTNAME}/releases/download/v${DISTVERSION}/ \
@ -14,7 +14,9 @@ LICENSE= GPLv2
LIB_DEPENDS= libgd.so:${GD_PORT} \
libpng16.so:graphics/png
RUN_DEPENDS= p5-SNMP_Session>=0:net-mgmt/p5-SNMP_Session
RUN_DEPENDS= p5-SNMP_Session>=0:net-mgmt/p5-SNMP_Session \
p5-Pod-Parser>=0:textproc/p5-Pod-Parser \
p5-Module-CoreList>=0:devel/p5-Module-CoreList
USES= perl5 shebangfix
@ -29,7 +31,8 @@ GROUPS= mrtg
MAKE_ENV+= PERL=${PERL}
MRTG_RUNDIR?= /var/run/mrtg
SHEBANG_FILES= bin/mrtg-traffic-sum
SHEBANG_FILES= bin/cfgmaker bin/indexmaker bin/mrtg bin/mrtg-traffic-sum
perl_OLD_CMD= /home/oetiker/.plenv/shims/perl
USE_RC_SUBR= mrtg_daemon
SUB_FILES= pkg-deinstall pkg-install pkg-message

View File

@ -0,0 +1,32 @@
Ignore the enclosed Pod-Parser in favour of textproc/p5-Pod-Parser,
avoiding pointless conflicts with p5 packages
Install Perl modules to the proper versioned vendorlib directory
--- Makefile.in.orig 2022-01-19 10:24:31 UTC
+++ Makefile.in
@@ -38,7 +38,7 @@ subst:
$(CC) $(CPPFLAGS) $(CFLAGS) -c $(top_srcdir)/src/rateup.c -o bin/rateup.o
subst:
- $(PERL) -0777 -p -i~ -e "s'^#!\s*/\S*perl'#! $(PERL)'" $(top_srcdir)/bin/cfgmaker $(top_srcdir)/bin/indexmaker $(top_srcdir)/bin/mrtg
+ $(PERL) -0777 -p -i~ -e "s@__PREFIX__@${prefix}@g" $(top_srcdir)/bin/cfgmaker $(top_srcdir)/bin/indexmaker $(top_srcdir)/bin/mrtg
$(PERL) -0777 -p -i~ -e 's@GRAPHFMT="...";@GRAPHFMT="$(GDFORM_EXT)";@' $(top_srcdir)/bin/mrtg $(top_srcdir)/bin/indexmaker
configure: configure.ac
@@ -58,12 +58,10 @@ install: all
for x in $(top_srcdir)/bin/mrtg $(top_srcdir)/bin/cfgmaker $(top_srcdir)/bin/indexmaker $(top_srcdir)/bin/mrtg-traffic-sum; do \
$(INSTALL) -m 755 $$x $(DESTDIR)$(bindir); done
for x in bin/rateup; do \
- $(INSTALL) -m 755 $$x $(DESTDIR)$(bindir); done
- $(MKINSTALLDIRS) $(DESTDIR)$(libdir)/mrtg2/Pod
+ $(INSTALL) -m 755 -s $$x $(DESTDIR)$(bindir); done
+ $(MKINSTALLDIRS) $(DESTDIR)${PERL5_INSTALLVENDORLIB}
for x in $(top_srcdir)/lib/mrtg2/*.pm; do \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(libdir)/mrtg2; done
- for x in $(top_srcdir)/lib/mrtg2/Pod/*.pm; do \
- $(INSTALL) -m 644 $$x $(DESTDIR)$(libdir)/mrtg2/Pod; done
+ $(INSTALL) -m 644 $$x $(DESTDIR)${PERL5_INSTALLVENDORLIB}; done
$(MKINSTALLDIRS) $(DESTDIR)$(datadir)/mrtg2/icons
for x in $(top_srcdir)/images/*.gif $(top_srcdir)/images/*.png; do \
$(INSTALL) -m 644 $$x $(DESTDIR)$(datadir)/mrtg2/icons; done

View File

@ -0,0 +1,11 @@
--- contrib/NSI/Mrtg_nsi.orig 2017-03-05 14:09:53 UTC
+++ contrib/NSI/Mrtg_nsi
@@ -59,7 +59,7 @@ $main::OS = 'NT';
}
die "ERROR: Can\'t find location of mrtg executable\n"
unless $main::binpath;
- unshift (@INC,$main::binpath);
+ $main::binpath .= "/../libexec"
}
# There older perls tend to behave peculiar with

View File

@ -0,0 +1,38 @@
--- bin/cfgmaker.orig 2022-01-19 10:25:15 UTC
+++ bin/cfgmaker
@@ -175,7 +175,7 @@ sub InterfaceInfo($$$$$) {
push @Variables, ($1 > 11.0 or $1 < 10.0 ) ? "ifAlias" : "CiscolocIfDescr";
if ($1 > 11.2) {push @Variables, "vmVlan";};
if ($1 > 11.3) {push @Variables, "vlanTrunkPortDynamicStatus";};
- } elsif ( $routers->{$router}{deviceinfo}{Vendor} =~ /(?:hp|juniper|dlink|wwp|foundry|dellLan|force10|3com|extremenetworks|openBSD|arista|enterasys|zyxel|vyatta|dcn|brocade|datacom|alcatel|mikrotik|huawei|eltex)/i) {
+ } elsif ( $routers->{$router}{deviceinfo}{Vendor} =~ /(?:hp|juniper|dlink|wwp|foundry|dellLan|force10|3com|extremenetworks|openBSD|arista|enterasys|zyxel|vyatta|dcn|brocade|datacom|alcatel|mikrotik|huawei|eltex|ubiquiti)/i) {
push @Variables, "ifAlias";
}
@@ -911,11 +911,11 @@ sub IsCounterBroken ($$$) {
my $snmphost = v4onlyifnecessary($router, $ipv4only);
if ($router =~ /:[\d.]*:[\d.]*:[\d.]*:[23]/) {
- my $speed = (snmpget($snmphost, $v3opt, 'ifHighSpeed.'.$if))[0] || 'unknown';
+ my $speed = (snmpget($snmphost, $v3opt, 'ifHighSpeed.'.$if))[0] // 'unknown';
debug('base',"snmpget $snmphost for ifHighSpeed.$if -> $speed Mb/s");
$SNMP_Session::errmsg = undef;
$Net_SNMP_util::ErrorMessage = undef;
- my $counter = (snmpget($snmphost,$v3opt, 'ifHCInOctets.'.$if))[0] || 'unknown';
+ my $counter = (snmpget($snmphost,$v3opt, 'ifHCInOctets.'.$if))[0] // 'unknown';
debug('base',"snmpget $snmphost for ifHCInOctets.$if -> $counter");
if( $speed eq 'unknown' or $counter !~ /^\d+$/ or $SNMP_Session::errmsg or $Net_SNMP_util::ErrorMessage){
$SNMP_Session::errmsg = undef;
@@ -1018,7 +1018,11 @@ sub DeviceInfo ($$$) {
'1.3.6.1.4.1.14988.' => 'mikrotik',
'1.3.6.1.4.1.6486.' => 'alcatel',
'1.3.6.1.4.1.2011.' => 'huawei',
- '1.3.6.1.4.1.35265.' => 'eltex'
+ '1.3.6.1.4.1.35265.' => 'eltex',
+ '1.3.6.1.4.1.4413' => 'ubiquiti',
+ '1.3.6.1.4.1.41112' => 'ubiquiti'
+
+
);
$DevInfo{Vendor} = 'Unknown Vendor - '.$DevInfo{sysObjectID};
foreach (keys %vendorIDs) {

View File

@ -1,7 +1,14 @@
If I can shave off 7 seconds off every exp-run this patch seems totally worth it
--- configure.orig 2014-12-11 13:46:28 UTC
--- configure.orig 2022-01-19 10:24:35 UTC
+++ configure
@@ -5343,18 +5343,12 @@ fi
@@ -3664,6 +3664,7 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
+#include <stdlib.h>
int main()
{
long long b, a = -0x3AFAFAFAFAFAFAFALL;
@@ -5384,18 +5385,12 @@ echo $ECHO_N "ordering CD from http://tobi.oetiker.ch/
echo $ECHO_N "ordering CD from http://tobi.oetiker.ch/wish $ECHO_C" 1>&6

View File

@ -0,0 +1,14 @@
--- src/rateup.c.orig 2022-01-19 10:25:16 UTC
+++ src/rateup.c
@@ -49,11 +49,6 @@
#define GFORM_GD gdImagePng
#endif
-/* BSD* does not have/need malloc.h */
-#if !defined(bsdi) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__APPLE__)
-#include <malloc.h>
-#endif
-
/* MSVCRT.DLL does not know %ll in printf */
#ifdef __MINGW32_VERSION
#define LLD "%I64d"