]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1425] unpeer by association ID sets up for duplicate free().
authorDave Hart <hart@ntp.org>
Thu, 24 Dec 2009 22:04:26 +0000 (22:04 +0000)
committerDave Hart <hart@ntp.org>
Thu, 24 Dec 2009 22:04:26 +0000 (22:04 +0000)
[Bug 1434] HP-UX 11 ip_mreq undeclared, _HPUX_SOURCE helps some.
Use HAVE_WORKING_FORK instead of HAVE_FORK to avoid broken fork().

bk: 4b33e56aef6-ziGRDaAHnwswgbQpMg

ChangeLog
configure.ac
include/ntp_intres.h
m4/os_cflags.m4
ntpd/ntp_config.c
ntpsnmpd/netsnmp_daemonize.c
sntp/configure.ac
sntp/networking.c

index 1582ff76580ca8c658ce04f77bc932cd2ac4fd44..7b7b83c09fd1fa0c87f09dc9237049f2863469da 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,11 +4,13 @@
 * [Bug 1416] MAXDNAME undefined on Solaris 2.6.
 * [Bug 1419] ntpdate, ntpdc, sntp, ntpd ignore configure --bindir.
 * [Bug 1424] Fix check for rtattr (rtnetlink.h).
+* [Bug 1425] unpeer by association ID sets up for duplicate free().
 * [Bug 1426] scripts/VersionName needs . on the search path.
 * [Bug 1427] quote missing in ./build - shows up on NetBSD.
 * [Bug 1428] Use AC_HEADER_RESOLV to fix breaks from resolv.h
 * [Bug 1429] ntpd -4 option does not reliably force IPv4 resolution.
 * [Bug 1431] System headers must come before ntp headers in ntp_intres.c .
+* [Bug 1434] HP-UX 11 ip_mreq undeclared, _HPUX_SOURCE helps some.
 
 ---
 (4.2.6p1-RC1) 2009/12/20 Released by Harlan Stenn <stenn@ntp.org>
index 85962d692232adaa50660551207af0b3a12af6cf..db824340fdbca75b433f0cf1b39fe6bef1aca91b 100644 (file)
@@ -2138,36 +2138,57 @@ case "$ac_cv_var_ppsclock" in
  yes) AC_DEFINE(PPS, 1, [Do we have the ppsclock streams module?]) ;;
 esac
 
