NetBSD Problem Report #52945

From www@NetBSD.org  Wed Jan 24 07:15:02 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id F22CF7A195
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 24 Jan 2018 07:15:01 +0000 (UTC)
Message-Id: <20180124071500.ECFED8067B@mollari.NetBSD.org>
Date: Wed, 24 Jan 2018 07:15:00 +0000 (UTC)
From: 6bone@6bone.informatik.uni-leipzig.de
Reply-To: 6bone@6bone.informatik.uni-leipzig.de
To: gnats-bugs@NetBSD.org
Subject: snmpd does not work under current 8.0_BETA
X-Send-Pr-Version: www-1.0

>Number:         52945
>Category:       kern
>Synopsis:       snmpd does not work under current 8.0_BETA
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 24 07:20:00 +0000 2018
>Closed-Date:    Wed Feb 28 02:21:54 +0000 2018
>Last-Modified:  Wed Feb 28 02:21:54 +0000 2018
>Originator:     Uwe Toenjes
>Release:        NetBSD 8.0_BETA
>Organization:
University of Leipzig
>Environment:
NetBSD gate.ipv6.uni-leipzig.de 8.0_BETA NetBSD 8.0_BETA (MYCONF8.gdb) #0: Mon Aug 28 22:51:59 CEST 2017  root@gate.ipv6.uni-leipzig.de:/usr/obj/sys/arch/amd64/compile/MYCONF8.gdb amd64
>Description:
With an 8.0_BETA kernel from August 2017 no problems arise. With the current 8.0_BETA the net-snmp-5.7.3nb8 does not work.

The error message comes:

Connection from UDP: [139.18.xxx.xxx]:57516->[139.18.yyy.yyy]:161
send response: Failure in sendto
    -- SNMPv2-MIB::sysDescr.0
Connection from UDP: [139.18.xxx.xxx]:57516->[139.18.yyy.yyy]:161
send response: Failure in sendto
    -- SNMPv2-MIB::sysDescr.0
Connection from UDP: [139.18.xxx.xxx]:57516->[139.18.yyy.yyy]:161
send response: Failure in sendto
    -- SNMPv2-MIB::sysDescr.0
...


Other programs seem to have no problem with the kernel. That's why I think it's a special snmpd problem.

An exact date from when the problem occurred I can not call.

Any ideas what the problem could be?

Thank you for your efforts

Regards
Uwe
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->adam
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Wed, 24 Jan 2018 09:29:09 +0000
Responsible-Changed-Why:
Over to maintainer


From: maya@netbsd.org
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/52945 (snmpd does not work under current 8.0_BETA)
Date: Wed, 24 Jan 2018 10:36:31 +0000

 This doesn't sound like a package problem.

 Have you tried rebuilding it since?
 It looks like snmp touches /dev/mem, which netbsd makes weaker
 guarantees about compatibility on it.

 It's not normal to break it on stable, but it was absolutely necessary
 in this case.

From: 6bone@6bone.informatik.uni-leipzig.de
To: gnats-bugs@NetBSD.org
Cc: adam@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/52945 (snmpd does not work under current 8.0_BETA)
Date: Wed, 24 Jan 2018 16:11:18 +0100 (CET)

 On Wed, 24 Jan 2018, maya@netbsd.org wrote:

 > This doesn't sound like a package problem.
 >
 > Have you tried rebuilding it since?
 > It looks like snmp touches /dev/mem, which netbsd makes weaker
 > guarantees about compatibility on it.
 >
 > It's not normal to break it on stable, but it was absolutely necessary
 > in this case.

 I recompiled the snmpd. The problem is still there.

 Regards
 Uwe

Responsible-Changed-From-To: adam->kern-bug-people
Responsible-Changed-By: maya@NetBSD.org
Responsible-Changed-When: Wed, 24 Jan 2018 17:25:55 +0000
Responsible-Changed-Why:
Package failing after kernel update is a kernel problem.


From: 6bone@6bone.informatik.uni-leipzig.de
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org, adam@NetBSD.org, netbsd-bugs@netbsd.org, 
    gnats-admin@netbsd.org, maya@NetBSD.org
Subject: Re: kern/52945 (snmpd does not work under current 8.0_BETA)
Date: Mon, 5 Feb 2018 07:26:52 +0100 (CET)

 If it still helps the place in the source code of snmpd:

 trace: netsnmp_udpbase_send(): transports/snmpUDPBaseDomain.c, 463: netsnmp_udp: send 246 bytes from 0x71e7fcf59f0a to UDP: [139.18.xxx.xxx]:36787->[139.18.yyy.yyy]:161 on fd 8
 trace: netsnmp_udpbase_sendto(): transports/snmpUDPBaseDomain.c, 253:udpbase:sendto: sending from 139.18.yyy.yyy
 trace: netsnmp_udpbase_send(): transports/snmpUDPBaseDomain.c, 476: netsnmp_udp: sendto error, rc -1 (errno 42)
 send response: Failure in sendto
      -- SNMPv2-MIB::sysDescr.0
 trace: netsnmp_remove_and_free_agent_snmp_session(): snmp_agent.c, 1855:


 Regards
 Uwe

