Merge remote branch 'origin/master'
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 4f3f85b..5e175c8 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -9635,7 +9635,33 @@
   return CMD_SUCCESS;
 }
 
-DEFUN (show_ip_bgp_neighbor_advertised_route,
+DEFUN (show_ip_bgp_view_neighbor_advertised_route,
+       show_ip_bgp_view_neighbor_advertised_route_cmd,
+       "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X) advertised-routes",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "BGP view\n"
+       "View name\n"
+       "Detailed information on TCP and BGP neighbor connections\n"
+       "Neighbor to display information about\n"
+       "Neighbor to display information about\n"
+       "Display the routes advertised to a BGP neighbor\n")
+{
+  struct peer *peer;
+
+  if (argc == 2)
+    peer = peer_lookup_in_view (vty, argv[0], argv[1]);
+  else
+    peer = peer_lookup_in_view (vty, NULL, argv[0]);
+
+  if (! peer) 
+    return CMD_WARNING;
+ 
+  return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0);
+}
+
+ALIAS (show_ip_bgp_view_neighbor_advertised_route,
        show_ip_bgp_neighbor_advertised_route_cmd,
        "show ip bgp neighbors (A.B.C.D|X:X::X:X) advertised-routes",
        SHOW_STR
@@ -9645,15 +9671,6 @@
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
        "Display the routes advertised to a BGP neighbor\n")
-{
-  struct peer *peer;
-
-  peer = peer_lookup_in_view (vty, NULL, argv[0]);  
-  if (! peer) 
-    return CMD_WARNING;
- 
-  return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 0);
-}
 
 DEFUN (show_ip_bgp_ipv4_neighbor_advertised_route,
        show_ip_bgp_ipv4_neighbor_advertised_route_cmd,
@@ -9813,7 +9830,33 @@
 }
 #endif /* HAVE_IPV6 */
 
-DEFUN (show_ip_bgp_neighbor_received_routes,
+DEFUN (show_ip_bgp_view_neighbor_received_routes,
+       show_ip_bgp_view_neighbor_received_routes_cmd,
+       "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X) received-routes",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "BGP view\n"
+       "View name\n"
+       "Detailed information on TCP and BGP neighbor connections\n"
+       "Neighbor to display information about\n"
+       "Neighbor to display information about\n"
+       "Display the received routes from neighbor\n")
+{
+  struct peer *peer;
+
+  if (argc == 2)
+    peer = peer_lookup_in_view (vty, argv[0], argv[1]);
+  else
+    peer = peer_lookup_in_view (vty, NULL, argv[0]);
+
+  if (! peer)
+    return CMD_WARNING;
+
+  return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1);
+}
+
+ALIAS (show_ip_bgp_view_neighbor_received_routes,
        show_ip_bgp_neighbor_received_routes_cmd,
        "show ip bgp neighbors (A.B.C.D|X:X::X:X) received-routes",
        SHOW_STR
@@ -9823,15 +9866,6 @@
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
        "Display the received routes from neighbor\n")
