[AGENT++] Questions

Jochen Katz katz at agentpp.com
Mon Nov 21 22:04:27 CET 2011


Hi,

> In my application, I would like to have two Snmp objects to receive
> traps at the same time. One object is for ipv4, and the other object
> is for ipv6. It works normal in windows system, but failed in
> suse_linux_11_x64 system when I called notify_register() like below: 
> How can I fix it?

this is caused by the ipv4 to ipv6 mapping. For default Linux, this is
enabled on IPv6 sockets and as snmp++ does not enable the IPV6_V6ONLY on
the v6 socket, the bind fails, as the ipv4 part is in use.

You can either do a "echo 1 > /proc/sys/net/ipv6/bindv6only" or patch
the ipv6 part of CNotifyEventQueue::AddEntry() function to use setsockopt():

      int on = 1;
      if (setsockopt(m_notify_fd, IPPROTO_IPV6, IPV6_V6ONLY,
		     (char *)&on, sizeof(on)) == -1)
	perror("setsockopt IPV6_V6ONLY");
      else
	printf("IPV6_V6ONLY option set");

      // set up the manager socket attributes
      struct sockaddr_in6 mgr_addr;
      ...

I think, this is worth a cofiguration option...

> In Sun Solaris10 system (64bit), the ipv6 version of snmp++ library
> crashed in the following code:

Is unsigned int a 64 bit value? Then replace scope and scope_ptr by a
32bit type and tell me if this fixed it.

Regards,
  Jochen



More information about the AGENTPP mailing list