Vincent Bernat | 4 Jun 2012 14:54
Gravatar

[quagga-dev 9404] [PATCH] ospf6d: SNMP support

Hi!

Here is a set of patches to add a proper SNMP support to ospf6d. The
current SNMP support uses an old version of the MIB. The first patch
updates this point. Moreover, there were several endian errors. They
are also corrected in the first patch. Also, a big change is that
router ID are no more represented as IPv4 addresses but as unsigned
integers. Therefore, the result is less readable but this is how the
official OSPFv3-MIB is.

The other patches complete the current implementation. I have
implemented the following tables:

 - ospfv3AreaTable
 - ospfv3AsLsdbTable
 - ospfv3AreaLsdbTable
 - ospfv3LinkLsdbTable
 - ospfv3IfTable
 - ospfv3NbrTable

I am not an OSPFv3 specialist so there may exist some errors. Also, I
am unsure if an area-scoped LSA is an AS-scoped LSA as well. I have
supposed this is not the case.

I am unsure if the current ospf6d implementation really supports route
summary (I would say yes, but I was unable to configure one), stub and
NSSA area (I would say no), virtual links (I would say no) and
preconfigured neighbors (I would say no). Therefore, the following
tables are not implemented on purpose:

(Continue reading)

Vincent Bernat | 4 Jun 2012 14:54
Gravatar

[quagga-dev 9397] [PATCH 2/7] ospf6d: add SNMP support for ospfv3NbrTable

---
 ospf6d/ospf6_neighbor.c |    2 +
 ospf6d/ospf6_neighbor.h |    1 +
 ospf6d/ospf6_snmp.c     |  162 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 165 insertions(+)

diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c
index f6c3aea..ab157ca 100644
--- a/ospf6d/ospf6_neighbor.c
+++ b/ospf6d/ospf6_neighbor.c
 <at>  <at>  -89,6 +89,7  <at>  <at>  ospf6_neighbor_create (u_int32_t router_id, struct ospf6_interface *oi)
             buf, oi->interface->name);
   on->ospf6_if = oi;
   on->state = OSPF6_NEIGHBOR_DOWN;
+  on->state_change = 0;
   quagga_gettime (QUAGGA_CLK_MONOTONIC, &on->last_changed);
   on->router_id = router_id;

 <at>  <at>  -154,6 +155,7  <at>  <at>  ospf6_neighbor_state_change (u_char next_state, struct ospf6_neighbor *on)
   if (prev_state == next_state)
     return;

+  on->state_change++;
   quagga_gettime (QUAGGA_CLK_MONOTONIC, &on->last_changed);

   /* log */
diff --git a/ospf6d/ospf6_neighbor.h b/ospf6d/ospf6_neighbor.h
index b3bd173..5f46c6f 100644
--- a/ospf6d/ospf6_neighbor.h
+++ b/ospf6d/ospf6_neighbor.h
(Continue reading)

Vincent Bernat | 4 Jun 2012 14:54
Gravatar

[quagga-dev 9398] [PATCH 5/7] ospf6d: add SNMP implementation of ospfv3IfTable

---
 ospf6d/ospf6_interface.c |    1 +
 ospf6d/ospf6_interface.h |    2 +
 ospf6d/ospf6_snmp.c      |  203 +++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 205 insertions(+), 1 deletion(-)

diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 71aa685..6f7aaa8 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
 <at>  <at>  -394,6 +394,7  <at>  <at>  ospf6_interface_state_change (u_char next_state, struct ospf6_interface *oi)
 		  ospf6_interface_state_str[prev_state],
 		  ospf6_interface_state_str[next_state]);
     }
