On Tue, 2 Mar 2010 09:13:29 -0800 Stephen wrote:
SH> > I suspect you're putting clientaddr in snmpd.conf instead of snmp.conf. 
If you
SH> > want to do that, you have to prefix it for it to be recognized as a 
snmp.conf
SH> > token.. e.g.
SH> > 
SH> >  [snmp] clientaddr 192.168.1.99
SH> > 
SH> > If that's not the case, further debugging is needed...
SH> 
SH> I put it in snmp.conf. It is a bug, see the patch. Please apply.

I see the patch. It allows clientaddr to be in snmpd.conf without the [snmp]
prefix. But clientaddr is a snmp token, and does work in snmpd.conf when
properly prefixed.

1) run snmpd with a trapsink and no client address:

echo "rocommunity public" > /tmp/snmpd1.conf
echo "trapsink 192.168.1.99" >> /tmp/snmpd1.conf
snmpd -f -Lo -d -C -c /tmp/snmpd1.conf udp:1161

Sending 44 bytes to UDP: [192.168.1.99]:162->[0.0.0.0]
0000: 30 2A 02 01  00 04 06 70  75 62 6C 69  63 A4 1D 06    0*.....public...
0016: 0A 2B 06 01  04 01 BF 08  03 02 0A 40  04 C0 A8 01    .+.........@....
0032: 11 02 01 00  02 01 00 43  01 07 30 00                 .......C..0.

Note the [0.0.0.0], which indicates that we aren't bound to a particular
address and the OS will choose for us. and tcpdump sees the traffic:

00:42:47.043940 IP 192.168.1.17.40794 > 192.168.1.99.snmptrap:  Trap(29)  
.1.3.6.1.4.1.8072.3.2.10 192.168.1.17 coldStart 3


2) add a client address:

cp /tmp/snmpd1.conf /tmp/snmpd2.conf
echo "[snmp] clientaddr 192.168.1.17" >> /tmp/snmpd2.conf
snmpd -f -Lo -d -n -C -c /tmp/snmpd2.conf udp:1161

Sending 44 bytes to UDP: [192.168.1.99]:162->[192.168.1.17]
0000: 30 2A 02 01  00 04 06 70  75 62 6C 69  63 A4 1D 06    0*.....public...
0016: 0A 2B 06 01  04 01 BF 08  03 02 0A 40  04 C0 A8 01    .+.........@....
0032: 11 02 01 00  02 01 00 43  01 06 30 00                 .......C..0.

00:43:19.051092 IP 192.168.1.17.41518 > 192.168.1.99.snmptrap:  Trap(29)  
.1.3.6.1.4.1.8072.3.2.10 192.168.1.17 coldStart 3

same source address that the os picked.

3) use client address from another interface:

cp /tmp/snmpd1.conf /tmp/snmpd3.conf
echo "[snmp] clientaddr 192.168.56.1" >> /tmp/snmpd3.conf
snmpd -f -Lo -d -C -c /tmp/snmpd3.conf udp:1161

Sending 44 bytes to UDP: [192.168.1.99]:162->[192.168.56.1]
0000: 30 2A 02 01  00 04 06 70  75 62 6C 69  63 A4 1D 06    0*.....public...
0016: 0A 2B 06 01  04 01 BF 08  03 02 0A 40  04 C0 A8 01    .+.........@....
0032: 11 02 01 00  02 01 00 43  01 05 30 00                 .......C..0.

00:43:36.350656 IP 192.168.56.1.41094 > 192.168.1.99.snmptrap:  Trap(29)  
.1.3.6.1.4.1.8072.3.2.10 192.168.1.17 coldStart 3

Now the source address is a non-default address from another interface.
clientaddr is working fine.


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to