diff options
author | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2009-08-24 11:48:34 +0000 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2010-02-04 01:18:21 +0100 |
commit | 58bfa5562817306f14cd7d41953a2740056e1afc (patch) | |
tree | a8cf512088255220ce493279229aed05670cde51 /ospfd/ospfd.c | |
parent | f03edb371c3e0b389f15600ceb283055033085e6 (diff) | |
download | quagga-58bfa5562817306f14cd7d41953a2740056e1afc.tar.bz2 quagga-58bfa5562817306f14cd7d41953a2740056e1afc.tar.xz |
ospfd: Add new host route command
Add static host routes into router LSA.
See RFC 2328 chapter 12.4 and Appendix C.7
Syntax:
router ospf
ip ospf host A.B.C.D area (A.B.C.D|<0-4294967295>|all) cost <0-65535>
no ip ospf host A.B.C.D area (A.B.C.D|<0-4294967295>|all)
* ospfd/ospf_route.h: Add struct ospf_host_route
* ospfd/ospf_lsa.c: (router_lsa_link_set) Add host routes to Router LSA.
* ospfd/ospf_vtc.c: Impl. ip_ospf_host_cmd and no_ip_ospf_host_cmd.
(ospf_config_write) Write out host routes to config.
* ospfd/ospf_ospfd.c: (ospf_new) Allocate new host route list.
(ospf_finish_filnal) Free host list.
(ospf_area_check_free) Check if any host routes in
area before freeing.
* ospfd/ospf_ospfd.h: Add a host list to struct ospf.
Diffstat (limited to 'ospfd/ospfd.c')
-rw-r--r-- | ospfd/ospfd.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index a7553e73..b11ee1bb 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -231,7 +231,7 @@ ospf_new (void) } new->t_read = thread_add_read (master, ospf_read, new, new->fd); new->oi_write_q = list_new (); - + new->hostlist = list_new(); /* host route list */ return new; } @@ -401,6 +401,7 @@ ospf_finish_final (struct ospf *ospf) struct ospf_lsa *lsa; struct ospf_interface *oi; struct ospf_area *area; + struct ospf_host_route *host; struct ospf_vl_data *vl_data; struct listnode *node, *nnode; int i; @@ -471,6 +472,12 @@ ospf_finish_final (struct ospf *ospf) ospf_area_free (area); } + for (ALL_LIST_ELEMENTS (ospf->hostlist, node, nnode, host)) + { + listnode_delete (ospf->hostlist, host); + XFREE (MTYPE_OSPF_TOP, host); + } + /* Cancel all timers. */ OSPF_TIMER_OFF (ospf->t_external_lsa); OSPF_TIMER_OFF (ospf->t_router_lsa_update); @@ -646,6 +653,8 @@ ospf_area_free (struct ospf_area *area) void ospf_area_check_free (struct ospf *ospf, struct in_addr area_id) { + struct ospf_host_route *host; + struct listnode *node; struct ospf_area *area; area = ospf_area_lookup_by_area_id (ospf, area_id); @@ -660,6 +669,9 @@ ospf_area_check_free (struct ospf *ospf, struct in_addr area_id) IMPORT_NAME (area) == NULL && area->auth_type == OSPF_AUTH_NULL) { + for (ALL_LIST_ELEMENTS_RO (area->ospf->hostlist, node, host)) + if (!host->area || host->area == area) + return; listnode_delete (ospf->areas, area); ospf_area_free (area); } |