]> git.proxmox.com Git - mirror_frr.git/commitdiff
Paul Jakma:
authorpaul <paul>
Sat, 25 Jan 2003 06:47:41 +0000 (06:47 +0000)
committerpaul <paul>
Sat, 25 Jan 2003 06:47:41 +0000 (06:47 +0000)
[zebra 17352] ospf network matching (aka need for peer /32 for PtP)
change behaviour of network <prefix> area N statement wrt to PtP.

ospfd/ospfd.c
ospfd/ospfd.h

index 19bc1e53e3b55eaf387f365a245dd54fcf59da7e..a1ad929d81f51782ebd98219ca77521c2bbb54b4 100644 (file)
@@ -665,7 +665,25 @@ ospf_network_unset (struct ospf *ospf, struct prefix_ipv4 *p,
   return 1;
 }
 
-\f
+/* Check whether interface matches given network
+ * returns: 1, true. 0, false
+ */
+int 
+ospf_network_match_iface(struct connected *co, struct prefix *net)
+{
+  /* Behaviour to match both Cisco where:
+   *   iface address lies within network specified -> ospf
+   * and zebra 0.9[2ish-3]:
+   *   PtP special case: network specified == iface peer addr -> ospf
+   */
+  return (
+          ((ifc_pointopoint (co) && 
+            IPV4_ADDR_SAME ( &(co->destination->u.prefix4), &(net->u.prefix4)))
+                 || prefix_match (net, co->address)) 
+                 ? 1 : 0
+                );
+}
+
 void
 ospf_network_run (struct ospf *ospf, struct prefix *p, struct ospf_area *area)
 {
@@ -704,13 +722,9 @@ ospf_network_run (struct ospf *ospf, struct prefix *p, struct ospf_area *area)
          else 
            addr = co->address;
 
-         if (p->family == co->address->family &&
-             ! ospf_if_is_configured (&(addr->u.prefix4)))
-           if ((ifc_pointopoint (co) &&
-                IPV4_ADDR_SAME (&(addr->u.prefix4), &(p->u.prefix4))) ||
-               prefix_match (p, addr)) 
-             {
-               struct ospf_interface *oi;
+         if (ospf_network_match_iface(co,p))
+           {
+           struct ospf_interface *oi;
                
                oi = ospf_if_new (ifp, co->address);
                oi->connected = co;
@@ -835,10 +849,7 @@ ospf_if_update ()
              if (rn->info == NULL)
                continue;
              
-             if ((oi->type == OSPF_IFTYPE_POINTOPOINT
-                  && IPV4_ADDR_SAME (&(co->destination->u.prefix4),
-                                     &(rn->p.u.prefix4)))
-                 || prefix_match (&(rn->p), co->address))
+             if (ospf_network_match_iface(co,&rn->p))
                {
                  found = 1;
                  route_unlock_node (rn);
index a83231b2cb66f1be2894955e556067b65dfe4b46..a46a79311e574d204e38178eadbc61e74e5322a6 100644 (file)
@@ -511,6 +511,7 @@ struct ospf *ospf_get ();
 void ospf_finish (struct ospf *);
 int ospf_router_id_update_timer (struct thread *);
 void ospf_router_id_update ();
+int ospf_network_match_iface (struct connected *, struct prefix *);
 int ospf_network_set (struct ospf *, struct prefix_ipv4 *, struct in_addr);
 int ospf_network_unset (struct ospf *, struct prefix_ipv4 *, struct in_addr);
 int ospf_area_stub_set (struct ospf *, struct in_addr);