-AC_CACHE_CHECK([for kernel multicast support], ac_cv_var_mcast,
-  [ac_cv_var_mcast=no
-  case "$host" in
-   i386-sequent-sysv4) ;;
-   *) AC_EGREP_CPP(yes,
-  [#include <netinet/in.h>
-#ifdef IP_ADD_MEMBERSHIP
-   yes
-#endif
-  ], ac_cv_var_mcast=yes) ;;
-  esac])
-case "$ac_cv_var_mcast" in
- yes)
-    AC_DEFINE(MCAST, 1, [Does the kernel support multicasting IP?])
-    AC_CACHE_CHECK([[arg type needed for IP*_MULTICAST_LOOP for setsockopt()]],
-       ac_cv_var_typeof_ip_multicast_loop,
-       [case "$host" in
-        *-*-netbsd*|*-*-*linux*)
-           ac_cv_var_typeof_ip_multicast_loop=u_int
-           ;;
-        *-*-winnt*)
-           ac_cv_var_typeof_ip_multicast_loop=BOOL
-           ;;
-        *) ac_cv_var_typeof_ip_multicast_loop=u_char
+AC_CACHE_CHECK(
+    [for multicast IP support],
+    ntp_cv_multicast,
+    [
+       ntp_cv_multicast=no
+       case "$host" in
+        i386-sequent-sysv4)
            ;;
-       esac])
-    AC_DEFINE_UNQUOTED(TYPEOF_IP_MULTICAST_LOOP,
-                  $ac_cv_var_typeof_ip_multicast_loop,
-                  [What type to use for setsockopt])
-    ;;
+        *)
+           AC_COMPILE_IFELSE(
+               AC_LANG_PROGRAM(
+                   [
+                       #ifdef HAVE_NETINET_IN_H
+                       #include <netinet/in.h>
+                       #endif
+                   ],
+                   [
+                       struct ip_mreq ipmr;
+                       ipmr.imr_interface.s_addr = 0;
+                   ]
+               ),
+               [ntp_cv_multicast=yes],
+               []
+           )
+       esac
+    ]
+)
+
+case "$ntp_cv_multicast" in
+ yes)
+    AC_DEFINE(MCAST, 1, [Does the target support multicast IP?])
+    AC_CACHE_CHECK(
+       [[arg type needed for setsockopt() IP*_MULTICAST_LOOP]],
+       ntp_cv_typeof_ip_multicast_loop,
+       [
+           case "$host" in
+            *-*-netbsd*|*-*-*linux*)
+               ntp_cv_typeof_ip_multicast_loop=u_int
+               ;;
+            *-*-winnt*)
+               ntp_cv_typeof_ip_multicast_loop=BOOL
+               ;;
+            *)
+               ntp_cv_typeof_ip_multicast_loop=u_char
+           esac
+       ]
+    )
+    AC_DEFINE_UNQUOTED([TYPEOF_IP_MULTICAST_LOOP],
+       $ntp_cv_typeof_ip_multicast_loop,
+       [What type to use for setsockopt]
+    )
 esac
 
 AC_CACHE_CHECK([[availability of ntp_{adj,get}time()]], ac_cv_var_ntp_syscalls,
index 1072833aa2cfa32733917786d8a86554287da111..53c8a63a40764a7e7350e688f6801ddd93c5ee66 100644 (file)
@@ -7,7 +7,7 @@
  * to using numeric IP addresses.
  */
 #if defined(VMS) || defined (SYS_VXWORKS) || \
-    (!defined(HAVE_FORK) && !defined(SYS_WINNT))
+    (!defined(HAVE_WORKING_FORK) && !defined(SYS_WINNT))
 #define NO_INTRES
 #endif
 
index 40bf18e441e364999546d19856506cadf31be166..7fac93bd1e8c6207cb4eea205fe55db92309e0c5 100644 (file)
@@ -40,6 +40,7 @@ AC_DEFUN([NTP_OS_CFLAGS], [
                ntp_os_cflags="-Ae -Wp,-H18816"
                ;;
            esac
+           ntp_os_cflags="${ntp_os_cflags} -D_HPUX_SOURCE"
            ;;
         hpux*)
            case "$GCC" in
@@ -49,6 +50,7 @@ AC_DEFUN([NTP_OS_CFLAGS], [
                # use Ansi compiler on HPUX
                ntp_os_cflags="-Ae"
            esac
+           ntp_os_cflags="${ntp_os_cflags} -D_HPUX_SOURCE"
            ;;
         irix6*)
            case "$CC" in
index 65e02c86c783b9cc2d1f73f6cdcdeb34432fc1e8..9426e0a0fa5d0615b76acae2b8619f94043dab2f 100644 (file)
@@ -3501,8 +3501,6 @@ config_unpeers(
                                unpeer(peer);
                        }       
 
-                       /* Ok, everything done. Free up peer node memory */
-                       free_node(curr_unpeer);
                        continue;
                }
 
index d4da614ac417491f38ef6983e4914077cffd651c..43cba8922ca18765f49fac4e6acacff028f5f709 100644 (file)
@@ -192,7 +192,7 @@ netsnmp_daemonize(int quit_immediately, int stderr_log)
 {
     int i = 0;
     DEBUGMSGT(("daemonize","deamonizing...\n"));
-#if HAVE_FORK
+#if HAVE_WORKING_FORK
     /*
      * Fork to return control to the invoking process and to
      * guarantee that we aren't a process group leader.
@@ -257,7 +257,7 @@ netsnmp_daemonize(int quit_immediately, int stderr_log)
         }
 #endif /* !WIN32 */
     }
-#endif /* HAVE_FORK */
+#endif /* HAVE_WORKING_FORK */
     return i;
 }
 
index 348ad48772546efdd213f2734504004b65e83602..61be1b81c7f986749cc04dc9224639fc8b42ae7e 100644 (file)
@@ -411,6 +411,59 @@ case "$isc_cv_have_in_port_t" in
        AC_DEFINE(ISC_PLATFORM_NEEDPORTT, 1, [Declare in_port_t?])
 esac
 
+AC_CACHE_CHECK(
+    [for multicast IP support],
+    ntp_cv_multicast,
+    [
+       ntp_cv_multicast=no
+       case "$host" in
+        i386-sequent-sysv4)
+           ;;
+        *)
+           AC_COMPILE_IFELSE(
+               AC_LANG_PROGRAM(
+                   [
+                       #ifdef HAVE_NETINET_IN_H
+                       #include <netinet/in.h>
+                       #endif
+                   ],
+                   [
+                       struct ip_mreq ipmr;
+                       ipmr.imr_interface.s_addr = 0;
+                   ]
+               ),
+               [ntp_cv_multicast=yes],
+               []
+           )
+       esac
+    ]
+)
+
+case "$ntp_cv_multicast" in
+ yes)
+    AC_DEFINE(MCAST, 1, [Does the target support multicast IP?])
+    AC_CACHE_CHECK(
+       [[arg type needed for setsockopt() IP*_MULTICAST_LOOP]],
+       ntp_cv_typeof_ip_multicast_loop,
+       [
+           case "$host" in
+            *-*-netbsd*|*-*-*linux*)
+               ntp_cv_typeof_ip_multicast_loop=u_int
+               ;;
+            *-*-winnt*)
+               ntp_cv_typeof_ip_multicast_loop=BOOL
+               ;;
+            *)
+               ntp_cv_typeof_ip_multicast_loop=u_char
+           esac
+       ]
+    )
+    AC_DEFINE_UNQUOTED([TYPEOF_IP_MULTICAST_LOOP],
+       $ntp_cv_typeof_ip_multicast_loop,
+       [What type to use for setsockopt]
+    )
+esac
+
 AC_SEARCH_LIBS([inet_ntop], [resolv], , , [-lsocket -lnsl])
 AC_CHECK_FUNC(inet_ntop, [], [AC_DEFINE(ISC_PLATFORM_NEEDNTOP, 1, [ISC: provide inet_ntop()])])
 AC_CHECK_FUNC(inet_pton, [], [AC_DEFINE(ISC_PLATFORM_NEEDPTON, 1, [ISC: provide inet_pton()])])
