From 2efab53aea951177bbc374b5d96d1279badffe00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0afr=C3=A1nek?= Date: Thu, 28 Jun 2007 08:58:23 +0000 Subject: [PATCH] Fixing accidentally commited wrong BuildRequires and missing patch --- net-snmp-5.3.1-shared-ip.patch | 107 +++++++++++++++++++++++++++++++++ net-snmp.spec | 6 +- 2 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 net-snmp-5.3.1-shared-ip.patch diff --git a/net-snmp-5.3.1-shared-ip.patch b/net-snmp-5.3.1-shared-ip.patch new file mode 100644 index 0000000..136ef72 --- /dev/null +++ b/net-snmp-5.3.1-shared-ip.patch @@ -0,0 +1,107 @@ +--- net-snmp-5.3.1/include/net-snmp/library/container.h.orig 2005-12-04 19:43:04.000000000 +0100 ++++ net-snmp-5.3.1/include/net-snmp/library/container.h 2007-05-04 10:01:38.000000000 +0200 +@@ -370,8 +370,32 @@ + } + } + return rc; +- } ++ } ++ + ++ int CONTAINER_TRY_INSERT(netsnmp_container *x, const void *k) ++ { ++ const void *res = NULL; ++ ++ netsnmp_container *start; ++ /** start at first container */ ++ while(x->prev) ++ x = x->prev; ++ ++ start = x; ++ ++ for(; x; x = x->next) { ++ if ((NULL != x->insert_filter) && ++ (x->insert_filter(x,k) == 1)) ++ continue; ++ res = x->find(x,k); ++ if (res) { ++ return -1; ++ } ++ } ++ return CONTAINER_INSERT(start, k); ++ } ++ + /*------------------------------------------------------------------ + * These functions should EXACTLY match the function version in + * container.c. If you change one, change them both. +--- net-snmp-5.3.1/snmplib/container.c.orig 2006-04-21 02:24:47.000000000 +0200 ++++ net-snmp-5.3.1/snmplib/container.c 2007-05-04 10:34:23.000000000 +0200 +@@ -286,6 +286,29 @@ + return rc; + } + ++int CONTAINER_TRY_INSERT(netsnmp_container *x, const void *k) ++{ ++ const void *res = NULL; ++ ++ netsnmp_container *start; ++ /** start at first container */ ++ while(x->prev) ++ x = x->prev; ++ ++ start = x; ++ ++ for(; x; x = x->next) { ++ if ((NULL != x->insert_filter) && ++ (x->insert_filter(x,k) == 1)) ++ continue; ++ res = x->find(x,k); ++ if (res) { ++ return -1; ++ } ++ } ++ return CONTAINER_INSERT(start, k); ++} ++ + /*------------------------------------------------------------------ + * These functions should EXACTLY match the inline version in + * container.h. If you change one, change them both. +--- net-snmp-5.4/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c.orig 2005-10-31 05:32:17.000000000 +0100 ++++ net-snmp-5.4/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c 2007-05-04 12:03:17.000000000 +0200 +@@ -272,7 +272,15 @@ + /* + * add entry to container + */ +- CONTAINER_INSERT(container, entry); ++ rc = CONTAINER_TRY_INSERT(container, entry); ++ if (rc < 0) { ++ static int logged = 0; ++ if (!logged) { ++ snmp_log(LOG_NOTICE, "Duplicate IP address detected, some interfaces may not be visible in IP-MIB\n"); ++ logged = 1; ++ } ++ netsnmp_access_ipaddress_entry_free(entry); ++ } + } + + /* +--- net-snmp-5.4/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c.orig 2006-09-15 02:48:40.000000000 +0200 ++++ net-snmp-5.4/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c 2007-05-04 12:03:44.000000000 +0200 +@@ -324,7 +324,16 @@ + /* + * add entry to container + */ +- CONTAINER_INSERT(container, entry); ++ rc = CONTAINER_TRY_INSERT(container, entry); ++ if (rc < 0) { ++ static int logged = 0; ++ if (!logged) { ++ snmp_log(LOG_NOTICE, "Duplicate IP address detected, some interfaces may not be visible in IP-MIB\n"); ++ logged = 1; ++ } ++ netsnmp_access_ipaddress_entry_free(entry); ++ } ++ + } + + fclose(in); diff --git a/net-snmp.spec b/net-snmp.spec index ba8f819..e49e9bb 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -53,12 +53,12 @@ Requires(preun): /bin/rm BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: openssl-devel, bzip2-devel, beecrypt-devel, elfutils-devel BuildRequires: libselinux-devel, elfutils-libelf-devel -#BuildRequires: perl-devel +BuildRequires: perl-devel %ifarch %{ix86} x86_64 BuildRequires: lm_sensors-devel %endif %if %{tcp_wrappers} -#BuildRequires: tcp_wrappers-devel +BuildRequires: tcp_wrappers-devel %endif BuildRequires: perl, coreutils, grep, sed, findutils @@ -379,6 +379,8 @@ rm -rf ${RPM_BUILD_ROOT} - default snmptrapd.conf added (#243536) - fix crash when multiple exec statements have the same name (#243536) +- fix ugly error message when more interfaces share + one IP address (#209861) * Mon Mar 12 2007 Radek Vokál - 1:5.4-13 - fix overly verbose log message (#221911)