Hello,

I am fairly new to OSPF in general, so excuse me if my vocabulary is not accurate for all cases.

I would like to obtain a list of all the *local* networks that are currently advertised by ospfd. In particular, I would like that list to acurately discard/not contain networks that may have been filtered out by distribution lists, as well as networks configured via the 'network' command. That is all local networks (connected, kernel or static) that are actually advertised.

My first idea was to hook my list implementation to ospf_ase_calculate_route() [ospf_ase.c:335]:

----8<-----------------------------------------------------------------

  /* (2) If the LSA was originated by the calculating router itself,
     examine the next LSA. */
  if (IS_LSA_SELF (lsa))
    {
      /* HERE: append LSA information to my list, i.e. network, mask */
      ...

------------------------------------------------------------------>8---

This worked well with a 'connected' or 'kernel' configuration such as:

router ospf
  ...
  redistribute connected metric 15
  distribute-list MY_ACCESS_LIST out connected

But this did not include networks that were statically configured using the 'network' command, such as:

router ospf
  ...
  network 192.168.2.0/24 area 0
  network 172.16.200.0/24 area 0

I have been reading the OSPFd code up and down and have not been able to identify:

1. The data structure were both kind of networks would ultimately be (i) stored and (ii) identified as local networks.

2. A place in code where it would make sense to insert that "list append" code of mine, such that it would be updated accurately.
2.1 I would like my list to be updated in a transactional-like manner:

    begin_update();
    ...
    list_append(); /*for each local network*/
    ...
    end_update();

But alas I haven't been able to find a place where all local networks are updated at once.


The reason seems to be that the statically configured networks are added as routes and the connected networks are added to a LSA.

3. Is there a LSA that would contain the statically configured networks? How can it be found?


The only solution I have been able to find so far (and I am unsure as whether it would work as I intend it to in all cases) is to add my hooks as follow:

For static routes:
----8<-----------------------------------------------------------------
ospf_zebra_add:
        list_add(route);
ospf_zebra_delete:
        list_delete(route);
------------------------------------------------------------------>8---

For connected or kernel routes:
----8<-----------------------------------------------------------------
ospf_zebra_read_ipv4:
        list_add(route);
ospf_zebra_read_ipv4:
        list_delete(route);
------------------------------------------------------------------>8---

But this also has the disadvantage that I cannot use the "transactional-like" API that I mentioned before.

I would very much appreciate any hints as to how to tackle this issue!!


Kind regards,

--
Federico Sauter / Senior Firmware Programmer
Innominate Security Technologies AG / protecting industrial networks
tel: +49.30.921028-210 / fax: +49.30.921028-020
Rudower Chaussee 13 / D-12489 Berlin / http://www.innominate.com/

Register Court: AG Charlottenburg, HR B 81603
Management Board: Dirk Seewald
Chairman of the Supervisory Board: Christoph Leifer

_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to