[prev in list] [next in list] [prev in thread] [next in thread]
List: quagga-dev
Subject: [quagga-dev 5562] Re: [PATCH 07/11] Add ZEBRA_INTERFACE_UNNUMBERED
From: Joakim Tjernlund <joakim.tjernlund () transmode ! se>
Date: 2008-07-03 14:09:04
Message-ID: 1215094144.6205.103.camel () gentoo-jocke ! transmode ! se
[Download RAW message or body]
On Wed, 2008-07-02 at 15:51 +0200, Joakim Tjernlund wrote:
> Use inteface <ifname>
> "unnumbered" command to set unnumbered mode.
> "no unnumbered" will clear it.
>
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
> lib/if.h | 1 +
> ospfd/ospf_vty.c | 3 +++
> ospfd/ospf_zebra.c | 11 +++++++++++
> zebra/interface.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 67 insertions(+), 0 deletions(-)
OOPS, use ->status instead of ->flags
>From 1fb6e7a96738520141fe4e408dad10ae91e3becf Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Date: Tue, 3 Jun 2008 18:56:34 +0200
Subject: [PATCH] Add ZEBRA_INTERFACE_UNNUMBERED interface flag.
Use interface <ifname>
"unnumbered" command to set unnumbered mode.
"no unnumbered" will clear it.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---
lib/if.h | 1 +
ospfd/ospf_vty.c | 3 +++
ospfd/ospf_zebra.c | 11 +++++++++++
zebra/interface.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/lib/if.h b/lib/if.h
index c99ab81..8fa3084 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -90,6 +90,7 @@ struct interface
#define ZEBRA_INTERFACE_ACTIVE (1 << 0)
#define ZEBRA_INTERFACE_SUB (1 << 1)
#define ZEBRA_INTERFACE_LINKDETECTION (1 << 2)
+#define ZEBRA_INTERFACE_UNNUMBERED (1 << 3)
/* Interface flags. */
uint64_t flags;
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 6a0d0f7..f29e2a6 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -2860,6 +2860,9 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf,
vty_out (vty, " Internet Address %s/%d,",
inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen);
+ vty_out(vty, " Unnumbered: %s,", ((oi->ifp->status & ZEBRA_INTERFACE_UNNUMBERED)
+ ? "YES" : "NO"));
+
if (oi->connected->destination || oi->type == OSPF_IFTYPE_VIRTUALLINK)
{
struct in_addr *dest;
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index f302d28..c312b08 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -197,6 +197,17 @@ ospf_interface_state_up (int command, struct zclient *zclient,
ospf_if_recalculate_output_cost (ifp);
}
+ if ((if_tmp.status ^ ifp->status) & ZEBRA_INTERFACE_UNNUMBERED)
+ {
+ if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
+ zlog_debug ("Zebra: Interface[%s] Unnumbered state change %d -> %d.",
+ ifp->name,
+ if_tmp.status & ZEBRA_INTERFACE_UNNUMBERED,
+ ifp->status & ZEBRA_INTERFACE_UNNUMBERED);
+
+ ospf_if_reset (ifp);
+ }
+
if (if_tmp.mtu != ifp->mtu)
{
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
diff --git a/zebra/interface.c b/zebra/interface.c
index 184b42a..349a093 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -1007,6 +1007,53 @@ DEFUN (no_multicast,
return CMD_SUCCESS;
}
+DEFUN (unnumbered,
+ unnumbered_cmd,
+ "unnumbered",
+ "Set interface to IP Unnumbered mode\n")
+{
+ int ret;
+ struct interface *ifp;
+ struct zebra_if *if_data;
+
+ ifp = (struct interface *) vty->index;
+
+ zlog_debug("VTY: interface %s, Setting ifp->status |= ZEBRA_INTERFACE_UNNUMBERED",
+ ifp->name);
+
+ ifp->status |= ZEBRA_INTERFACE_UNNUMBERED;
+
+ /* force protocols to recalculate routes due to IP change */
+ if (if_is_operative (ifp))
+ zebra_interface_up_update (ifp);
+
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_unnumbered,
+ no_unnumbered_cmd,
+ "no unnumbered",
+ NO_STR
+ "Set interface to IP Numbered mode\n")
+{
+ int ret;
+ struct interface *ifp;
+ struct zebra_if *if_data;
+
+ ifp = (struct interface *) vty->index;
+
+ zlog_debug("VTY: interface %s, Setting ifp->status &= ~ZEBRA_INTERFACE_UNNUMBERED;",
+ ifp->name);
+
+ ifp->status &= ~ZEBRA_INTERFACE_UNNUMBERED;
+
+ /* force protocols to recalculate routes due to IP change */
+ if (if_is_operative (ifp))
+ zebra_interface_up_update (ifp);
+
+ return CMD_SUCCESS;
+}
+
DEFUN (linkdetect,
linkdetect_cmd,
"link-detect",
@@ -1537,6 +1584,9 @@ if_config_write (struct vty *vty)
if (ifp->bandwidth != 0)
vty_out(vty, " bandwidth %u%s", ifp->bandwidth, VTY_NEWLINE);
+ if (ifp->status & ZEBRA_INTERFACE_UNNUMBERED)
+ vty_out (vty, " unnumbered%s", VTY_NEWLINE);
+
if (CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION))
vty_out(vty, " link-detect%s", VTY_NEWLINE);
@@ -1603,6 +1653,8 @@ zebra_if_init (void)
install_element (INTERFACE_NODE, &no_interface_desc_cmd);
install_element (INTERFACE_NODE, &multicast_cmd);
install_element (INTERFACE_NODE, &no_multicast_cmd);
+ install_element (INTERFACE_NODE, &unnumbered_cmd);
+ install_element (INTERFACE_NODE, &no_unnumbered_cmd);
install_element (INTERFACE_NODE, &linkdetect_cmd);
install_element (INTERFACE_NODE, &no_linkdetect_cmd);
install_element (INTERFACE_NODE, &shutdown_if_cmd);
--
1.5.5.4
_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
http://lists.quagga.net/mailman/listinfo/quagga-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic