2005-09-29 Alain Ritoux <alain.ritoux@6wind.com>

    * lib/filer.c: show protocol name in filter_show()
    * lib/plist.c: show protocol name in vty_show_prefix_entry()
    * routemap.c: show protocol name in vty_show_route_map_entry()
    * lib/vty.c: in vty_command(), show protocol name if command unknown

    * zebra/zserv.c: Always provide distance fo route add

    * ripd/rip_snmp.c: rip2IfConfReceive() sends values in conformance
      with RFC. Also PeerDomain is now set to a STRING type.
    * ripd/ripd.h: rip_redistribute_add() API includes metric and distance
    * ripd/ripd.c: rip_redistribute_add() API i.e. stores metric and distance
      Now allows a RIP-route to overcome a redistributed route coming
      from a protocol with worse (higher) administrative distance
      Metrics from redistribution are shown in show ip rip
    * ripd/rip_zebra.c: adapt to the rip_redistribute_add() API, i.e.
      provide distance and metric
    * ripd/rip_interface.c: adapt to the rip_redistribute_add() API
    * ripd/rip_routemap.c: no RMAP_COMPILE_ERROR on (metric > 16) usage
      rather a CMD_WARNING, because set metric ius shared with other
      protocols using larger values (such as OSPF)
      The match metric action takes first external metric if present
      (from redistribution) then RIP metric.
diff --git a/ripd/rip_snmp.c b/ripd/rip_snmp.c
index 93773bc..c1bec76 100644
--- a/ripd/rip_snmp.c
+++ b/ripd/rip_snmp.c
@@ -136,7 +136,7 @@
   {RIP2PEERADDRESS,           IPADDRESS, RONLY, rip2PeerTable,
    /* RIP Peer Table. */
    3, {4, 1, 1}},
-  {RIP2PEERDOMAIN,            INTEGER, RONLY, rip2PeerTable,
+  {RIP2PEERDOMAIN,            STRING, RONLY, rip2PeerTable,
    3, {4, 1, 2}},
   {RIP2PEERLASTUPDATE,        TIMETICKS, RONLY, rip2PeerTable,
    3, {4, 1, 3}},
@@ -419,15 +419,19 @@
 #define rip1OrRip2      3
 #define doNotReceive    4
 
+  int recvv;
+
   if (! ri->running)
     return doNotReceive;
 
-  if (ri->ri_receive == RI_RIP_VERSION_1_AND_2)
+  recvv = (ri->ri_receive == RI_RIP_UNSPEC) ?  rip->version_recv :
+                                               ri->ri_receive;
+  if (recvv == RI_RIP_VERSION_1_AND_2)
     return rip1OrRip2;
-  else if (ri->ri_receive & RIPv2)
-    return ripVersion2;
-  else if (ri->ri_receive & RIPv1)
-    return ripVersion1;
+  else if (recvv & RIPv2)
+    return rip2;
+  else if (recvv & RIPv1)
+    return rip1;
   else
     return doNotReceive;
 }
@@ -508,6 +512,7 @@
 	       int exact, size_t *val_len, WriteMethod **write_method)
 {
   static struct in_addr addr;
+  static int domain = 0;
   static int version;
   /* static time_t uptime; */
 
@@ -527,8 +532,8 @@
       return (u_char *) &peer->addr;
 
     case RIP2PEERDOMAIN:
-      *val_len = sizeof (int);
-      return (u_char *) &peer->domain;
+      *val_len = 2;
+      return (u_char *) &domain;
 
     case RIP2PEERLASTUPDATE:
 #if 0