| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  *	BIRD -- OSPF | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2004-06-04 21:05:43 +00:00
										 |  |  |  *	(c) 1999--2004 Ondrej Filip <feela@network.cz> | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  *	Can be freely distributed and used under the terms of the GNU GPL. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "ospf.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-05-02 22:19:41 +00:00
										 |  |  | void | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  | flush_lsa(struct top_hash_entry *en, struct proto_ospf *po) | 
					
						
							| 
									
										
										
										
											2000-05-02 22:19:41 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |   struct proto *p = &po->proto; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   OSPF_TRACE(D_EVENTS, | 
					
						
							| 
									
										
										
										
											2004-06-25 16:39:53 +00:00
										 |  |  | 	     "Going to remove node Type: %u, Id: %I, Rt: %I, Age: %u, SN: 0x%x", | 
					
						
							|  |  |  | 	     en->lsa.type, en->lsa.id, en->lsa.rt, en->lsa.age, en->lsa.sn); | 
					
						
							| 
									
										
										
										
											2000-05-09 19:36:32 +00:00
										 |  |  |   s_rem_node(SNODE en); | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   if (en->lsa_body != NULL) | 
					
						
							|  |  |  |     mb_free(en->lsa_body); | 
					
						
							|  |  |  |   en->lsa_body = NULL; | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |   ospf_hash_delete(po->gr, en); | 
					
						
							| 
									
										
										
										
											2000-05-02 22:19:41 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-06-07 22:31:47 +00:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * ospf_age | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |  * @po: ospf protocol | 
					
						
							| 
									
										
										
										
											2000-06-07 22:31:47 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |  * This function is periodicaly invoked from ospf_disp(). It computes the new | 
					
						
							| 
									
										
										
										
											2003-08-23 10:42:41 +00:00
										 |  |  |  * age of all LSAs and old (@age is higher than %LSA_MAXAGE) LSAs are flushed | 
					
						
							|  |  |  |  * whenever possible. If an LSA originated by the router itself is older | 
					
						
							|  |  |  |  * than %LSREFRESHTIME a new instance is originated. | 
					
						
							| 
									
										
										
										
											2000-06-07 22:31:47 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2003-08-23 10:42:41 +00:00
										 |  |  |  * The RFC says that a router should check the checksum of every LSA to detect | 
					
						
							|  |  |  |  * hardware problems. BIRD does not do this to minimalize CPU utilization. | 
					
						
							| 
									
										
										
										
											2000-06-07 23:34:43 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2003-08-23 10:42:41 +00:00
										 |  |  |  * If routing table calculation is scheduled, it also invalidates the old routing | 
					
						
							| 
									
										
										
										
											2000-06-07 23:34:43 +00:00
										 |  |  |  * table calculation results. | 
					
						
							| 
									
										
										
										
											2000-06-07 22:31:47 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2000-05-02 22:19:41 +00:00
										 |  |  | void | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  | ospf_age(struct proto_ospf *po) | 
					
						
							| 
									
										
										
										
											2000-05-02 22:19:41 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |   struct proto *p = &po->proto; | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   struct top_hash_entry *en, *nxt; | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |   int flush = can_flush_lsa(po); | 
					
						
							| 
									
										
										
										
											2000-05-31 14:21:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |   if (po->cleanup) OSPF_TRACE(D_EVENTS, "Running ospf_age cleanup"); | 
					
						
							| 
									
										
										
										
											2002-03-04 15:52:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |   WALK_SLIST_DELSAFE(en, nxt, po->lsal) | 
					
						
							| 
									
										
										
										
											2000-05-02 22:19:41 +00:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |     if (po->cleanup) | 
					
						
							| 
									
										
										
										
											2000-06-07 23:34:43 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       en->color = OUTSPF; | 
					
						
							|  |  |  |       en->dist = LSINFINITY; | 
					
						
							|  |  |  |       en->nhi = NULL; | 
					
						
							| 
									
										
										
										
											2004-07-14 21:46:20 +00:00
										 |  |  |       en->nh = IPA_NONE; | 
					
						
							|  |  |  |       en->lb = IPA_NONE; | 
					
						
							| 
									
										
										
										
											2000-06-07 23:34:43 +00:00
										 |  |  |       DBG("Infinitying Type: %u, Id: %I, Rt: %I\n", en->lsa.type, en->lsa.id, | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 	  en->lsa.rt); | 
					
						
							| 
									
										
										
										
											2000-06-07 23:34:43 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |     if (en->lsa.age == LSA_MAXAGE) | 
					
						
							| 
									
										
										
										
											2000-05-31 14:21:56 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       if (flush) | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  | 	flush_lsa(en, po); | 
					
						
							| 
									
										
										
										
											2000-06-02 12:34:28 +00:00
										 |  |  |       continue; | 
					
						
							| 
									
										
										
										
											2000-05-31 14:21:56 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |     if ((en->lsa.rt == p->cf->global->router_id) &&(en->lsa.age >= | 
					
						
							|  |  |  | 						    LSREFRESHTIME)) | 
					
						
							| 
									
										
										
										
											2000-05-31 14:21:56 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       OSPF_TRACE(D_EVENTS, "Refreshing my LSA: Type: %u, Id: %I, Rt: %I", | 
					
						
							|  |  |  | 		 en->lsa.type, en->lsa.id, en->lsa.rt); | 
					
						
							|  |  |  |       en->lsa.sn++; | 
					
						
							|  |  |  |       en->lsa.age = 0; | 
					
						
							|  |  |  |       en->inst_t = now; | 
					
						
							|  |  |  |       en->ini_age = 0; | 
					
						
							| 
									
										
										
										
											2004-06-06 18:45:08 +00:00
										 |  |  |       lsasum_calculate(&en->lsa, en->lsa_body); | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |       ospf_lsupd_flood(NULL, NULL, &en->lsa, NULL, en->oa, 1); | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       continue; | 
					
						
							| 
									
										
										
										
											2000-05-31 14:21:56 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |     if ((en->lsa.age = (en->ini_age + (now - en->inst_t))) >= LSA_MAXAGE) | 
					
						
							| 
									
										
										
										
											2000-05-31 14:21:56 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       if (flush) | 
					
						
							| 
									
										
										
										
											2000-06-04 19:21:23 +00:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  | 	flush_lsa(en, po); | 
					
						
							| 
									
										
										
										
											2004-06-06 16:00:09 +00:00
										 |  |  | 	schedule_rtcalc(po); | 
					
						
							| 
									
										
										
										
											2000-06-04 19:21:23 +00:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       else | 
					
						
							|  |  |  | 	en->lsa.age = LSA_MAXAGE; | 
					
						
							| 
									
										
										
										
											2000-05-31 14:21:56 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2000-05-02 22:19:41 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |   po->cleanup = 0; | 
					
						
							| 
									
										
										
										
											2000-05-02 22:19:41 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | void | 
					
						
							|  |  |  | htonlsah(struct ospf_lsa_header *h, struct ospf_lsa_header *n) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   n->age = htons(h->age); | 
					
						
							|  |  |  |   n->options = h->options; | 
					
						
							|  |  |  |   n->type = h->type; | 
					
						
							|  |  |  |   n->id = htonl(h->id); | 
					
						
							|  |  |  |   n->rt = htonl(h->rt); | 
					
						
							|  |  |  |   n->sn = htonl(h->sn); | 
					
						
							|  |  |  |   n->checksum = htons(h->checksum); | 
					
						
							|  |  |  |   n->length = htons(h->length); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void | 
					
						
							|  |  |  | ntohlsah(struct ospf_lsa_header *n, struct ospf_lsa_header *h) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   h->age = ntohs(n->age); | 
					
						
							|  |  |  |   h->options = n->options; | 
					
						
							|  |  |  |   h->type = n->type; | 
					
						
							|  |  |  |   h->id = ntohl(n->id); | 
					
						
							|  |  |  |   h->rt = ntohl(n->rt); | 
					
						
							|  |  |  |   h->sn = ntohl(n->sn); | 
					
						
							|  |  |  |   h->checksum = ntohs(n->checksum); | 
					
						
							|  |  |  |   h->length = ntohs(n->length); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void | 
					
						
							|  |  |  | htonlsab(void *h, void *n, u8 type, u16 len) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   unsigned int i; | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   switch (type) | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   case LSA_T_RT: | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |       struct ospf_lsa_rt *hrt, *nrt; | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       struct ospf_lsa_rt_link *hrtl, *nrtl; | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  |       u16 links; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       nrt = n; | 
					
						
							|  |  |  |       hrt = h; | 
					
						
							|  |  |  |       links = hrt->links; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       nrt->veb.byte = hrt->veb.byte; | 
					
						
							|  |  |  |       nrt->padding = 0; | 
					
						
							|  |  |  |       nrt->links = htons(hrt->links); | 
					
						
							|  |  |  |       nrtl = (struct ospf_lsa_rt_link *) (nrt + 1); | 
					
						
							|  |  |  |       hrtl = (struct ospf_lsa_rt_link *) (hrt + 1); | 
					
						
							|  |  |  |       for (i = 0; i < links; i++) | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 	(nrtl + i)->id = htonl((hrtl + i)->id); | 
					
						
							|  |  |  | 	(nrtl + i)->data = htonl((hrtl + i)->data); | 
					
						
							|  |  |  | 	(nrtl + i)->type = (hrtl + i)->type; | 
					
						
							|  |  |  | 	(nrtl + i)->notos = (hrtl + i)->notos; | 
					
						
							|  |  |  | 	(nrtl + i)->metric = htons((hrtl + i)->metric); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   case LSA_T_NET: | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       u32 *hid, *nid; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       nid = n; | 
					
						
							|  |  |  |       hid = h; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       for (i = 0; i < (len / sizeof(u32)); i++) | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 	*(nid + i) = htonl(*(hid + i)); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   case LSA_T_SUM_NET: | 
					
						
							|  |  |  |   case LSA_T_SUM_RT: | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2004-06-25 16:39:53 +00:00
										 |  |  |       struct ospf_lsa_sum *hs, *ns; | 
					
						
							|  |  |  |       union ospf_lsa_sum_tm *hn, *nn; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       hs = h; | 
					
						
							|  |  |  |       ns = n; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       ns->netmask = hs->netmask; | 
					
						
							| 
									
										
										
										
											2000-05-30 13:39:06 +00:00
										 |  |  |       ipa_hton(ns->netmask); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-25 16:39:53 +00:00
										 |  |  |       hn = (union ospf_lsa_sum_tm *) (hs + 1); | 
					
						
							|  |  |  |       nn = (union ospf_lsa_sum_tm *) (ns + 1); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-25 16:39:53 +00:00
										 |  |  |       for (i = 0; i < ((len - sizeof(struct ospf_lsa_sum)) / | 
					
						
							|  |  |  | 		       sizeof(union ospf_lsa_sum_tm)); i++) | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2004-06-25 16:39:53 +00:00
										 |  |  | 	(nn + i)->metric = htonl((hn + i)->metric); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   case LSA_T_EXT: | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |       struct ospf_lsa_ext *he, *ne; | 
					
						
							|  |  |  |       struct ospf_lsa_ext_tos *ht, *nt; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       he = h; | 
					
						
							|  |  |  |       ne = n; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       ne->netmask = he->netmask; | 
					
						
							| 
									
										
										
										
											2000-05-30 13:39:06 +00:00
										 |  |  |       ipa_hton(ne->netmask); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       ht = (struct ospf_lsa_ext_tos *) (he + 1); | 
					
						
							|  |  |  |       nt = (struct ospf_lsa_ext_tos *) (ne + 1); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       for (i = 0; i < ((len - sizeof(struct ospf_lsa_ext)) / | 
					
						
							|  |  |  | 		       sizeof(struct ospf_lsa_ext_tos)); i++) | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2004-06-25 16:39:53 +00:00
										 |  |  | 	(nt + i)->etm.metric = htonl((ht + i)->etm.metric); | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 	(nt + i)->fwaddr = (ht + i)->fwaddr; | 
					
						
							|  |  |  | 	ipa_hton((nt + i)->fwaddr); | 
					
						
							|  |  |  | 	(nt + i)->tag = htonl((ht + i)->tag); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   default: | 
					
						
							|  |  |  |     bug("(hton): Unknown LSA"); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |   } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void | 
					
						
							|  |  |  | ntohlsab(void *n, void *h, u8 type, u16 len) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   unsigned int i; | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   switch (type) | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   case LSA_T_RT: | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |       struct ospf_lsa_rt *hrt, *nrt; | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       struct ospf_lsa_rt_link *hrtl, *nrtl; | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  |       u16 links; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       nrt = n; | 
					
						
							|  |  |  |       hrt = h; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       hrt->veb.byte = nrt->veb.byte; | 
					
						
							|  |  |  |       hrt->padding = 0; | 
					
						
							|  |  |  |       links = hrt->links = ntohs(nrt->links); | 
					
						
							|  |  |  |       nrtl = (struct ospf_lsa_rt_link *) (nrt + 1); | 
					
						
							|  |  |  |       hrtl = (struct ospf_lsa_rt_link *) (hrt + 1); | 
					
						
							|  |  |  |       for (i = 0; i < links; i++) | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 	(hrtl + i)->id = ntohl((nrtl + i)->id); | 
					
						
							|  |  |  | 	(hrtl + i)->data = ntohl((nrtl + i)->data); | 
					
						
							|  |  |  | 	(hrtl + i)->type = (nrtl + i)->type; | 
					
						
							|  |  |  | 	(hrtl + i)->notos = (nrtl + i)->notos; | 
					
						
							|  |  |  | 	(hrtl + i)->metric = ntohs((nrtl + i)->metric); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   case LSA_T_NET: | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       u32 *hid, *nid; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       hid = h; | 
					
						
							|  |  |  |       nid = n; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       for (i = 0; i < (len / sizeof(u32)); i++) | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 	*(hid + i) = ntohl(*(nid + i)); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   case LSA_T_SUM_NET: | 
					
						
							|  |  |  |   case LSA_T_SUM_RT: | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2004-06-25 16:39:53 +00:00
										 |  |  |       struct ospf_lsa_sum *hs, *ns; | 
					
						
							|  |  |  |       union ospf_lsa_sum_tm *hn, *nn; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       hs = h; | 
					
						
							|  |  |  |       ns = n; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       hs->netmask = ns->netmask; | 
					
						
							| 
									
										
										
										
											2000-05-30 13:39:06 +00:00
										 |  |  |       ipa_ntoh(hs->netmask); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-25 16:39:53 +00:00
										 |  |  |       hn = (union ospf_lsa_sum_tm *) (hs + 1); | 
					
						
							|  |  |  |       nn = (union ospf_lsa_sum_tm *) (ns + 1); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-25 16:39:53 +00:00
										 |  |  |       for (i = 0; i < ((len - sizeof(struct ospf_lsa_sum)) / | 
					
						
							|  |  |  | 		       sizeof(union ospf_lsa_sum_tm)); i++) | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2004-06-25 16:39:53 +00:00
										 |  |  | 	(hn + i)->metric = ntohl((nn + i)->metric); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   case LSA_T_EXT: | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |       struct ospf_lsa_ext *he, *ne; | 
					
						
							|  |  |  |       struct ospf_lsa_ext_tos *ht, *nt; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       he = h; | 
					
						
							|  |  |  |       ne = n; | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       he->netmask = ne->netmask; | 
					
						
							| 
									
										
										
										
											2000-05-30 13:39:06 +00:00
										 |  |  |       ipa_ntoh(he->netmask); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       ht = (struct ospf_lsa_ext_tos *) (he + 1); | 
					
						
							|  |  |  |       nt = (struct ospf_lsa_ext_tos *) (ne + 1); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       for (i = 0; i < ((len - sizeof(struct ospf_lsa_ext)) / | 
					
						
							|  |  |  | 		       sizeof(struct ospf_lsa_ext_tos)); i++) | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2004-06-25 16:39:53 +00:00
										 |  |  | 	(ht + i)->etm.metric = ntohl((nt + i)->etm.metric); | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 	(ht + i)->fwaddr = (nt + i)->fwaddr; | 
					
						
							|  |  |  | 	ipa_ntoh((ht + i)->fwaddr); | 
					
						
							|  |  |  | 	(ht + i)->tag = ntohl((nt + i)->tag); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   default: | 
					
						
							|  |  |  |     bug("(ntoh): Unknown LSA"); | 
					
						
							| 
									
										
										
										
											2000-03-31 00:21:41 +00:00
										 |  |  |   } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  | #define MODX 4102		/* larges signed value without overflow */
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Fletcher Checksum -- Refer to RFC1008. */ | 
					
						
							|  |  |  | #define MODX                 4102
 | 
					
						
							|  |  |  | #define LSA_CHECKSUM_OFFSET    15
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* FIXME This is VERY uneficient, I have huge endianity problems */ | 
					
						
							|  |  |  | void | 
					
						
							| 
									
										
										
										
											2004-06-06 18:45:08 +00:00
										 |  |  | lsasum_calculate(struct ospf_lsa_header *h, void *body) | 
					
						
							| 
									
										
										
										
											2000-04-02 20:41:33 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   u16 length; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   length = h->length; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   htonlsah(h, h); | 
					
						
							|  |  |  |   htonlsab(body, body, h->type, length - sizeof(struct ospf_lsa_header)); | 
					
						
							| 
									
										
										
										
											2000-04-02 20:41:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 18:45:08 +00:00
										 |  |  |   (void) lsasum_check(h, body); | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   ntohlsah(h, h); | 
					
						
							|  |  |  |   ntohlsab(body, body, h->type, length - sizeof(struct ospf_lsa_header)); | 
					
						
							| 
									
										
										
										
											2000-04-02 20:41:33 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Note, that this function expects that LSA is in big endianity | 
					
						
							|  |  |  |  * It also returns value in big endian | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | u16 | 
					
						
							| 
									
										
										
										
											2004-06-06 18:45:08 +00:00
										 |  |  | lsasum_check(struct ospf_lsa_header *h, void *body) | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   u8 *sp, *ep, *p, *q, *b; | 
					
						
							|  |  |  |   int c0 = 0, c1 = 0; | 
					
						
							|  |  |  |   int x, y; | 
					
						
							| 
									
										
										
										
											2003-08-26 10:41:02 +00:00
										 |  |  |   u16 length; | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-08-26 10:41:02 +00:00
										 |  |  |   b = body; | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  |   sp = (char *) &h->options; | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   length = ntohs(h->length) - 2; | 
					
						
							| 
									
										
										
										
											2000-04-02 20:41:33 +00:00
										 |  |  |   h->checksum = 0; | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   for (ep = sp + length; sp < ep; sp = q) | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   {				/* Actually MODX is very large, do we need the for-cyclus? */ | 
					
						
							| 
									
										
										
										
											2000-04-02 20:41:33 +00:00
										 |  |  |     q = sp + MODX; | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |     if (q > ep) | 
					
						
							|  |  |  |       q = ep; | 
					
						
							| 
									
										
										
										
											2000-04-02 20:41:33 +00:00
										 |  |  |     for (p = sp; p < q; p++) | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2000-04-02 20:41:33 +00:00
										 |  |  |       /* 
 | 
					
						
							|  |  |  |        * I count with bytes from header and than from body | 
					
						
							|  |  |  |        * but if there is no body, it's appended to header | 
					
						
							|  |  |  |        * (probably checksum in update receiving) and I go on | 
					
						
							|  |  |  |        * after header | 
					
						
							|  |  |  |        */ | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       if ((b == NULL) || (p < (u8 *) (h + 1))) | 
					
						
							| 
									
										
										
										
											2000-04-02 20:41:33 +00:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 	c0 += *p; | 
					
						
							| 
									
										
										
										
											2000-04-02 20:41:33 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       else | 
					
						
							|  |  |  |       { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 	c0 += *(b + (p - sp) - sizeof(struct ospf_lsa_header) + 2); | 
					
						
							| 
									
										
										
										
											2000-04-02 20:41:33 +00:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       c1 += c0; | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2000-04-02 20:41:33 +00:00
										 |  |  |     c0 %= 255; | 
					
						
							|  |  |  |     c1 %= 255; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   x = ((length - LSA_CHECKSUM_OFFSET) * c0 - c1) % 255; | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   if (x <= 0) | 
					
						
							|  |  |  |     x += 255; | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  |   y = 510 - c0 - x; | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   if (y > 255) | 
					
						
							|  |  |  |     y -= 255; | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   ((u8 *) & h->checksum)[0] = x; | 
					
						
							|  |  |  |   ((u8 *) & h->checksum)[1] = y; | 
					
						
							| 
									
										
										
										
											2003-08-26 10:41:02 +00:00
										 |  |  |   return h->checksum; | 
					
						
							| 
									
										
										
										
											2000-04-01 02:45:49 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-04-02 19:04:23 +00:00
										 |  |  | int | 
					
						
							|  |  |  | lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2) | 
					
						
							| 
									
										
										
										
											2000-04-02 20:41:33 +00:00
										 |  |  | 			/* Return codes from point of view of l1 */ | 
					
						
							| 
									
										
										
										
											2000-04-02 19:04:23 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   u32 sn1, sn2; | 
					
						
							| 
									
										
										
										
											2000-05-31 18:21:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   sn1 = l1->sn - LSA_INITSEQNO + 1; | 
					
						
							|  |  |  |   sn2 = l2->sn - LSA_INITSEQNO + 1; | 
					
						
							| 
									
										
										
										
											2000-05-31 18:21:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   if (sn1 > sn2) | 
					
						
							|  |  |  |     return CMP_NEWER; | 
					
						
							|  |  |  |   if (sn1 < sn2) | 
					
						
							|  |  |  |     return CMP_OLDER; | 
					
						
							| 
									
										
										
										
											2000-05-30 15:01:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   if (l1->checksum != l2->checksum) | 
					
						
							|  |  |  |     return l1->checksum < l2->checksum ? CMP_OLDER : CMP_NEWER; | 
					
						
							| 
									
										
										
										
											2000-05-30 15:01:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   if ((l1->age == LSA_MAXAGE) && (l2->age != LSA_MAXAGE)) | 
					
						
							|  |  |  |     return CMP_NEWER; | 
					
						
							|  |  |  |   if ((l2->age == LSA_MAXAGE) && (l1->age != LSA_MAXAGE)) | 
					
						
							|  |  |  |     return CMP_OLDER; | 
					
						
							| 
									
										
										
										
											2000-05-30 15:01:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   if (ABS(l1->age - l2->age) > LSA_MAXAGEDIFF) | 
					
						
							|  |  |  |     return l1->age < l2->age ? CMP_NEWER : CMP_OLDER; | 
					
						
							| 
									
										
										
										
											2000-05-30 15:01:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   return CMP_SAME; | 
					
						
							| 
									
										
										
										
											2000-04-02 19:04:23 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-06-07 22:31:47 +00:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * lsa_install_new - install new LSA into database | 
					
						
							|  |  |  |  * @lsa: LSA header | 
					
						
							| 
									
										
										
										
											2000-06-08 12:42:34 +00:00
										 |  |  |  * @body: pointer to LSA body | 
					
						
							| 
									
										
										
										
											2000-06-07 22:31:47 +00:00
										 |  |  |  * @oa: current ospf_area | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This function ensures installing new LSA into LSA database. Old instance is | 
					
						
							| 
									
										
										
										
											2002-04-03 15:41:05 +00:00
										 |  |  |  * replaced. Several actions are taken to detect if new routing table | 
					
						
							| 
									
										
										
										
											2000-06-07 22:31:47 +00:00
										 |  |  |  * calculation is necessary. This is described in 13.2 of RFC 2328. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2000-04-04 15:55:55 +00:00
										 |  |  | struct top_hash_entry * | 
					
						
							| 
									
										
										
										
											2000-06-07 22:31:47 +00:00
										 |  |  | lsa_install_new(struct ospf_lsa_header *lsa, void *body, struct ospf_area *oa) | 
					
						
							| 
									
										
										
										
											2000-04-04 15:55:55 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2004-06-04 12:53:10 +00:00
										 |  |  |   /* LSA can be temporarrily, but body must be mb_allocated. */ | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   int change = 0; | 
					
						
							| 
									
										
										
										
											2000-04-30 22:14:31 +00:00
										 |  |  |   unsigned i; | 
					
						
							| 
									
										
										
										
											2000-04-04 15:55:55 +00:00
										 |  |  |   struct top_hash_entry *en; | 
					
						
							| 
									
										
										
										
											2004-06-06 16:00:09 +00:00
										 |  |  |   struct proto_ospf *po = oa->po; | 
					
						
							| 
									
										
										
										
											2000-04-04 15:55:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |   if ((en = ospf_hash_find_header(po->gr, oa->areaid, lsa)) == NULL) | 
					
						
							| 
									
										
										
										
											2000-04-04 15:55:55 +00:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |     en = ospf_hash_get_header(po->gr, oa, lsa); | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |     change = 1; | 
					
						
							| 
									
										
										
										
											2000-04-04 15:55:55 +00:00
										 |  |  |   } | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |     if ((en->lsa.length != lsa->length) || (en->lsa.options != lsa->options) | 
					
						
							|  |  |  | 	|| ((en->lsa.age == LSA_MAXAGE) || (lsa->age == LSA_MAXAGE))) | 
					
						
							|  |  |  |       change = 1; | 
					
						
							| 
									
										
										
										
											2000-04-04 15:55:55 +00:00
										 |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       u8 *k = en->lsa_body, *l = body; | 
					
						
							|  |  |  |       for (i = 0; i < (lsa->length - sizeof(struct ospf_lsa_header)); i++) | 
					
						
							| 
									
										
										
										
											2000-04-04 15:55:55 +00:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 	if (*(k + i) != *(l + i)) | 
					
						
							| 
									
										
										
										
											2000-04-04 15:55:55 +00:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 	  change = 1; | 
					
						
							| 
									
										
										
										
											2000-04-04 15:55:55 +00:00
										 |  |  | 	  break; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2000-04-30 22:14:31 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2000-06-05 02:23:20 +00:00
										 |  |  |     s_rem_node(SNODE en); | 
					
						
							| 
									
										
										
										
											2000-04-30 22:14:31 +00:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-06-05 02:23:20 +00:00
										 |  |  |   DBG("Inst lsa: Id: %I, Rt: %I, Type: %u, Age: %u, Sum: %u, Sn: 0x%x\n", | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |       lsa->id, lsa->rt, lsa->type, lsa->age, lsa->checksum, lsa->sn); | 
					
						
							| 
									
										
										
										
											2000-06-05 02:23:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-15 16:37:52 +00:00
										 |  |  |   s_add_tail(&po->lsal, SNODE en); | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  |   en->inst_t = now; | 
					
						
							|  |  |  |   if (en->lsa_body != NULL) | 
					
						
							|  |  |  |     mb_free(en->lsa_body); | 
					
						
							|  |  |  |   en->lsa_body = body; | 
					
						
							|  |  |  |   memcpy(&en->lsa, lsa, sizeof(struct ospf_lsa_header)); | 
					
						
							|  |  |  |   en->ini_age = en->lsa.age; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (change) | 
					
						
							| 
									
										
										
										
											2000-04-30 22:14:31 +00:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2004-06-06 16:00:09 +00:00
										 |  |  |     schedule_rtcalc(po); | 
					
						
							| 
									
										
										
										
											2000-04-04 15:55:55 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2004-06-06 09:37:54 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-04-04 15:55:55 +00:00
										 |  |  |   return en; | 
					
						
							|  |  |  | } |