]> git.puffer.fish Git - mirror/frr.git/commitdiff
2005-09-29 Alain Ritoux <alain.ritoux@6wind.com>
authorvincent <vincent>
Thu, 29 Sep 2005 13:52:57 +0000 (13:52 +0000)
committervincent <vincent>
Thu, 29 Sep 2005 13:52:57 +0000 (13:52 +0000)
    * ospfd/ospf_vty.c: forece default route LSA to be re_issued whenever
      cost is changed ( [no] ip ospf area XXX default-cost YYY)
      Support ignore-mtu option
    * ospfd/ospfd.h: define OSPF_MTU_IGNORE_DEFAULT
    * ospfd/ospf_packet.c: support ignore-mtu option
    * ospfd/ospf_interface.h: field added for skipping MTU check
    * ospfd/ospf_interface.c: fix memory leak in ospf_crypt_key_delete()
      Set mtu_ignore field to default value
    * ospfd/ospf_abr.[ch]: export ospf_abr_announce_network_to_area()
    * ospfd/ospf_ism.h: add MACRO to convert internal ISM status into SNMP
      correct values
    * ospfd/ospf_snmp.c: add sanity check on LSA type in lsdb_lookup_next()
      convert OSPFIFSTATE internal status into SNMP values

ospfd/ChangeLog
ospfd/ospf_abr.c
ospfd/ospf_abr.h
ospfd/ospf_interface.c
ospfd/ospf_interface.h
ospfd/ospf_ism.h
ospfd/ospf_packet.c
ospfd/ospf_snmp.c
ospfd/ospf_vty.c
ospfd/ospfd.h

index bef4c6438e0dd674ed3e5ac7ac7d0e1dadf515aa..2cc9a4fd7b0ee35321f944fd1f52a6b99b6b4914 100644 (file)
@@ -1,3 +1,19 @@
+2005-09-29 Alain Ritoux <alain.ritoux@6wind.com>
+
+       * ospf_vty.c: forece default route LSA to be re_issued whenever
+         cost is changed ( [no] ip ospf area XXX default-cost YYY)
+         Support ignore-mtu option
+       * ospfd.h: define OSPF_MTU_IGNORE_DEFAULT
+       * ospf_packet.c: support ignore-mtu option
+       * ospf_interface.h: field added for skipping MTU check 
+       * ospf_interface.c: fix memory leak in ospf_crypt_key_delete()
+         Set mtu_ignore field to default value
+       * ospf_abr.[ch]: export ospf_abr_announce_network_to_area()
+       * ospf_ism.h: add MACRO to convert internal ISM status into SNMP
+         correct values
+       * ospf_snmp.c: add sanity check on LSA type in lsdb_lookup_next()
+         convert OSPFIFSTATE internal status into SNMP values
+
 2005-09-28 Alain Ritoux <alain.ritoux@6wind.com>
 
        * ospf_packet.c: use new md5 API
index 486ad954c6c6afb76b6c799b1341411b813b8b94..2d47efec1305f5ba9222eab335c9bc7369b6fdba 100644 (file)
@@ -707,7 +707,7 @@ ospf_abr_translate_nssa_range (struct prefix_ipv4 *p, u_int32_t cost)
      for lsa installation and flooding... to be added... */
 }
 
-static void
+void
 ospf_abr_announce_network_to_area (struct prefix_ipv4 *p, u_int32_t cost,
                                   struct ospf_area *area)
 {
index a85ec84610534cfede5aed5f36d0df423b5006d3..e367e44772d122ccd2e464c4fc2d5de131d0c340 100644 (file)
@@ -88,4 +88,7 @@ extern void ospf_check_abr_status (struct ospf *);
 extern void ospf_abr_task (struct ospf *);
 extern void ospf_schedule_abr_task (struct ospf *);
 
+extern void ospf_abr_announce_network_to_area (struct prefix_ipv4 *, 
+                                               u_int32_t,
+                                               struct ospf_area *);
 #endif /* _ZEBRA_OSPF_ABR_H */
index 45fa023836508ee1c4c814d10830b6fec035d52a..9d31b7a37f946a832a3c0c351a92e174b6e954c9 100644 (file)
@@ -692,6 +692,8 @@ ospf_if_new_hook (struct interface *ifp)
   SET_IF_PARAM (IF_DEF_PARAMS (ifp), priority);
   IF_DEF_PARAMS (ifp)->priority = OSPF_ROUTER_PRIORITY_DEFAULT;
 
+  IF_DEF_PARAMS (ifp)->mtu_ignore = OSPF_MTU_IGNORE_DEFAULT;
+
   SET_IF_PARAM (IF_DEF_PARAMS (ifp), passive_interface);
   IF_DEF_PARAMS (ifp)->passive_interface = OSPF_IF_ACTIVE;
 
@@ -1223,6 +1225,7 @@ ospf_crypt_key_delete (struct list *auth_crypt, u_char key_id)
       if (ck->key_id == key_id)
         {
           listnode_delete (auth_crypt, ck);
+          XFREE (MTYPE_OSPF_CRYPT_KEY, ck);
           return 1;
         }
     }
