Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-6849

net-snmp when sending to multiple trap destinations does not set source address correcting to the second address in the list

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • rhel-8.2.0
    • net-snmp
    • sst_cs_system_management
    • False
    • Hide

      None

      Show
      None
    • Red Hat Enterprise Linux
    • If docs needed, set a value

      Description of problem:

      Issue:- when sending a trap, the second trap in the list does not get the proper source IP and cause erroneous determinations by the trap receiver and statistics and not aggregated properly.

      Version-Release number of selected component (if applicable):

      1. rpm -qi net-snmp
        Name : net-snmp
        Epoch : 1
        Version : 5.8
        Release : 14.el8
        Architecture: x86_64
        Install Date: Mon 19 Oct 2020 02:32:09 PM UTC
        Group : Unspecified
        Size : 893577
        License : BSD
        Signature : RSA/SHA256, Mon 16 Mar 2020 11:41:14 AM UTC, Key ID 199e2f91fd431d51
        Source RPM : net-snmp-5.8-14.el8.src.rpm
        Build Date : Mon 16 Mar 2020 10:21:24 AM UTC
        Build Host : x86-vm-08.build.eng.bos.redhat.com
        Relocations : (not relocatable)
        Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
        Vendor : Red Hat, Inc.
        URL : http://net-snmp.sourceforge.net/
        Summary : A collection of SNMP protocol tools and libraries

      So there should be a BZ opened for the issue and the fix appears to be roughly:

      "re-initializing the new copy's source member (the original 'source' member is already squirrel away in a stack variable) seems to have done the trick"

      attaching the RedHatCase03177898Diagnostic.tar.gz so that engineering can see how the problem happens

      =====

      I also downloaded the source from sourceforge for net-snmp 5.8 which is the version we are using and I think I found something in the net-snmp code, in snmplib/snmp_transport.c in netsnmp_tdomain_transport_tspec() there's a for loop

      for(; {
      if (match) {
      netsnmp_transport *t = NULL;
      const char* addr2;

      any_found = 1;
      /*

      • Ok, we know what domain to try, lets see what default data
      • should be used with it
        */
        if (default_target != NULL)
        addr2 = default_target;
        else
        addr2 = netsnmp_lookup_default_target(application,
        match->prefix[0]);
        DEBUGMSGTL(("tdomain",
        "trying domain \"%s\" address \"%s\" "
        "default address \"%s\"\n",
        match->prefix[0], addr ? addr : "[NIL]",
        addr2 ? addr2 : "[NIL]"));
        if (match->f_create_from_tspec) {
        netsnmp_tdomain_spec tspec_tmp;
        memcpy(&tspec_tmp, tspec, sizeof(tspec_tmp));

      so it creates essentially a local copy of the passed in tspec in course of processing the 'source' member of tspec can get initialized from NULL (if that's the case) and so the second time around through this loop, the new copy inherits the updated 'source' and then tries to bind and fails saying 'Address in use' so then this trapsink (the second one in the list regardless of any specifics)
      doesn't do the right thing. so reinitializing the new copy's source member (the original 'source' member is already squirrel away in a stack variable) seems to have done the trick

            jridky Josef Řídký
            surpatil1@redhat.com Suraj Patil (Inactive)
            Josef Řídký Josef Řídký
            rhel-cs-system-management-subsystem-qe Bot rhel-cs-system-management-subsystem-qe Bot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: