2004-12-15 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* ospf_interface.h: Declare new function ospf_default_iftype.
	* ospf_interface.c: (ospf_default_iftype) New function to centralize
	  this logic in one place.
	* ospf_zebra.c: (ospf_interface_add) Use new function
	  ospf_default_iftype.
	* ospf_vty.c: (no_ip_ospf_network,config_write_interface) Fix logic
	  by using new function ospf_default_iftype.
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog
index 82d0039..235b7fb 100644
--- a/ospfd/ChangeLog
+++ b/ospfd/ChangeLog
@@ -1,3 +1,13 @@
+2004-12-15 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+	* ospf_interface.h: Declare new function ospf_default_iftype.
+	* ospf_interface.c: (ospf_default_iftype) New function to centralize
+	  this logic in one place.
+	* ospf_zebra.c: (ospf_interface_add) Use new function
+	  ospf_default_iftype.
+	* ospf_vty.c: (no_ip_ospf_network,config_write_interface) Fix logic
+	  by using new function ospf_default_iftype.
+
 2004-12-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
 	* ospf_packet.c: (ospf_db_desc) Should be static, not global.
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 5a8f453..da08360 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -1174,6 +1174,17 @@
   return 0;
 }
 
+u_char
+ospf_default_iftype(struct interface *ifp)
+{
+  if (if_is_pointopoint (ifp))
+    return OSPF_IFTYPE_POINTOPOINT;
+  else if (if_is_loopback (ifp))
+    return OSPF_IFTYPE_LOOPBACK;
+  else
+    return OSPF_IFTYPE_BROADCAST;
+}
+
 void
 ospf_if_init ()
 {
diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h
index ed6abed..60ee165 100644
--- a/ospfd/ospf_interface.h
+++ b/ospfd/ospf_interface.h
@@ -246,4 +246,6 @@
 void ospf_crypt_key_add (struct list *, struct crypt_key *);
 int ospf_crypt_key_delete (struct list *, u_char);
 
+u_char ospf_default_iftype(struct interface *ifp);
+
 #endif /* _ZEBRA_OSPF_INTERFACE_H */
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 6a679f9..b9c554f 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -4853,7 +4853,7 @@
   int old_type = IF_DEF_PARAMS (ifp)->type;
   struct route_node *rn;
 
-  IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
+  IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp);
 
   if (IF_DEF_PARAMS (ifp)->type == old_type)
     return CMD_SUCCESS;
@@ -6722,8 +6722,7 @@
 	if (OSPF_IF_PARAM_CONFIGURED (params, type) &&
 	    params->type != OSPF_IFTYPE_LOOPBACK)
 	  {
-	    if ((!if_is_broadcast(ifp)) && 
-		(params->type != OSPF_IFTYPE_BROADCAST))
+	    if (params->type != ospf_default_iftype(ifp))
 	      {
 		vty_out (vty, " ip ospf network %s",
 			 ospf_int_type_str[params->type]);
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 44b5950..8468aed 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -95,14 +95,7 @@
   if (!OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), type))
     {
       SET_IF_PARAM (IF_DEF_PARAMS (ifp), type);
-      IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
-
-      if (if_is_broadcast (ifp))
-        IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
-      else if (if_is_pointopoint (ifp))
-        IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT;
-      else if (if_is_loopback (ifp))
-        IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_LOOPBACK;
+      IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp);
     }
 
   ospf = ospf_lookup ();