+  oi->state_change++;

   if ((prev_state == OSPF6_INTERFACE_DR ||
        prev_state == OSPF6_INTERFACE_BDR) &&
diff --git a/ospf6d/ospf6_interface.h b/ospf6d/ospf6_interface.h
index 2d1ff34..d80b073 100644
--- a/ospf6d/ospf6_interface.h
+++ b/ospf6d/ospf6_interface.h
 <at>  <at>  -64,6 +64,8  <at>  <at>  struct ospf6_interface
   u_int16_t dead_interval;
   u_int32_t rxmt_interval;

+  u_int32_t state_change;
+
   /* Cost */
   u_int32_t cost;
(Continue reading)

Vincent Bernat | 4 Jun 2012 14:54
Gravatar

[quagga-dev 9399] [PATCH 4/7] ospf6d: complete SNMP implementation of ospfv3AreaTable

---
 ospf6d/ospf6_area.h |    1 +
 ospf6d/ospf6_snmp.c |   30 ++++++++++++++++++++++++++++--
 ospf6d/ospf6_spf.c  |    2 ++
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h
index c7c5ee3..e8a4fbd 100644
--- a/ospf6d/ospf6_area.h
+++ b/ospf6d/ospf6_area.h
 <at>  <at>  -57,6 +57,7  <at>  <at>  struct ospf6_area

   struct thread  *thread_spf_calculation;
   struct thread  *thread_route_calculation;
+  u_int32_t spf_calculation;	/* SPF calculation count */

   struct thread *thread_router_lsa;
   struct thread *thread_intra_prefix_lsa;
diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c
index dbd9db6..e6e2885 100644
--- a/ospf6d/ospf6_snmp.c
+++ b/ospf6d/ospf6_snmp.c
 <at>  <at>  -447,10 +447,14  <at>  <at>  ospfv3AreaEntry (struct variable *v, oid *name, size_t *length,
                  int exact, size_t *var_len, WriteMethod **write_method)
 {
   struct ospf6_area *oa, *area = NULL;
+  struct ospf6_lsa *lsa = NULL;
   u_int32_t area_id = 0;
+  u_int32_t count;
+  u_int16_t sum;
(Continue reading)

Vincent Bernat | 4 Jun 2012 14:54
Gravatar

[quagga-dev 9400] [PATCH 6/7] ospf6d: add SNMP support for ospfv3*LsdbTable

This includes:
 - ospfv3AsLsdbTable
 - ospfv3AreaLsdbTable
 - ospfv3LinkLsdbTable
---
 ospf6d/ospf6_snmp.c |  248 ++++++++++++++++++++++++++++++++-------------------
 1 file changed, 158 insertions(+), 90 deletions(-)

diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c
index d0d9db5..f30152f 100644
--- a/ospf6d/ospf6_snmp.c
+++ b/ospf6d/ospf6_snmp.c
 <at>  <at>  -90,26 +90,20  <at>  <at> 
 #define OSPFv3AREASTUBMETRICTYPE        15
 #define OSPFv3AREATEENABLED             16

-/* OSPFv3 MIB AS Lsdb Table values: ospfv3AsLsdbTable */
-#define OSPFv3ASLSDBSEQUENCE             4
-#define OSPFv3ASLSDBAGE                  5
-#define OSPFv3ASLSDBCHECKSUM             6
-#define OSPFv3ASLSDBADVERTISEMENT        7
-#define OSPFv3ASLSDBTYPEKNOWN            8
-
-/* OSPFv3 MIB Area Lsdb Table values: ospfv3AreaLsdbTable */
-#define OSPFv3AREALSDBSEQUENCE           5
-#define OSPFv3AREALSDBAGE                6
-#define OSPFv3AREALSDBCHECKSUM           7
-#define OSPFv3AREALSDBADVERTISEMENT      8
-#define OSPFv3AREALSDBTYPEKNOWN          9
-
(Continue reading)

Vincent Bernat | 4 Jun 2012 14:54
Gravatar

[quagga-dev 9401] [PATCH 7/7] ospf6d: add SNMP notifications/traps support

Only implement ospfv3NbrStateChange and ospfv3IfStateChange.
---
 ospf6d/ospf6_interface.c |   11 +++++++++
 ospf6d/ospf6_neighbor.c  |    9 ++++++++
 ospf6d/ospf6_snmp.c      |   56 ++++++++++++++++++++++++++++++++++++++++++++++
 ospf6d/ospf6_snmp.h      |    2 ++
 4 files changed, 78 insertions(+)

diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 6f7aaa8..40cda24 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
 <at>  <at>  -421,6 +421,17  <at>  <at>  ospf6_interface_state_change (u_char next_state, struct ospf6_interface *oi)
       OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT (oi);
       OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB (oi->area);
     }
+
+#ifdef HAVE_SNMP
+  /* Terminal state or regression */ 
+  if ((next_state == OSPF6_INTERFACE_POINTTOPOINT) ||
+      (next_state == OSPF6_INTERFACE_DROTHER) ||
+      (next_state == OSPF6_INTERFACE_BDR) ||
+      (next_state == OSPF6_INTERFACE_DR) ||
+      (next_state < prev_state))
+    ospf6TrapIfStateChange (oi);
+#endif
+
 }

 
(Continue reading)

Vincent Bernat | 4 Jun 2012 14:54
Gravatar

[quagga-dev 9402] [PATCH 3/7] ospf6d: complete SNMP implementation for scalar objects

---
 ospf6d/ospf6_snmp.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c
