On Sun, 2012-05-13 at 20:37 +0200, Niels Baggesen wrote:
> 
>            From: 
> Niels Baggesen
> <ni...@baggesen.net>
>              To: 
> net-snmp-coders
> <net-snmp-coders@lists.sourceforge.net>
>         Subject: 
> Fix for FreeBSD
> (and hopefully
> AIX) in 5.6.2rc1
> 
> 
> The attached patch fixes running the test suite under FreeBSD. It
> seems 
> that IP_SENDSRCADDR doesn't like the situation where the interface is 
> bound to a specific address, even if the passed in address is the
> same.
>
> It runs fine if the interface is bound to INADDR_ANY
>
> It also tries to fix bug 3525233.

Yes, this looks like two patches merged together, I would prefer if they
could be kept separated.

> Any votes for applying it?
>
> diff --git a/include/net-snmp/library/snmpUDPBaseDomain.h
> b/include/net-snmp/library/snmpUDPBaseDomain.h
> index e61cdc8..0a09f52 100644
> --- a/include/net-snmp/library/snmpUDPBaseDomain.h
> +++ b/include/net-snmp/library/snmpUDPBaseDomain.h
> @@ -9,6 +9,24 @@ config_require(SocketBase)
>  extern          "C" {
>  #endif

I would prefer if the defines of NETSNMP_DONTWAIT/NETSNMP_NOSIGNAL could
be kept in the various C files. With that it also becomes possible to
write them as

#ifndef MSG_foo
#define MSG_foo 0
#endif

> +#ifdef  MSG_DONTWAIT
> +#define NETSNMP_DONTWAIT MSG_DONTWAIT
> +#else
> +#define NETSNMP_DONTWAIT 0
> +#endif
> +
> +#ifdef  MSG_NOSIGNAL
> +#define NETSNMP_NOSIGNAL MSG_NOSIGNAL
> +#else
> +#define NETSNMP_NOSIGNAL 0
> +#endif

This part I strongly think should go into the C files as it defines a
symbol outside of the NETSNMP_ namespace.

> +#if defined(IP_RECVDSTADDR) && defined(__DragonFly__)
> +# ifndef IP_SENDSRCADDR
> +#  define IP_SENDSRCADDR IP_RECVDSTADDR /* DragonFly BSD */
> +# endif
> +#endif
> +
>  /*
>   * Prototypes
>   */
> diff --git a/snmplib/transports/snmpUDPBaseDomain.c
> b/snmplib/transports/snmpUDPBaseDomain.c
> index 5e680da..16e8581 100644
> --- a/snmplib/transports/snmpUDPBaseDomain.c
> +++ b/snmplib/transports/snmpUDPBaseDomain.c
> @@ -3,9 +3,6 @@
>  
>  #include <net-snmp/net-snmp-config.h>
>  
> -#include <net-snmp/types.h>
> -#include <net-snmp/library/snmpUDPBaseDomain.h>
> -
>  #include <stddef.h>
>  #include <stdio.h>
>  #include <sys/types.h>
> @@ -37,6 +34,7 @@
>  
>  #include <net-snmp/types.h>
>  #include <net-snmp/library/snmpSocketBaseDomain.h>
> +#include <net-snmp/library/snmpUDPBaseDomain.h>
>  #include <net-snmp/library/snmpUDPDomain.h>
>  #include <net-snmp/library/snmp_debug.h>
>  #include <net-snmp/library/tools.h>

I like those two first chunks a lot.

> @@ -92,15 +90,7 @@ _netsnmp_udp_sockopt_set(int fd, int local)
>      netsnmp_sock_buffer_set(fd, SO_RCVBUF, local, 0);
>  }
>  
> -#if (defined(linux) && defined(IP_PKTINFO)) \
> -    || defined(IP_RECVDSTADDR) && HAVE_STRUCT_MSGHDR_MSG_CONTROL \
> -                               && HAVE_STRUCT_MSGHDR_MSG_FLAGS
> -#if  defined(linux) && defined(IP_PKTINFO)



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to