index f79bff1d968b147fe4742202695cfbba905e7880..9aaff7a1b524290ae5548596ac3497bbaeb7260c 100644 (file)
@@ -188,7 +188,12 @@ recv_bcst_data (
        setsockopt(rsock, SOL_SOCKET, SO_REUSEADDR, &btrue, sizeof(btrue));
 
        if (IS_IPV4(sas)) {
+#ifndef MCAST
+               return BROADCAST_FAILED;
+#else
                struct ip_mreq mdevadr;
+               TYPEOF_IP_MULTICAST_LOOP mtrue = 1;
+
        
                if (bind(rsock, &sas->sa, SOCKLEN(sas)) < 0) {
                        if (ENABLED_OPT(NORMALVERBOSE))
@@ -196,7 +201,7 @@ recv_bcst_data (
                }
 
 
-               if (setsockopt(rsock, IPPROTO_IP, IP_MULTICAST_LOOP, &btrue, sizeof(btrue)) < 0) {
+               if (setsockopt(rsock, IPPROTO_IP, IP_MULTICAST_LOOP, &mtrue, sizeof(mtrue)) < 0) {
                        /* some error message regarding setting up multicast loop */
                        return BROADCAST_FAILED;
                }
@@ -224,6 +229,7 @@ recv_bcst_data (
                                return BROADCAST_FAILED;
                        }
                }
+#endif /* MCAST */
        }
 #ifdef ISC_PLATFORM_HAVEIPV6
        else if (IS_IPV6(sas)) {