index 0e7f22ab547a2686fc85cc237cbf6b52276e7167..2b129859b3d63ce15ebf973f7d41064ecb27ff09 100644 (file)
@@ -53,6 +53,9 @@ struct ospf_if_params
   DECLARE_IF_PARAM (u_int32_t, v_hello);             /* Hello Interval */
   DECLARE_IF_PARAM (u_int32_t, v_wait);              /* Router Dead Interval */
 
+  /* MTU mismatch check (see RFC2328, chap 10.6) */ 
+  DECLARE_IF_PARAM (u_char, mtu_ignore);
+
   /* Authentication data. */
   u_char auth_simple[OSPF_AUTH_SIMPLE_SIZE + 1];       /* Simple password. */
   u_char auth_simple__config:1;
index 58f80c383a6a52919c7b6d0bb044ee581bfce4b1..94d75b492d559bbbab96bafbda6dd2dd093ea36b 100644 (file)
 #define ISM_DR                            7
 #define OSPF_ISM_STATE_MAX               8
 
+/* Because DR/DROther values are exhanged wrt RFC */
+#define ISM_SNMP(x) (((x) == ISM_DROther) ? ISM_DR : \
+                     ((x) == ISM_DR) ? ISM_DROther : (x))
+
 /* OSPF Interface State Machine Event. */
 #define ISM_NoEvent                       0
 #define ISM_InterfaceUp                   1
index ceb6a20c484f09104b9feba313cede6e4ccbbe3e..c869d3d808b7e0d301736627c403553fb96ea38c 100644 (file)
@@ -1111,7 +1111,8 @@ ospf_db_desc (struct ip *iph, struct ospf_header *ospfh,
     }
 
   /* Check MTU. */
