forked from Mirror/frr
[ospfd] Fix a few LSA performance "bugs"
ospf_lsa_install() will calculate LSA checksum so no need to do it before calling ospf_lsa_install(). Set the OSPF_LSA_SELF_CHECKED flag on own LSA's to save ospf_lsa_is_self_originated() some work. Do not memset() memory that is about to overwritten with memcpy().
This commit is contained in:
parent
dc26699a80
commit
f654313804
|
@ -201,7 +201,6 @@ ospf_lsa_new ()
|
|||
struct ospf_lsa *new;
|
||||
|
||||
new = XCALLOC (MTYPE_OSPF_LSA, sizeof (struct ospf_lsa));
|
||||
memset (new, 0, sizeof (struct ospf_lsa));
|
||||
|
||||
new->flags = 0;
|
||||
new->lock = 1;
|
||||
|
@ -822,7 +821,7 @@ ospf_router_lsa_new (struct ospf_area *area)
|
|||
}
|
||||
|
||||
new->area = area;
|
||||
SET_FLAG (new->flags, OSPF_LSA_SELF);
|
||||
SET_FLAG (new->flags, OSPF_LSA_SELF | OSPF_LSA_SELF_CHECKED);
|
||||
|
||||
/* Copy LSA data to store, discard stream. */
|
||||
new->data = ospf_lsa_data_new (length);
|
||||
|
@ -1081,7 +1080,7 @@ ospf_network_lsa_new (struct ospf_interface *oi)
|
|||
}
|
||||
|
||||
new->area = oi->area;
|
||||
SET_FLAG (new->flags, OSPF_LSA_SELF);
|
||||
SET_FLAG (new->flags, OSPF_LSA_SELF | OSPF_LSA_SELF_CHECKED);
|
||||
|
||||
/* Copy LSA to store. */
|
||||
new->data = ospf_lsa_data_new (length);
|
||||
|
@ -1275,7 +1274,7 @@ ospf_summary_lsa_new (struct ospf_area *area, struct prefix *p,
|
|||
/* Create OSPF LSA instance. */
|
||||
new = ospf_lsa_new ();
|
||||
new->area = area;
|
||||
SET_FLAG (new->flags, OSPF_LSA_SELF);
|
||||
SET_FLAG (new->flags, OSPF_LSA_SELF | OSPF_LSA_SELF_CHECKED);
|
||||
|
||||
/* Copy LSA to store. */
|
||||
new->data = ospf_lsa_data_new (length);
|
||||
|
@ -1347,9 +1346,6 @@ ospf_summary_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
|
|||
|
||||
new->data->ls_seqnum = lsa_seqnum_increment (lsa);
|
||||
|
||||
/* Re-calculate checksum. */
|
||||
ospf_lsa_checksum (new->data);
|
||||
|
||||
ospf_lsa_install (ospf, NULL, new);
|
||||
|
||||
/* Flood LSA through AS. */
|
||||
|
@ -1424,7 +1420,7 @@ ospf_summary_asbr_lsa_new (struct ospf_area *area, struct prefix *p,
|
|||
/* Create OSPF LSA instance. */
|
||||
new = ospf_lsa_new ();
|
||||
new->area = area;
|
||||
SET_FLAG (new->flags, OSPF_LSA_SELF);
|
||||
SET_FLAG (new->flags, OSPF_LSA_SELF | OSPF_LSA_SELF_CHECKED);
|
||||
|
||||
/* Copy LSA to store. */
|
||||
new->data = ospf_lsa_data_new (length);
|
||||
|
@ -1496,9 +1492,6 @@ ospf_summary_asbr_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa)
|
|||
|
||||
new->data->ls_seqnum = lsa_seqnum_increment (lsa);
|
||||
|
||||
/* Re-calculate checksum. */
|
||||
ospf_lsa_checksum (new->data);
|
||||
|
||||
ospf_lsa_install (ospf, NULL, new);
|
||||
|
||||
/* Flood LSA through area. */
|
||||
|
@ -1724,7 +1717,7 @@ ospf_external_lsa_new (struct ospf *ospf,
|
|||
/* Now, create OSPF LSA instance. */
|
||||
new = ospf_lsa_new ();
|
||||
new->area = NULL;
|
||||
SET_FLAG (new->flags, OSPF_LSA_SELF|OSPF_LSA_APPROVED);
|
||||
SET_FLAG (new->flags, OSPF_LSA_SELF | OSPF_LSA_APPROVED | OSPF_LSA_SELF_CHECKED);
|
||||
|
||||
/* Copy LSA data to store, discard stream. */
|
||||
new->data = ospf_lsa_data_new (length);
|
||||
|
@ -1811,8 +1804,6 @@ ospf_install_flood_nssa (struct ospf *ospf,
|
|||
return;
|
||||
}
|
||||
}
|
||||
/* Re-calculate checksum. */
|
||||
ospf_lsa_checksum (new->data);
|
||||
|
||||
/* install also as Type-7 */
|
||||
ospf_lsa_install (ospf, NULL, new); /* Remove Old, Lock New = 2 */
|
||||
|
@ -1862,7 +1853,6 @@ ospf_lsa_translated_nssa_new (struct ospf *ospf,
|
|||
|
||||
/* add translated flag, checksum and lock new lsa */
|
||||
SET_FLAG (new->flags, OSPF_LSA_LOCAL_XLT); /* Translated from 7 */
|
||||
ospf_lsa_checksum (new->data);
|
||||
new = ospf_lsa_lock (new);
|
||||
|
||||
return new;
|
||||
|
@ -2416,9 +2406,6 @@ ospf_external_lsa_refresh (struct ospf *ospf, struct ospf_lsa *lsa,
|
|||
|
||||
new->data->ls_seqnum = lsa_seqnum_increment (lsa);
|
||||
|
||||
/* Re-calculate checksum. */
|
||||
ospf_lsa_checksum (new->data);
|
||||
|
||||
ospf_lsa_install (ospf, NULL, new); /* As type-5. */
|
||||
|
||||
/* Flood LSA through AS. */
|
||||
|
|
Loading…
Reference in a new issue