-{
-  struct peer *peer;
-
-  peer = peer_lookup_in_view (vty, NULL, argv[0]);
-  if (! peer)
-    return CMD_WARNING;
-
-  return peer_adj_routes (vty, peer, AFI_IP, SAFI_UNICAST, 1);
-}
 
 DEFUN (show_ip_bgp_ipv4_neighbor_received_routes,
        show_ip_bgp_ipv4_neighbor_received_routes_cmd,
@@ -11758,6 +11792,8 @@
   install_element (VIEW_NODE, &show_ip_bgp_rsclient_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_rsclient_route_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_rsclient_prefix_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_view_neighbor_advertised_route_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_view_neighbor_received_routes_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_view_rsclient_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_view_rsclient_route_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_view_rsclient_prefix_cmd);
@@ -11863,6 +11899,8 @@
   install_element (ENABLE_NODE, &show_ip_bgp_rsclient_cmd);
   install_element (ENABLE_NODE, &show_ip_bgp_rsclient_route_cmd);
   install_element (ENABLE_NODE, &show_ip_bgp_rsclient_prefix_cmd);
+  install_element (ENABLE_NODE, &show_ip_bgp_view_neighbor_advertised_route_cmd);
+  install_element (ENABLE_NODE, &show_ip_bgp_view_neighbor_received_routes_cmd);
   install_element (ENABLE_NODE, &show_ip_bgp_view_rsclient_cmd);
   install_element (ENABLE_NODE, &show_ip_bgp_view_rsclient_route_cmd);
   install_element (ENABLE_NODE, &show_ip_bgp_view_rsclient_prefix_cmd);
diff --git a/configure.ac b/configure.ac
index d0d8183..cd883d2 100755
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,8 @@
 fi
 AC_ARG_VAR([GAWK],[GNU AWK])
 
+AC_SYS_LARGEFILE
+
 dnl default is to match previous behavior
 exampledir=${sysconfdir}
 AC_ARG_ENABLE([exampledir],
diff --git a/ospfclient/ospfclient.c b/ospfclient/ospfclient.c
index ef1d22b..3608eba 100644
--- a/ospfclient/ospfclient.c
+++ b/ospfclient/ospfclient.c
@@ -12,6 +12,7 @@
 #include <zebra.h>
 #include "prefix.h" /* needed by ospf_asbr.h */
 #include "privs.h"
+#include "log.h"
 
 #include "ospfd/ospfd.h"
 #include "ospfd/ospf_asbr.h"
diff --git a/ospfd/ospf_lsdb.c b/ospfd/ospf_lsdb.c
index a992cf4..2e1bded 100644
--- a/ospfd/ospf_lsdb.c
+++ b/ospfd/ospf_lsdb.c
@@ -25,6 +25,7 @@
 #include "prefix.h"
 #include "table.h"
 #include "memory.h"
+#include "log.h"
 
 #include "ospfd/ospfd.h"
 #include "ospfd/ospf_asbr.h"
diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c
index 23ff64f..4a315a5 100644
--- a/vtysh/vtysh_main.c
+++ b/vtysh/vtysh_main.c
@@ -42,6 +42,7 @@
 
 /* Configuration file name and directory. */
 char config_default[] = SYSCONFDIR VTYSH_DEFAULT_CONFIG;
+char history_file[MAXPATHLEN];
 
 /* Flag for indicate executing child command. */
 int execute_flag = 0;
@@ -188,8 +189,10 @@
     {
       using_history();
       last = previous_history();
-      if (!last || strcmp (last->line, line_read) != 0)
+      if (!last || strcmp (last->line, line_read) != 0) {
 	add_history (line_read);
+	append_history(1,history_file);
+      }
     }
      
   return (line_read);
@@ -399,10 +402,13 @@
   sigsetjmp (jmpbuf, 1);
   jmpflag = 1;
 
+  snprintf(history_file, sizeof(history_file), "%s/.history_quagga", getenv("HOME"));
+  read_history(history_file);
   /* Main command loop. */
   while (vtysh_rl_gets ())
     vtysh_execute (line_read);
 
+  history_truncate_file(history_file,1000);
   printf ("\n");
 
   /* Rest in peace. */
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index e2108fc..e11afaf 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -905,7 +905,7 @@
 nexthop_active_update (struct route_node *rn, struct rib *rib, int set)
 {
   struct nexthop *nexthop;
-  int prev_active, new_active;
+  int prev_active, prev_index, new_active;
 
   rib->nexthop_active_num = 0;
   UNSET_FLAG (rib->flags, ZEBRA_FLAG_CHANGED);
@@ -913,9 +913,11 @@
   for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
   {
     prev_active = CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE);
+    prev_index = nexthop->ifindex;
     if ((new_active = nexthop_active_check (rn, rib, nexthop, set)))
       rib->nexthop_active_num++;
-    if (prev_active != new_active)
+    if (prev_active != new_active ||
+	prev_index != nexthop->ifindex)
       SET_FLAG (rib->flags, ZEBRA_FLAG_CHANGED);
   }
   return rib->nexthop_active_num;