-  if (ntohs (dd->mtu) > oi->ifp->mtu)
+  if ((OSPF_IF_PARAM (oi, mtu_ignore) == 0) && 
+      (ntohs (dd->mtu) > oi->ifp->mtu))
     {
       zlog_warn ("Packet[DD]: Neighbor %s MTU %u is larger than [%s]'s MTU %u",
                 inet_ntoa (nbr->router_id), ntohs (dd->mtu),
index 4ed1fab8900dffc662bb357fb5dac5cec2af359c..d0c1290725b797bbd0ba0eddb754a11e4a956cc2 100644 (file)
@@ -1,4 +1,5 @@
 /* OSPFv2 SNMP support
+ * Copyright (C) 2005 6WIND <alain.ritoux@6wind.com>
  * Copyright (C) 2000 IP Infusion Inc.
  *
  * Written by Kunihiro Ishiguro <kunihiro@zebra.org>
@@ -885,6 +886,14 @@ lsdb_lookup_next (struct ospf_area *area, u_char *type, int type_next,
   else
     i = *type;
 
+  /* Sanity check, if LSA type unknwon
+     merley skip any LSA */
+  if ((i < OSPF_MIN_LSA) || (i >= OSPF_MAX_LSA))
+    {
+      zlog_debug("Strange request with LSA type %d\n", i);
+      return NULL;
+    }
+
   for (; i < OSPF_MAX_LSA; i++)
     {
       *type = i;
@@ -1673,7 +1682,7 @@ ospfIfEntry (struct variable *v, oid *name, size_t *length, int exact,
       return SNMP_INTEGER (OSPF_POLL_INTERVAL_DEFAULT);
       break;
     case OSPFIFSTATE:          /* 12 */
-      return SNMP_INTEGER (oi->state);
+      return SNMP_INTEGER (ISM_SNMP(oi->state));
       break;
     case OSPFIFDESIGNATEDROUTER: /* 13 */
       return SNMP_IPADDRESS (DR (oi));
index e8d0a38a53f993965026118d73c6d86ecb0c6486..1a2afacc7629b7dc56ab37b8badbf651fc82c443 100644 (file)
@@ -1,4 +1,5 @@
 /* OSPF VTY interface.
+ * Copyright (C) 2005 6WIND <alain.ritoux@6wind.com>
  * Copyright (C) 2000 Toshiaki Takada
  *
  * This file is part of GNU Zebra.
@@ -1661,6 +1662,7 @@ DEFUN (ospf_area_default_cost,
   struct in_addr area_id;
   u_int32_t cost;
   int format;
+  struct prefix_ipv4 p;
 
   VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]);
   VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215);
@@ -1675,6 +1677,15 @@ DEFUN (ospf_area_default_cost,
 
   area->default_cost = cost;
 
+  p.family = AF_INET;
+  p.prefix.s_addr = OSPF_DEFAULT_DESTINATION;
+  p.prefixlen = 0;
+  if (IS_DEBUG_OSPF_EVENT)
+    zlog_debug ("ospf_abr_announce_stub_defaults(): "
+                "announcing 0.0.0.0/0 to area %s",
+               inet_ntoa (area->area_id));
+  ospf_abr_announce_network_to_area (&p, area->default_cost, area);
+
   return CMD_SUCCESS;
 }
 
@@ -1693,6 +1704,7 @@ DEFUN (no_ospf_area_default_cost,
   struct in_addr area_id;
   u_int32_t cost;
   int format;
+  struct prefix_ipv4 p;
 
   VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]);
   VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215);
@@ -1709,6 +1721,16 @@ DEFUN (no_ospf_area_default_cost,
 
   area->default_cost = 1;
 
+  p.family = AF_INET;
+  p.prefix.s_addr = OSPF_DEFAULT_DESTINATION;
+  p.prefixlen = 0;
+  if (IS_DEBUG_OSPF_EVENT)
+    zlog_debug ("ospf_abr_announce_stub_defaults(): "
+                "announcing 0.0.0.0/0 to area %s",
+               inet_ntoa (area->area_id));
+  ospf_abr_announce_network_to_area (&p, area->default_cost, area);
+
+
   ospf_area_check_free (ospf, area_id);
 
   return CMD_SUCCESS;
@@ -2617,6 +2639,9 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf,
       vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area),
               VTY_NEWLINE);
 
+      vty_out (vty, "  MTU mismatch detection:%s%s",
+           OSPF_IF_PARAM(oi, mtu_ignore) ? "disabled" : "enabled", VTY_NEWLINE);
+
       vty_out (vty, "  Router ID %s, Network Type %s, Cost: %d%s",
               inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type],
               oi->output_cost, VTY_NEWLINE);
@@ -6491,6 +6516,105 @@ DEFUN (no_ospf_distance_source_access_list,
   return CMD_SUCCESS;
 }
 
+DEFUN (ip_ospf_mtu_ignore,
+       ip_ospf_mtu_ignore_addr_cmd,
+       "ip ospf mtu-ignore A.B.C.D",
+       "IP Information\n"
+       "OSPF interface commands\n"
+       "Disable mtu mismatch detection\n"
+       "Address of interface")
+{
+  struct interface *ifp = vty->index;
+  struct in_addr addr;
+  int ret;
+          
+  struct ospf_if_params *params;
+  params = IF_DEF_PARAMS (ifp);
+        
+  if (argc == 1)
+    {
+      ret = inet_aton(argv[0], &addr);
+      if (!ret)
+        {
+          vty_out (vty, "Please specify interface address by A.B.C.D%s",
+                  VTY_NEWLINE);
+          return CMD_WARNING;
+        }
+      params = ospf_get_if_params (ifp, addr);
+      ospf_if_update_params (ifp, addr);
+    }
+  params->mtu_ignore = 1;
+  if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT)
+    SET_IF_PARAM (params, mtu_ignore);
+  else 
+    {
+      UNSET_IF_PARAM (params, mtu_ignore);
+      if (params != IF_DEF_PARAMS (ifp))
+        {
+          ospf_free_if_params (ifp, addr);
+          ospf_if_update_params (ifp, addr);
+        }
+    }
+  return CMD_SUCCESS;
+}
+
+ALIAS (ip_ospf_mtu_ignore,
+      ip_ospf_mtu_ignore_cmd,
+      "ip ospf mtu-ignore",
+      "IP Information\n"
+      "OSPF interface commands\n"
+      "Disable mtu mismatch detection\n")
+
+    
+DEFUN (no_ip_ospf_mtu_ignore,
+       no_ip_ospf_mtu_ignore_addr_cmd,
+       "no ip ospf mtu-ignore A.B.C.D",
+       "IP Information\n"
+       "OSPF interface commands\n"
+       "Disable mtu mismatch detection\n"
+       "Address of interface")
+{
+  struct interface *ifp = vty->index;
+  struct in_addr addr;
+  int ret;
+          
+  struct ospf_if_params *params;
+  params = IF_DEF_PARAMS (ifp);
+        
+  if (argc == 1)
+    {
+      ret = inet_aton(argv[0], &addr);
+      if (!ret)
+        {
+          vty_out (vty, "Please specify interface address by A.B.C.D%s",
+                  VTY_NEWLINE);
+          return CMD_WARNING;
+        }
+      params = ospf_get_if_params (ifp, addr);
+      ospf_if_update_params (ifp, addr);
+    }
+  params->mtu_ignore = 0;
+  if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT)
+    SET_IF_PARAM (params, mtu_ignore);
+  else 
+    {
+      UNSET_IF_PARAM (params, mtu_ignore);
+      if (params != IF_DEF_PARAMS (ifp))
+        {
+          ospf_free_if_params (ifp, addr);
+          ospf_if_update_params (ifp, addr);
+        }
+    }
+  return CMD_SUCCESS;
+}
+
+ALIAS (no_ip_ospf_mtu_ignore,
+       no_ip_ospf_mtu_ignore_cmd,
+      "no ip ospf mtu-ignore",
+      "IP Information\n"
+      "OSPF interface commands\n"
+      "Disable mtu mismatch detection\n")
+    
 static void
 show_ip_ospf_route_network (struct vty *vty, struct route_table *rt)
 {
@@ -6907,6 +7031,20 @@ config_write_interface (struct vty *vty)
            vty_out (vty, "%s", VTY_NEWLINE);
          }
 
+    /* MTU ignore print. */
+    if (OSPF_IF_PARAM_CONFIGURED (params, mtu_ignore) &&
+       params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT)
+      {
+        if (params->mtu_ignore == 0)
+          vty_out (vty, " no ip ospf mtu-ignore");
+        else
+          vty_out (vty, " ip ospf mtu-ignore");
+        if (params != IF_DEF_PARAMS (ifp))
+           vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
+        vty_out (vty, "%s", VTY_NEWLINE);
+      }
+
+
        while (1)
          {
            if (rn == NULL)
@@ -7456,6 +7594,12 @@ ospf_vty_if_init (void)
   install_element (INTERFACE_NODE, &no_ip_ospf_cost_addr_cmd);
   install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd);
 
+  /* "ip ospf mtu-ignore" commands. */
+  install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd);
+  install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_cmd);
+  install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_addr_cmd);
+  install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_cmd);
+
   /* "ip ospf dead-interval" commands. */
   install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd);
   install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd);
index 30d276f8bab9bc4868a01aeb117960404ecff4b1..95e4751dfe8e75d87ab7e114a629771537ebad25 100644 (file)
 #define OSPF_POLL_INTERVAL_DEFAULT         60
 #define OSPF_NEIGHBOR_PRIORITY_DEFAULT      0
 
+#define OSPF_MTU_IGNORE_DEFAULT             0
+
 /* OSPF options. */
 #define OSPF_OPTION_T                    0x01  /* TOS. */
 #define OSPF_OPTION_E                    0x02