On Thu, Mar 18, 2010 at 09:02:57PM +0100, Bart Van Assche wrote:
> Hello,
> 
> During the latest Net-SNMP administrative meeting it has been brought up
> that it is inconvenient that AgentX clients on Windows using the Net-SNMP
> library have to set the AgentX target explicitly to "localhost:705". The
> patch below overcomes this, but at the same time changes the default AgentX
> target socket from ":705" (any interface) to "localhost:705". Is this
> acceptable ?
> 
> Index: agent/mibgroup/agentx/agentx_config.c
> ===================================================================
> --- agent/mibgroup/agentx/agentx_config.c       (revision 18337)
> +++ agent/mibgroup/agentx/agentx_config.c       (working copy)
> @@ -170,7 +170,7 @@ agentx_config_init(void)
>     netsnmp_register_default_domain("agentx", "unix tcp");
>     netsnmp_register_default_target("agentx", "unix",
> NETSNMP_AGENTX_SOCKET);
> #define val(x) __STRING(x)
> -    netsnmp_register_default_target("agentx", "tcp", ":" val(AGENTX_PORT));
> +    netsnmp_register_default_target("agentx", "tcp", "localhost:"
> val(AGENTX_PORT));
> #undef val
>     agentx_register_config_handler("agentxsocket",
>                                   agentx_parse_agentx_socket, NULL,
> 
> The output of netstat on Windows with a running agent with the above patch
> applied is as follows:
> 
> C:\>netstat -an|find "705"
>  TCP    127.0.0.1:705          0.0.0.0:0              LISTENING

This patch is something I think should be applied overall as it will affect
the default tcp host for master agents on unices as well and make it more
likely that it just works for subagents since they will try to connect to
localhost by default.

Before:

snmpd -x tcp: listens to *:705 (!)
agentxtrap -x tcp: connects to 0.0.0.0:705

After

snmpd -x tcp: listens to localhost:705
agentxtrap -x tcp: connects to localhost:705

On windows the default is equivalent to -x tcp:, on unix this behaviour comes
goes in if the unix socket can't be opened for some reason.

Note the security implications, so I think tihs should be backported to 5.5 as
well. (In 4.4 I think the fallback code to tcp was missing so it is not needed
due to security there but the nicer properties when connecting to a socket
makes it worthwile).

/MF

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to