summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ospfd/ChangeLog10
-rw-r--r--ospfd/ospf_interface.c11
-rw-r--r--ospfd/ospf_interface.h2
-rw-r--r--ospfd/ospf_vty.c5
-rw-r--r--ospfd/ospf_zebra.c9
5 files changed, 26 insertions, 11 deletions
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog
index 82d00392..235b7fb6 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 5a8f4532..da08360d 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -1174,6 +1174,17 @@ ospf_crypt_key_delete (struct list *auth_crypt, u_char key_id)
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 ed6abed0..60ee1650 100644
--- a/ospfd/ospf_interface.h
+++ b/ospfd/ospf_interface.h
@@ -246,4 +246,6 @@ struct crypt_key *ospf_crypt_key_new ();
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 6a679f94..b9c554f4 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -4853,7 +4853,7 @@ DEFUN (no_ip_ospf_network,
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 @@ config_write_interface (struct vty *vty)
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 44b59503..8468aed9 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -95,14 +95,7 @@ ospf_interface_add (int command, struct zclient *zclient, zebra_size_t length)
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 ();