diff options
-rw-r--r-- | bgpd/bgp_nexthop.c | 85 | ||||
-rw-r--r-- | bgpd/bgp_route.c | 12 | ||||
-rw-r--r-- | bgpd/bgp_snmp.c | 1 | ||||
-rw-r--r-- | bgpd/bgpd.c | 9 | ||||
-rw-r--r-- | bgpd/bgpd.h | 1 | ||||
-rw-r--r-- | ospf6d/ChangeLog | 6 | ||||
-rw-r--r-- | ospf6d/ospf6_asbr.c | 29 | ||||
-rw-r--r-- | ospf6d/ospf6d.h | 2 |
8 files changed, 96 insertions, 49 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 24a113d9..3b91373b 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -1119,9 +1119,11 @@ bgp_import_check (struct prefix *p, u_int32_t *igpmetric, struct in_addr *igpnex int bgp_import (struct thread *t) { + struct bgp_master *bm; struct bgp *bgp; struct bgp_node *rn; struct bgp_static *bgp_static; + struct listnode *nn; int valid; u_int32_t metric; struct in_addr nexthop; @@ -1131,49 +1133,52 @@ bgp_import (struct thread *t) bgp_import_thread = thread_add_timer (master, bgp_import, NULL, bgp_import_interval); - bgp = bgp_get_default (); - if (! bgp) + bm = bgp_get_master (); + if (! bm) return 0; - for (afi = AFI_IP; afi < AFI_MAX; afi++) - for (safi = SAFI_UNICAST; safi < SAFI_MPLS_VPN; safi++) - for (rn = bgp_table_top (bgp->route[afi][safi]); rn; - rn = bgp_route_next (rn)) - if ((bgp_static = rn->info) != NULL) - { - if (bgp_static->backdoor) - continue; - - valid = bgp_static->valid; - metric = bgp_static->igpmetric; - nexthop = bgp_static->igpnexthop; - - if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK) - && afi == AFI_IP && safi == SAFI_UNICAST) - bgp_static->valid = bgp_import_check (&rn->p, &bgp_static->igpmetric, - &bgp_static->igpnexthop); - else + LIST_LOOP (bm->bgp, bgp, nn) + { + for (afi = AFI_IP; afi < AFI_MAX; afi++) + for (safi = SAFI_UNICAST; safi < SAFI_MPLS_VPN; safi++) + for (rn = bgp_table_top (bgp->route[afi][safi]); rn; + rn = bgp_route_next (rn)) + if ((bgp_static = rn->info) != NULL) { - bgp_static->valid = 1; - bgp_static->igpmetric = 0; - bgp_static->igpnexthop.s_addr = 0; - } + if (bgp_static->backdoor) + continue; - if (bgp_static->valid != valid) - { - if (bgp_static->valid) - bgp_static_update (bgp, &rn->p, bgp_static, afi, safi); + valid = bgp_static->valid; + metric = bgp_static->igpmetric; + nexthop = bgp_static->igpnexthop; + + if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK) + && afi == AFI_IP && safi == SAFI_UNICAST) + bgp_static->valid = bgp_import_check (&rn->p, &bgp_static->igpmetric, + &bgp_static->igpnexthop); else - bgp_static_withdraw (bgp, &rn->p, afi, safi); + { + bgp_static->valid = 1; + bgp_static->igpmetric = 0; + bgp_static->igpnexthop.s_addr = 0; + } + + if (bgp_static->valid != valid) + { + if (bgp_static->valid) + bgp_static_update (bgp, &rn->p, bgp_static, afi, safi); + else + bgp_static_withdraw (bgp, &rn->p, afi, safi); + } + else if (bgp_static->valid) + { + if (bgp_static->igpmetric != metric + || bgp_static->igpnexthop.s_addr != nexthop.s_addr + || bgp_static->rmap.name) + bgp_static_update (bgp, &rn->p, bgp_static, afi, safi); + } } - else if (bgp_static->valid) - { - if (bgp_static->igpmetric != metric - || bgp_static->igpnexthop.s_addr != nexthop.s_addr - || bgp_static->rmap.name) - bgp_static_update (bgp, &rn->p, bgp_static, afi, safi); - } - } + } return 0; } @@ -1197,10 +1202,6 @@ zlookup_connect (struct thread *t) if (zlookup->sock < 0) return -1; - /* Make BGP import there. */ - bgp_import_thread = - thread_add_timer (master, bgp_import, NULL, 0); - return 0; } @@ -1396,6 +1397,8 @@ bgp_scan_init () /* Make BGP scan thread. */ bgp_scan_thread = thread_add_timer (master, bgp_scan, NULL, bgp_scan_interval); + /* Make BGP import there. */ + bgp_import_thread = thread_add_timer (master, bgp_import, NULL, 0); install_element (BGP_NODE, &bgp_scan_time_cmd); install_element (BGP_NODE, &no_bgp_scan_time_cmd); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index cc7dbfa6..aab85eb3 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1780,6 +1780,7 @@ bgp_static_update (struct bgp *bgp, struct prefix *p, struct bgp_info *new; struct bgp_info info; struct attr attr; + struct attr attr_tmp; struct attr *attr_new; int ret; @@ -1796,23 +1797,26 @@ bgp_static_update (struct bgp *bgp, struct prefix *p, /* Apply route-map. */ if (bgp_static->rmap.name) { + attr_tmp = attr; info.peer = bgp->peer_self; - info.attr = &attr; + info.attr = &attr_tmp; ret = route_map_apply (bgp_static->rmap.map, p, RMAP_BGP, &info); + if (ret == RMAP_DENYMATCH) { /* Free uninterned attribute. */ - bgp_attr_flush (&attr); + bgp_attr_flush (&attr_tmp); /* Unintern original. */ aspath_unintern (attr.aspath); bgp_static_withdraw (bgp, p, afi, safi); return; } + attr_new = bgp_attr_intern (&attr_tmp); } - - attr_new = bgp_attr_intern (&attr); + else + attr_new = bgp_attr_intern (&attr); for (ri = rn->info; ri; ri = ri->next) if (ri->peer == bgp->peer_self && ri->type == ZEBRA_ROUTE_BGP diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c index 8a4dfb64..6a33bae6 100644 --- a/bgpd/bgp_snmp.c +++ b/bgpd/bgp_snmp.c @@ -826,7 +826,6 @@ bgp4PathAttrTable (struct variable *v, oid name[], size_t *length, /* BGP Traps. */ struct trap_object bgpTrapList[] = { - {bgpPeerTable, 3, {3, 1, BGPPEERREMOTEADDR}}, {bgpPeerTable, 3, {3, 1, BGPPEERLASTERROR}}, {bgpPeerTable, 3, {3, 1, BGPPEERSTATE}} }; diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 53263637..bd00c965 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -1641,6 +1641,15 @@ bgp_create (as_t *as, char *name) return bgp; } +/* Return master of BGP. */ +struct bgp_master * +bgp_get_master () +{ + if (bm) + return bm; + return NULL; +} + /* Return first entry of BGP. */ struct bgp * bgp_get_default () diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 01d47212..c9a263bd 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -692,6 +692,7 @@ void bgp_reset (void); void bgp_zclient_reset (); int bgp_nexthop_set (union sockunion *, union sockunion *, struct bgp_nexthop *, struct peer *); +struct bgp_master *bgp_get_master (); struct bgp *bgp_get_default (); struct bgp *bgp_lookup (as_t, char *); struct bgp *bgp_lookup_by_name (char *); diff --git a/ospf6d/ChangeLog b/ospf6d/ChangeLog index b7871c13..8a8c0bfd 100644 --- a/ospf6d/ChangeLog +++ b/ospf6d/ChangeLog @@ -1,3 +1,9 @@ +2003-04-25 Yasuhiro Ohara <yasu@sfc.wide.ad.jp> + + * ospf6_asbr.c: AS-External LSA refresh was based on the + prefix of the obsolete LSA. It was wrong so fixed. + * version: 0.9.6p + 2002-11-09 Vincent Jardin <jardin@6wind.com> * ospf6_interface.c: update link-local address on interface creation. diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 00a2b66c..56ed1a6c 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -412,8 +412,9 @@ ospf6_asbr_external_lsa_refresh (void *data) struct ospf6_lsa_as_external *e; struct prefix prefix; struct route_node *node; - struct ospf6_external_route *route; - struct ospf6_external_info *info; + struct ospf6_external_route *route = NULL; + struct ospf6_external_info *info = NULL; + struct ospf6_external_info *match = NULL; if (IS_OSPF6_DUMP_ASBR) zlog_info ("ASBR: refresh %s", lsa->str); @@ -424,6 +425,29 @@ ospf6_asbr_external_lsa_refresh (void *data) prefix.family = AF_INET6; apply_mask_ipv6 ((struct prefix_ipv6 *) &prefix); + for (node = route_top (external_table); node; node = route_next (node)) + { + route = node->info; + if (route == NULL) + continue; + + for (info = route->info_head; info; info = info->next) + { + if (lsa->header->id == htonl (info->id)) + match = info; + } + } + + if (match == NULL) + { + ospf6_lsa_premature_aging (lsa); + return 0; + } + + ospf6_asbr_schedule_external (match); + return 0; + +#if 0 node = route_node_lookup (external_table, &prefix); if (! node || ! node->info) { @@ -450,6 +474,7 @@ ospf6_asbr_external_lsa_refresh (void *data) ospf6_lsa_premature_aging (lsa); return 0; +#endif } void diff --git a/ospf6d/ospf6d.h b/ospf6d/ospf6d.h index e0d310a9..862b3828 100644 --- a/ospf6d/ospf6d.h +++ b/ospf6d/ospf6d.h @@ -73,7 +73,7 @@ #define HASHVAL 64 #define MAXIOVLIST 1024 -#define OSPF6_DAEMON_VERSION "0.9.6o" +#define OSPF6_DAEMON_VERSION "0.9.6p" #define AF_LINKSTATE 0xff |