Created attachment 587291 [details] patch for snmpd Description of problem: snmpd transmits reply UDP packets on incorrect interface on routers with multiple subnets. Version-Release number of selected component (if applicable): net-snmp-5.5-37.el6.x86_64 How reproducible: Always. Steps to Reproduce: 1. Turn off rp_filter in the kernel. 2. Configure a host with 2 ethernet interfaces on different subnets (subnet A.A.A.0 and B.B.B.0 with a default route to a host on A.A.A.something). 3. Send an snmp query from a device C.C.C.C such that it is received by the device (not on subnet A.A.A.0 or B.B.B.0, but reachable via the default route on A.A.A.something) under test on the B.B.B.0 subnet, but where the response must be sent to C.C.C.C via the default route on the A.A.A.0 subnet. 4. Observe that packets to C.C.C.C are sent out on the B.B.B.0 subnet, and not following the default route. Actual results: UDP packets sent ignore routes on the system. Expected results: SNMP UDP packets should use the routing table. Additional info: This config is commonly encountered on routers. Depending on which IP address is used to query SNMP, SNMP responses may or may note be correctly sent. Incorrect behaviour is visible when the DUT sends ARP queries for C.C.C.C on subnet B.B.B.0. Attached is a proposed fix that allows the kernel to select which interface to transmit on, while keeping the specification of the source ip address in sendmsg().
You are not the first who requests such feature, but I am afraid it contradicts with other requirements. Some people (mainly running some cluster suites or so) strictly require, that if snmpd gets a request, it must respond from the same interface. These people run servers with several network interfaces facing the same network and kernel could choose different interface when sending UDP response with cmsg.ipi.ipi_ifindex = 0. Therefore I consider it as RFE. I'll think about introduction of new snmpd.conf option which would turn the kernel routing on/off. Please also consider contacting your Red Hat support, bugs without support ticket have lower priority.
Created attachment 600495 [details] patch from RHEL 5 solved already in RHEL 5 and upstream see https://bugzilla.redhat.com/show_bug.cgi?id=600319 Problem raised with broadcast-response.patch, which was corrected later to preserve good old ipi_ifindex = 0 behavior. I don't understand why this patch has not been applied in RHEL 6.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2013-0421.html