Merge branch 'bgpd/fsm'
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 9ff6465..50407e4 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -10291,7 +10291,7 @@
 
 DEFUN (show_ip_bgp_view_rsclient_route,
        show_ip_bgp_view_rsclient_route_cmd,
-       "show bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
+       "show ip bgp view WORD rsclient (A.B.C.D|X:X::X:X) A.B.C.D",
        SHOW_STR
        IP_STR
        BGP_STR
diff --git a/configure.ac b/configure.ac
index 547b686..a974daa 100755
--- a/configure.ac
+++ b/configure.ac
@@ -8,7 +8,7 @@
 ## $Id$
 AC_PREREQ(2.53)
 
-AC_INIT(Quagga, 0.99.10, [http://bugzilla.quagga.net])
+AC_INIT(Quagga, 0.99.11, [http://bugzilla.quagga.net])
 AC_CONFIG_SRCDIR(lib/zebra.h)
 
 dnl -----------------------------------
@@ -1390,10 +1390,8 @@
 AC_SUBST(CONFDATE)
 
 dnl Conditionally enable PIE support for GNU toolchains.
-enable_pie=yes
-
 AC_ARG_ENABLE(pie, AS_HELP_STRING([--disable-pie], [Do not build tools as a Position Independent Executables]))
-if test "$enable_pie" = "yes"; then
+if test "$enable_pie" != "no"; then
   AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
     save_CFLAGS=$CFLAGS
     save_LDFLAGS=$LDFLAGS
diff --git a/lib/sockunion.c b/lib/sockunion.c
index cfd3bf9..8fbe345 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -227,6 +227,24 @@
   return XSTRDUP (MTYPE_TMP, str);
 }
 
+/* Convert IPv4 compatible IPv6 address to IPv4 address. */
+static void
+sockunion_normalise_mapped (union sockunion *su)
+{
+  struct sockaddr_in sin;
+  
+#ifdef HAVE_IPV6
+  if (su->sa.sa_family == AF_INET6 
+      && IN6_IS_ADDR_V4MAPPED (&su->sin6.sin6_addr))
+    {
+      memset (&sin, 0, sizeof (struct sockaddr_in));
+      sin.sin_family = AF_INET;
+      memcpy (&sin.sin_addr, ((char *)&su->sin6.sin6_addr) + 12, 4);
+      memcpy (su, &sin, sizeof (struct sockaddr_in));
+    }
+#endif /* HAVE_IPV6 */
+}
+
 /* Return socket of sockunion. */
 int
 sockunion_socket (union sockunion *su)
@@ -253,23 +271,6 @@
   len = sizeof (union sockunion);
   client_sock = accept (sock, (struct sockaddr *) su, &len);
   
-  /* Convert IPv4 compatible IPv6 address to IPv4 address. */
-#if 0
-#ifdef HAVE_IPV6
-  if (su->sa.sa_family == AF_INET6)
-    {
-      if (IN6_IS_ADDR_V4MAPPED (&su->sin6.sin6_addr))
-	{
-	  struct sockaddr_in sin;
-
-	  memset (&sin, 0, sizeof (struct sockaddr_in));
-	  sin.sin_family = AF_INET;
-	  memcpy (&sin.sin_addr, ((char *)&su->sin6.sin6_addr) + 12, 4);
-	  memcpy (su, &sin, sizeof (struct sockaddr_in));
-	}
-    }
-#endif /* HAVE_IPV6 */
-#endif
   return client_sock;
 }
 
@@ -592,18 +593,7 @@
     {
       su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion));
       memcpy (su, &name, sizeof (struct sockaddr_in6));
-
-#if 0
-      if (IN6_IS_ADDR_V4MAPPED (&su->sin6.sin6_addr))
-	{
-	  struct sockaddr_in sin;
-
-	  sin.sin_family = AF_INET;
-	  memcpy (&sin.sin_addr, ((char *)&su->sin6.sin6_addr) + 12, 4);
-	  sin.sin_port = su->sin6.sin6_port;
-	  memcpy (su, &sin, sizeof (struct sockaddr_in));
-	}
-#endif
+      sockunion_normalise_mapped (su);
       return su;
     }
 #endif /* HAVE_IPV6 */
@@ -648,17 +638,7 @@
     {
       su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion));
       memcpy (su, &name, sizeof (struct sockaddr_in6));