index 17d7dbb..dbd9db6 100644
--- a/ospf6d/ospf6_snmp.c
+++ b/ospf6d/ospf6_snmp.c
 <at>  <at>  -357,6 +357,10  <at>  <at>  static u_char *
 ospfv3GeneralGroup (struct variable *v, oid *name, size_t *length,
                     int exact, size_t *var_len, WriteMethod **write_method)
 {
+  u_int16_t sum;
+  u_int32_t count;
+  struct ospf6_lsa *lsa = NULL;
+
   /* Check whether the instance identifier is valid */
   if (smux_header_generic (v, name, length, exact, var_len, write_method)
       == MATCH_FAILED)
 <at>  <at>  -371,18 +375,56  <at>  <at>  ospfv3GeneralGroup (struct variable *v, oid *name, size_t *length,
 	return SNMP_INTEGER (ntohl (ospf6->router_id));
       return SNMP_INTEGER (0);
     case OSPFv3ADMINSTAT:
+      if (ospf6)
+	return SNMP_INTEGER (CHECK_FLAG (ospf6->flag, OSPF6_DISABLED)?
+			     OSPF_STATUS_DISABLED:OSPF_STATUS_ENABLED);
+      return SNMP_INTEGER (OSPF_STATUS_DISABLED);
     case OSPFv3VERSIONNUMBER:
+      return SNMP_INTEGER (3);
     case OSPFv3AREABDRRTRSTATUS:
(Continue reading)

Vincent Bernat | 4 Jun 2012 14:54
Gravatar

[quagga-dev 9403] [PATCH 1/7] snmp: fix OSPFV3-MIB implementation

Use the real MIB from RFC 5643. Fix used ASN1 types. Indexes are not
exported any more (they are "no access"). Fix some endian
issues. Also, ID are just integers, not IPv4 addresses.

No additional OID are supported in this commit.
---
 ospf6d/OSPFv3-MIB.txt | 6709 +++++++++++++++++++++++++++++--------------------
 ospf6d/ospf6_snmp.c   |  410 +--
 2 files changed, 4188 insertions(+), 2931 deletions(-)

diff --git a/ospf6d/OSPFv3-MIB.txt b/ospf6d/OSPFv3-MIB.txt
index 80e6cb2..258f533 100644
--- a/ospf6d/OSPFv3-MIB.txt
+++ b/ospf6d/OSPFv3-MIB.txt
 <at>  <at>  -1,2758 +1,3951  <at>  <at> 
-OSPFV3-MIB DEFINITIONS ::= BEGIN 
- 
-IMPORTS 
-        MODULE-IDENTITY, OBJECT-TYPE, mib-2, experimental,
-        Counter32, Gauge32, Integer32, IpAddress, 
-        Unsigned32 
-                FROM SNMPv2-SMI 
-        TEXTUAL-CONVENTION, TruthValue, StorageType, RowStatus 
-                FROM SNMPv2-TC 
-        MODULE-COMPLIANCE, OBJECT-GROUP 
-                FROM SNMPv2-CONF 
-        InterfaceIndex 
-                FROM IF-MIB 
-        InetAddressType, InetAddress, InetAddressPrefixLength 
-                FROM INET-ADDRESS-MIB 
(Continue reading)

Vincent Bernat | 17 Jun 2012 13:13
Gravatar

[quagga-dev 9431] Re: [PATCH] ospf6d: SNMP support

 ❦  4 juin 2012 14:54 CEST, Vincent Bernat <bernat <at> luffy.cx> :

> Here is a set of patches to add a proper SNMP support to ospf6d. The
> current SNMP support uses an old version of the MIB. The first patch
> updates this point. Moreover, there were several endian errors. They
> are also corrected in the first patch. Also, a big change is that
> router ID are no more represented as IPv4 addresses but as unsigned
> integers. Therefore, the result is less readable but this is how the
> official OSPFv3-MIB is.

I have found some bugs in my implementation. I have hopefully corrected
them all. I have also rewrite the patchset to follow GNU style. I think
it is ready to be merged (if AgentX support is merged). The current
patchset is available from here:

 https://github.com/vincentbernat/quagga/compare/feature/agentx...feature/ospfv3-mib
 https://github.com/vincentbernat/quagga.git (feature/ospfv3-mib branch)
--

-- 
Avoid temporary variables.
            - The Elements of Programming Style (Kernighan & Plauger)

_______________________________________________
Quagga-dev mailing list
Quagga-dev <at> lists.quagga.net
http://lists.quagga.net/mailman/listinfo/quagga-dev
David Lamparter | 19 Jun 2012 13:59
Favicon

[quagga-dev 9432] Re: [PATCH] ospf6d: SNMP support

On Sun, Jun 17, 2012 at 01:13:19PM +0200, Vincent Bernat wrote:
>  ❦  4 juin 2012 14:54 CEST, Vincent Bernat <bernat <at> luffy.cx> :
> 
> > Here is a set of patches to add a proper SNMP support to ospf6d. The
> > current SNMP support uses an old version of the MIB. The first patch
> > updates this point. Moreover, there were several endian errors. They
> > are also corrected in the first patch. Also, a big change is that
> > router ID are no more represented as IPv4 addresses but as unsigned
> > integers. Therefore, the result is less readable but this is how the
> > official OSPFv3-MIB is.
> 
> I have found some bugs in my implementation. I have hopefully corrected
> them all. I have also rewrite the patchset to follow GNU style. I think
> it is ready to be merged (if AgentX support is merged). The current
> patchset is available from here:
> 
>  https://github.com/vincentbernat/quagga/compare/feature/agentx...feature/ospfv3-mib
>  https://github.com/vincentbernat/quagga.git (feature/ospfv3-mib branch)

I'm very tempted to just do this without major checking; we don't really
have testsuites for this and the code has been exposed to quite some
bitrot...  If anyone has problems with this, feel free to run some
testing %-)

Other than that, I'll merge when there's no feedback for a few days [as
I'd expect].

-David
(Continue reading)


Gmane