From: Paul Goyette <paul@whooppee.com>
To: 6bone@6bone.informatik.uni-leipzig.de
Cc: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org, adam@NetBSD.org, 
    netbsd-bugs@netbsd.org, gnats-admin@netbsd.org, maya@NetBSD.org
Subject: Re: kern/52945 (snmpd does not work under current 8.0_BETA)
Date: Mon, 5 Feb 2018 14:32:31 +0800 (+08)

 On Mon, 5 Feb 2018, 6bone@6bone.informatik.uni-leipzig.de wrote:

 > If it still helps the place in the source code of snmpd:
 >
 > trace: netsnmp_udpbase_send(): transports/snmpUDPBaseDomain.c, 463: 
 > netsnmp_udp: send 246 bytes from 0x71e7fcf59f0a to UDP: 
 > [139.18.xxx.xxx]:36787->[139.18.yyy.yyy]:161 on fd 8
 > trace: netsnmp_udpbase_sendto(): transports/snmpUDPBaseDomain.c, 
 > 253:udpbase:sendto: sending from 139.18.yyy.yyy
 > trace: netsnmp_udpbase_send(): transports/snmpUDPBaseDomain.c, 476: 
 > netsnmp_udp: sendto error, rc -1 (errno 42)

 Useful info here ------------------^^^^^^^^^

    42 ENOPROTOOPT Protocol option not available. A bad option or level
                   was specified in a getsockopt(2) or setsockopt(2) call.



 > send response: Failure in sendto
 >    -- SNMPv2-MIB::sysDescr.0
 > trace: netsnmp_remove_and_free_agent_snmp_session(): snmp_agent.c, 1855:

 +------------------+--------------------------+----------------------------+
 | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
 | (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
 | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
 +------------------+--------------------------+----------------------------+

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/52945 (snmpd does not work under current 8.0_BETA)
Date: Mon, 5 Feb 2018 07:59:13 -0000 (UTC)

 paul@whooppee.com (Paul Goyette) writes:

 >> trace: netsnmp_udpbase_sendto(): transports/snmpUDPBaseDomain.c, 
 >> 253:udpbase:sendto: sending from 139.18.yyy.yyy

 >Useful info here ------------------^^^^^^^^^

 >   42 ENOPROTOOPT Protocol option not available. A bad option or level
 >                  was specified in a getsockopt(2) or setsockopt(2) call.

 That's the IP_PKTINFO handling in snmpUDPBaseDomain.c.

 -- 
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: Ryo Shimizu <ryo@nerv.org>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org, 6bone@6bone.informatik.uni-leipzig.de
Subject: Re: kern/52945 (snmpd does not work under current 8.0_BETA)
Date: Thu, 15 Feb 2018 21:18:54 +0900

 The problem is portablity of net-snmpd.

 >configure:29616: checking for IP_PKTINFO 
 ...
 >conftest.c: In function 'main':
 >conftest.c:380:31: error: 'SOL_IP' undeclared (first use in this function)
 >         if (cm->cmsg_level == SOL_IP && cm->cmsg_type == IP_PKTINFO) {
 >                               ^
 >conftest.c:380:31: note: each undeclared identifier is reported only once for each function it appears in
 >conftest.c:382:48: warning: implicit declaration of function 'inet_ntoa' [-Wimplicit-function-declaration]
 >             printf("Address: %s; index: %d\n", inet_ntoa(src->ipi_addr),
 >                                                ^
 >configure:29668: $? = 1

 it seems that configure cannot detect IP_PKTINFO correctly
 because of using SOL_IP. SOL_IP is not defined on *BSD.
 And on netbsd, struct ip_pktinfo has no ipi_spec_dst.

 Please test following patch?


 Index: net/net-snmp/Makefile
 ===================================================================
 RCS file: /cvsroot/pkgsrc/net/net-snmp/Makefile,v
 retrieving revision 1.121
 diff -a -u -r1.121 Makefile
 --- net/net-snmp/Makefile	6 Oct 2017 02:39:38 -0000	1.121
 +++ net/net-snmp/Makefile	15 Feb 2018 12:15:21 -0000
 @@ -30,6 +30,7 @@
  .  if empty(CFLAGS:U:M*-Dnetbsd1*)
  CFLAGS+=		-Dnetbsd1
  .  endif
 +CFLAGS+=		-DSOL_IP=IPPROTO_IP
  .endif

  .if (${OPSYS} == "NetBSD") || !exists(/usr/bin/lpstat)
 Index: net/net-snmp/distinfo
 ===================================================================
 RCS file: /cvsroot/pkgsrc/net/net-snmp/distinfo,v
 retrieving revision 1.91
 diff -a -u -r1.91 distinfo
 --- net/net-snmp/distinfo	6 Oct 2017 02:39:38 -0000	1.91
 +++ net/net-snmp/distinfo	15 Feb 2018 12:15:21 -0000
 @@ -54,3 +54,4 @@
  SHA1 (patch-perl_default__store_Makefile.PL) = ed5ad7385680632b2153fa572635c5aea83c9114
  SHA1 (patch-perl_manager_Makefile.PL) = bb34b119a2b3887a1af1f9b88e6d4bad6baf60bb
  SHA1 (patch-snmplib_snmp__api.c) = b4f498aa93b61f809e3696df1fc6bf32bd942233
 +SHA1 (patch-snmplib_transports_snmpUDPBaseDomain.c) = b0fd8536f71761d115a93110cf45984f0bff2387
 Index: net/net-snmp/patches/patch-snmplib_transports_snmpUDPBaseDomain.c
 ===================================================================
 RCS file: net/net-snmp/patches/patch-snmplib_transports_snmpUDPBaseDomain.c
 diff -N net/net-snmp/patches/patch-snmplib_transports_snmpUDPBaseDomain.c
 --- /dev/null	1 Jan 1970 00:00:00 -0000
 +++ net/net-snmp/patches/patch-snmplib_transports_snmpUDPBaseDomain.c	15 Feb 2018 12:15:21 -0000
 @@ -0,0 +1,20 @@
 +--- snmplib/transports/snmpUDPBaseDomain.c.orig	2014-12-08 20:23:22.000000000 +0000
 ++++ snmplib/transports/snmpUDPBaseDomain.c
 +@@ -277,7 +277,7 @@ int netsnmp_udpbase_sendto(int fd, struc
 +              * come from.
 +              */
 +             ipi.ipi_ifindex = 0;
 +-#if defined(cygwin)
 ++#if defined(cygwin) || defined(__NetBSD__)
 +             ipi.ipi_addr.s_addr = srcip->s_addr;
 + #else
 +             ipi.ipi_spec_dst.s_addr = srcip->s_addr;
 +@@ -302,7 +302,7 @@ int netsnmp_udpbase_sendto(int fd, struc
 + 
 +             memset(&ipi, 0, sizeof(ipi));
 +             ipi.ipi_ifindex = if_index;
 +-#if defined(cygwin)
 ++#if defined(cygwin) || defined(__NetBSD__)
 +             ipi.ipi_addr.s_addr = INADDR_ANY;
 + #else
 +             ipi.ipi_spec_dst.s_addr = INADDR_ANY;



 -- 
 ryo shimizu

From: 6bone@6bone.informatik.uni-leipzig.de
To: Ryo Shimizu <ryo@nerv.org>
Cc: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org, gnats-admin@netbsd.org, 
    netbsd-bugs@netbsd.org
Subject: Re: kern/52945 (snmpd does not work under current 8.0_BETA)
Date: Fri, 16 Feb 2018 14:13:05 +0100 (CET)

 Hello,

 the patch solves the problem. I had only to recalculate the sha checksum 
 for the patch file.

 Can you add the patch to the net-snmp package?


 Thank you for your efforts

 Regards
 Uwe

From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52945 CVS commit: pkgsrc/net/net-snmp
Date: Wed, 28 Feb 2018 01:52:03 +0000

 Module Name:	pkgsrc
 Committed By:	maya
 Date:		Wed Feb 28 01:52:03 UTC 2018

 Modified Files:
 	pkgsrc/net/net-snmp: Makefile distinfo
 Added Files:
 	pkgsrc/net/net-snmp/patches:
 	    patch-snmplib_transports_snmpUDPBaseDomain.c

 Log Message:
 net-snmp: PR kern/52945: snmpd does not work under current 8.0_BETA

 it seems that configure cannot detect IP_PKTINFO correctly
 because of using SOL_IP. SOL_IP is not defined on *BSD.
 And on netbsd, struct ip_pktinfo has no ipi_spec_dst.

 From Ryo Shimizu.

 PKGREVISION++


 To generate a diff of this commit:
 cvs rdiff -u -r1.122 -r1.123 pkgsrc/net/net-snmp/Makefile
 cvs rdiff -u -r1.92 -r1.93 pkgsrc/net/net-snmp/distinfo
 cvs rdiff -u -r0 -r1.1 \
     pkgsrc/net/net-snmp/patches/patch-snmplib_transports_snmpUDPBaseDomain.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Wed, 28 Feb 2018 02:21:54 +0000
State-Changed-Why:
Applied the patch, thanks ryo, thanks uwe for testing.
Not going to request a pullup for pkgsrc-stable because I am not sure I understand the patch well enough, and haven't tested netbsd-7.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.