-#if 0
-      if (IN6_IS_ADDR_V4MAPPED (&su->sin6.sin6_addr))
-	{
-	  struct sockaddr_in sin;
-
-	  sin.sin_family = AF_INET;
-	  memcpy (&sin.sin_addr, ((char *)&su->sin6.sin6_addr) + 12, 4);
-	  sin.sin_port = su->sin6.sin6_port;
-	  memcpy (su, &sin, sizeof (struct sockaddr_in));
-	}
-#endif
+      sockunion_normalise_mapped (su);
       return su;
     }
 #endif /* HAVE_IPV6 */
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index ed342e7..5f0d99d 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -765,24 +765,6 @@
       return;
     }
 
-  /* If incoming interface is passive one, ignore Hello. */
-  if (OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_PASSIVE) {
-    char buf[3][INET_ADDRSTRLEN];
-    zlog_debug ("ignoring HELLO from router %s sent to %s, "
-	        "received on a passive interface, %s",
-	        inet_ntop(AF_INET, &ospfh->router_id, buf[0], sizeof(buf[0])),
-	        inet_ntop(AF_INET, &iph->ip_dst, buf[1], sizeof(buf[1])),
-	        inet_ntop(AF_INET, &oi->address->u.prefix4,
-	      		  buf[2], sizeof(buf[2])));
-    if (iph->ip_dst.s_addr == htonl(OSPF_ALLSPFROUTERS))
-      {
-        /* Try to fix multicast membership. */
-        OI_MEMBER_JOINED(oi, MEMBER_ALLROUTERS);
-        ospf_if_set_multicast(oi);
-      }
-    return;
-  }
-
   /* get neighbor prefix. */
   p.family = AF_INET;
   p.prefixlen = ip_masklen (hello->network_mask);
@@ -2393,6 +2375,32 @@
   /* associate packet with ospf interface */
   oi = ospf_if_lookup_recv_if (ospf, iph->ip_src);
 
+  /* If incoming interface is passive one, ignore it. */
+  if (oi && OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_PASSIVE)
+    {
+      char buf[3][INET_ADDRSTRLEN];
+
+      if (IS_DEBUG_OSPF_EVENT)
+	zlog_debug ("ignoring packet from router %s sent to %s, "
+		    "received on a passive interface, %s",
+		    inet_ntop(AF_INET, &ospfh->router_id, buf[0], sizeof(buf[0])),
+		    inet_ntop(AF_INET, &iph->ip_dst, buf[1], sizeof(buf[1])),
+		    inet_ntop(AF_INET, &oi->address->u.prefix4,
+			      buf[2], sizeof(buf[2])));
+
+      if (iph->ip_dst.s_addr == htonl(OSPF_ALLSPFROUTERS))
+	{
+	  /* Try to fix multicast membership.
+	   * Some OS:es may have problems in this area,
+	   * make sure it is removed.
+	   */
+	  OI_MEMBER_JOINED(oi, MEMBER_ALLROUTERS);
+	  ospf_if_set_multicast(oi);
+	}
+      return 0;
+  }
+
+
   /* if no local ospf_interface, 
    * or header area is backbone but ospf_interface is not
    * check for VLINK interface
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 32580cc..c951a29 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -998,8 +998,8 @@
   if (!ospf)
     ospf = ospf_lookup ();
 
-  /* Router-ID must be configured. */
-  if (ospf->router_id.s_addr == 0)
+  /* OSPF must be on and Router-ID must be configured. */
+  if (!ospf || ospf->router_id.s_addr == 0)
     return;
   
   /* Run each netowrk for this interface. */