📄 patch2.4
字号:
diff -X exclude_files -Nabur ospfd2.3/linux/Makefile ospfd2.4/linux/Makefile--- ospfd2.3/linux/Makefile Mon May 21 10:19:28 2001+++ ospfd2.4/linux/Makefile Thu Sep 13 16:05:44 2001@@ -15,6 +15,7 @@ config.o \ dbage.o \ grplsa.o \+ helper.o \ hostmode.o \ ifcfsm.o \ lsa.o \@@ -29,6 +30,7 @@ pat.o \ phyint.o \ priq.o \+ restart.o \ rte.o \ rtrlsa.o \ spfack.o \@@ -44,6 +46,7 @@ spfvl.o \ summlsa.o \ timer.o \+ tlv.o \ md5c.o install: ospfd ospfd_mon ospfd_browserdiff -X exclude_files -Nabur ospfd2.3/linux/ospfd_browser.C ospfd2.4/linux/ospfd_browser.C--- ospfd2.3/linux/ospfd_browser.C Mon May 21 10:19:31 2001+++ ospfd2.4/linux/ospfd_browser.C Thu Sep 13 16:05:49 2001@@ -54,6 +54,7 @@ void display_html(char *); void display_error(char *); void get_opaques();+void get_lllsa(); const int OSPFD_MON_PORT = 12767; @@ -93,6 +94,8 @@ extern char *select_lsa_top; extern char *select_lsa_bottom; extern char *expand_lsa_top;+extern char *expand_lllsa_top;+extern char *expand_vllsa_top; extern char *expand_lsa_bottom; extern char *error_page; extern char *opaque_page_top;@@ -160,6 +163,32 @@ } } +/* Return the flooding scope of an LSA, based on its LS type.+ */++int flooding_scope(byte lstype)++{+ switch(lstype) {+ case LST_LINK_OPQ:// Link-scoped Opaque-LSAs+ return(LocalScope);+ case LST_RTR: // Router-LSAs+ case LST_NET: // Network-LSAs+ case LST_SUMM: // Summary-link LSAs (inter-area routes)+ case LST_ASBR: // ASBR-summaries (inter-area)+ case LST_GM: // Group-membership-LSA (MOSPF)+ case LST_AREA_OPQ:// Area-scoped Opaque-LSAs+ return(AreaScope);+ case LST_ASL: // AS-external_LSAs+ case LST_AS_OPQ: // AS-scoped Opaque-LSAs+ return(GlobalScope);+ default:+ break;+ }++ return(0);+}+ /* The ospfd_html program is a CGI application * that establishes a TCP connection to the ospfd * routing daemon, and then based on information@@ -261,7 +290,7 @@ else if (strncmp(command, "area", 4) == 0) get_areas(true); else if (strncmp(command, "data", 4) == 0)- get_database(0);+ get_database(LST_RTR); else if (strncmp(command, "as", 2) == 0) get_database(LST_ASL); else if (strncmp(command, "int", 3) == 0)@@ -276,6 +305,8 @@ get_lsa(); else if (strncmp(command, "opqs", 4) == 0) get_opaques();+ else if (strncmp(command, "lladv", 5) == 0)+ get_lllsa(); } display_html(page_footer);@@ -335,6 +366,8 @@ addVP(&pairs, "overflow", yesorno(s->overflow_state)); sprintf(buffer, "%d.%d", s->vmajor, s->vminor); addVP(&pairs, "sw_vers", buffer);+ sprintf(buffer, "%d", ntoh32(s->n_orig_allocs));+ addVP(&pairs, "n_orig_allocs", buffer); if (print) display_html(statistics_page); }@@ -443,13 +476,15 @@ int n_lsas = 0; uns32 xsum = 0; ValuePair *entry;+ bool global_scope; + global_scope = (flooding_scope(lstype) == GlobalScope); get_statistics(false); if ((entry = (ValuePair *)pairs.find("area_id"))) { a_id = ntoh32(inet_addr(entry->value)); display_html(database_page_top); }- else if (lstype != LST_ASL) {+ else if (!global_scope) { if (get_areas(false) > 1) { display_html(select_area_top); for (int i=0; ; i++) {@@ -474,7 +509,7 @@ ls_id = 0; adv_rtr = 0;- new_lstype = lstype;+ new_lstype = 0; while (1) { MonHdr *mhdr;@@ -512,9 +547,7 @@ break; new_lstype = ntoh32(m->body.lsarq.ls_type); if (new_lstype != lstype) {- if (lstype == LST_ASL)- break;- if (new_lstype == LST_ASL) {+ if (flooding_scope(new_lstype) != flooding_scope(lstype)) { new_lstype++; ls_id = 0; adv_rtr = 0;@@ -587,7 +620,7 @@ display_html(database_page_bottom); } -/* Get the Opaque-LSAs, through the registration interface.+/* Get the Link-local LSAs. */ void get_opaques()@@ -597,17 +630,15 @@ int mlen; int n_lsas = 0; uns32 xsum = 0;+ InAddr if_addr = 0;+ int phyint = 0;+ aid_t taid = 0;+ byte new_lstype = 0;+ lsid_t ls_id = 0;+ rtid_t adv_rtr = 0; + get_statistics(false); display_html(opaque_page_top);- req.hdr.version = OSPF_MON_VERSION;- req.hdr.retcode = 0;- req.hdr.exact = 0;- mlen = sizeof(MonHdr);- req.hdr.id = hton16(id++);- if (!monpkt->sendpkt_suspend(&req, MonReq_OpqReg, 0, mlen)) {- display_error("Send failed");- exit(0);- } while (1) { MonHdr *mhdr;@@ -622,9 +653,15 @@ req.hdr.version = OSPF_MON_VERSION; req.hdr.retcode = 0; req.hdr.exact = 0;- mlen = sizeof(MonHdr);+ mlen = sizeof(MonHdr) + sizeof(MonRqLLLsa); req.hdr.id = hton16(id++);- if (!monpkt->sendpkt_suspend(&req, MonReq_OpqNext, 0, mlen)) {+ req.body.lllsarq.if_addr = hton32(if_addr);+ req.body.lllsarq.phyint = hton32(phyint);+ req.body.lllsarq.taid = hton32(taid);+ req.body.lllsarq.ls_type = hton32(new_lstype);+ req.body.lllsarq.ls_id = hton32(ls_id);+ req.body.lllsarq.adv_rtr = hton32(adv_rtr);+ if (!monpkt->sendpkt_suspend(&req, MonReq_LLLSA, 0, mlen)) { display_error("Send failed"); exit(0); }@@ -637,37 +674,36 @@ m = (MonMsg *) mhdr; if (m->hdr.retcode != 0) break;- addVP(&pairs, "phyint", "n/a");- addVP(&pairs, "if_addr", "n/a");- addVP(&pairs, "area_id", "n/a"); n_lsas++;- lshdr = (LShdr *) (((char *) m) + sizeof(MonHdr) + sizeof(OpqRsp));+ lshdr = (LShdr *) (((char *) m) + sizeof(MonHdr) + sizeof(MonRqLLLsa)); xsum += ntoh16(lshdr->ls_xsum); sprintf(buffer, "%d", lshdr->ls_type); addVP(&pairs, "ls_typeno", buffer);+ new_lstype = lshdr->ls_type; // Print out Link state header- switch (lshdr->ls_type) {- case LST_LINK_OPQ: addVP(&pairs, "ls_type", "Link Opaque");- sprintf(buffer, "%d", ntoh32(m->body.opqrsp.phyint));+ sprintf(buffer, "%d", ntoh32(m->body.lllsarq.phyint));+ phyint = ntoh32(m->body.lllsarq.phyint); addVP(&pairs, "phyint", buffer);- in = *((in_addr *) &m->body.opqrsp.if_addr);+ in = *((in_addr *) &m->body.lllsarq.if_addr); addVP(&pairs, "if_addr", inet_ntoa(in));- break;- case LST_AREA_OPQ:- addVP(&pairs, "ls_type", "Area Opaque");- in = *((in_addr *) &m->body.opqrsp.a_id);+ if_addr = ntoh32(in.s_addr);+ in = *((in_addr *) &m->body.lllsarq.taid);+ taid = ntoh32(in.s_addr);+ addVP(&pairs, "taid", inet_ntoa(in));+ // For link-local LSAs associated with virtual links,+ // put transit area in phyint. If address already holds+ // the Router ID of the other endpoint.+ addVP(&pairs, "phyname", m->body.lllsarq.phyname);+ in = *((in_addr *) &m->body.lllsarq.a_id); addVP(&pairs, "area_id", inet_ntoa(in));- break;- case LST_AS_OPQ:- addVP(&pairs, "ls_type", "AS Opaque");- break;- } in = *((in_addr *) &lshdr->ls_id); addVP(&pairs, "ls_id", inet_ntoa(in));+ ls_id = ntoh32(in.s_addr); in = *((in_addr *) &lshdr->ls_org); addVP(&pairs, "adv_rtr", inet_ntoa(in));+ adv_rtr = ntoh32(in.s_addr); sprintf(buffer, "0x%08x", ntoh32(lshdr->ls_seqno)); addVP(&pairs, "seqno", buffer); sprintf(buffer, "0x%04x", ntoh16(lshdr->ls_xsum));@@ -778,6 +814,77 @@ display_html(expand_lsa_bottom); } +/* Get a given link-local LSA, and print it out in detail.+ */++void get_lllsa()++{+ MonMsg req;+ int mlen;+ uns32 taid=0;+ uns32 ls_id=0;+ uns32 adv_rtr=0;+ byte lstype=0;+ InAddr if_addr=0;+ int phyint=-1;+ MonHdr *mhdr;+ MonMsg *m;+ LShdr *lshdr;+ uns16 type;+ uns16 subtype;+ ValuePair *entry;++ if ((entry = (ValuePair *)pairs.find("ls_type")))+ lstype = atoi(entry->value);+ if ((entry = (ValuePair *)pairs.find("ls_id")))+ ls_id = ntoh32(inet_addr(entry->value));+ if ((entry = (ValuePair *)pairs.find("adv_rtr")))+ adv_rtr = ntoh32(inet_addr(entry->value));+ if ((entry = (ValuePair *)pairs.find("taid")))+ taid = ntoh32(inet_addr(entry->value));+ if ((entry = (ValuePair *)pairs.find("if_addr")))+ if_addr = ntoh32(inet_addr(entry->value));+ if ((entry = (ValuePair *)pairs.find("phyint")) &&+ strcmp(entry->value, "n/a") != 0)+ phyint = atoi(entry->value);++ req.hdr.version = OSPF_MON_VERSION;+ req.hdr.retcode = 0;+ req.hdr.exact = 1;+ req.body.lllsarq.if_addr = hton32(if_addr);+ req.body.lllsarq.phyint = hton32(phyint);+ req.body.lllsarq.taid = hton32(taid);+ req.body.lllsarq.ls_type = hton32(lstype);+ req.body.lllsarq.ls_id = hton32(ls_id);+ req.body.lllsarq.adv_rtr = hton32(adv_rtr);+ mlen = sizeof(MonHdr) + sizeof(MonRqLLLsa);+ req.hdr.id = hton16(id++);+ if (!monpkt->sendpkt_suspend(&req, MonReq_LLLSA, 0, mlen)) {+ display_error("Send failed");+ exit(0);+ }++ if (monpkt->rcv_suspend((void **)&mhdr, type, subtype) == -1) {+ display_error("Receive failed");+ exit(0);+ }++ m = (MonMsg *) mhdr;+ if (m->hdr.retcode != 0) {+ printf("LSA not found\n");+ return;+ }+ // Print out LSA+ lshdr = (LShdr *) (((char *) m) + mlen);+ if (taid == 0)+ display_html(expand_lllsa_top);+ else+ display_html(expand_vllsa_top);+ print_lsa(lshdr);+ display_html(expand_lsa_bottom);+}+ /* Print out a line for each interface. */ @@ -1241,6 +1348,10 @@ <td>ospfd version</td>\n\ <td>$sw_vers$</td>\n\ </tr>\n\+<tr>\n\+<td># LSA orig. allocations</td>\n\+<td>$n_orig_allocs$</td>\n\+</tr>\n\ </table>\n"; /* The areas page.@@ -1393,15 +1504,16 @@ </table>\n\ </table>\n"; -/* The pages used to display the Opaque-LSAs+/* The pages used to display the Link-local LSAs */ char *opaque_page_top = "\ <table>\n\ <tr>\n\ <td width=200>\n\-Router $router_id$'s link-state database for OSPF\n\-Area $area_id$. AS-external-LSAs are not included.\n\+Router $router_id$'s link-local LSAs,\n\+associated with the interfaces specified\n\+by the first three columns.\n\ </td>\n\ </tr>\n\ <tr>\n\@@ -1409,8 +1521,8 @@ </center>\n\ <table border=1>\n\ <tr>\n\-<th>Phyint</th>\n\-<th>If Address</th>\n\+<th>Phy</th>\n\+<th>Addr</th>\n\ <th>Area</th>\n\ <th>LS type</th>\n\ <th>LS ID</th>\n\@@ -1423,10 +1535,10 @@ char *opaque_row = "\ <tr>\n\-<td>$phyint$</a></td>\n\+<td>$phyname$</a></td>\n\ <td>$if_addr$</a></td>\n\ <td>$area_id$</a></td>\n\-<td>$ls_type$</a></td>\n\+<td><a href=\"/cgi-bin/ospfd_browser?command=lladv&addr=$addr$&port=$port$&if_addr=$if_addr$&phyint=$phyint$&phyname=$phyname$&taid=$taid$&area_id=$area_id$&ls_type=$ls_typeno$&ls_id=$ls_id$&adv_rtr=$adv_rtr$\">$ls_type$</a></td>\n\ <td>$ls_id$</td>\n\ <td>$adv_rtr$</td>\n\ <td>$seqno$</td>\n\@@ -1510,6 +1622,25 @@ <hr>\n\ <pre>\n"; +char *expand_lllsa_top = "\+<table cellpadding=0 border=0>\n\+<tr>\n\+<td>\n\+The following link-local LSA was found for the\n\+interface with IP address $if_addr$ and phyint $phyname$ attaching\n\+to Area $area_id$:\n\+<hr>\n\+<pre>\n";++char *expand_vllsa_top = "\+<table cellpadding=0 border=0>\n\+<tr>\n\+<td>\n\+The following link-local LSA was found for the\n\+Virtual link to Router ID $if_addr$ through Transit Area $taid$.\n\+<hr>\n\+<pre>\n";+ char *expand_lsa_bottom = "\ </pre>\n\ </td>\n\@@ -1628,14 +1759,14 @@ <font face=\"Geneva, Arial, Helvetica\" >\n\ <p><center>\n\ <a href=\"/cgi-bin/ospfd_browser?command=area&addr=$addr$&port=$port$\">Areas</a> |\n\-<a href=\"/cgi-bin/ospfd_browser?command=database&addr=$addr$&port=$port$\">Database</a> |\n\+<a href=\"/cgi-bin/ospfd_browser?command=database&addr=$addr$&port=$port$\">Area Database</a> |\n\ <a href=\"/cgi-bin/ospfd_browser?command=interface&addr=$addr$&port=$port$\">Interfaces</a> |\n\ <a href=\"/cgi-bin/ospfd_browser?command=neighbor&addr=$addr$&port=$port$\">Neighbors</a> |\n\ <a href=\"/cgi-bin/ospfd_browser?command=statistics&addr=$addr$&port=$port$\">Statistics</a> |\n\ <a href=\"/cgi-bin/ospfd_browser?command=lsa&addr=$addr$&port=$port$\">LSA expansion</a> |\n\-<a href=\"/cgi-bin/ospfd_browser?command=ases&addr=$addr$&port=$port$\">AS externals</a> |\n\+<a href=\"/cgi-bin/ospfd_browser?command=ases&addr=$addr$&port=$port$\">Global-scoped LSAs</a> |\n\ <a href=\"/cgi-bin/ospfd_browser?command=route&addr=$addr$&port=$port$\">Routing table</a> |\n\-<a href=\"/cgi-bin/ospfd_browser?command=opqs&addr=$addr$&port=$port$\">Opaque-LSAs</a>\n\+<a href=\"/cgi-bin/ospfd_browser?command=opqs&addr=$addr$&port=$port$\">Link-local LSAs</a>\n\ </center>\n\ </td>\n\ </tr>\n\diff -X exclude_files -Nabur ospfd2.3/linux/ospfd_linux.C ospfd2.4/linux/ospfd_linux.C--- ospfd2.3/linux/ospfd_linux.C Mon May 21 10:19:28 2001+++ ospfd2.4/linux/ospfd_linux.C Thu Sep 13 16:05:44 2001@@ -861,7 +861,7 @@ { new_router_id = ntoh32(inet_addr(argv[1])); if (!ospf)- ospf = new OSPF(new_router_id);+ ospf = new OSPF(new_router_id, sys_etime); return(TCL_OK); } diff -X exclude_files -Nabur ospfd2.3/linux/ospfd_linux.h ospfd2.4/linux/ospfd_linux.h--- ospfd2.3/linux/ospfd_linux.h Mon May 21 10:19:28 2001+++ ospfd2.4/linux/ospfd_linux.h Thu Sep 13 16:05:44 2001@@ -61,6 +61,7 @@ void upload_remnants(); char *phyname(int phyint); void sys_spflog(int msgno, char *msgbuf);+ void store_hitless_parms(int, int, struct MD5Seq *); void halt(int code, char *string); void read_config();diff -X exclude_files -Nabur ospfd2.3/linux/system.C ospfd2.4/linux/system.C--- ospfd2.3/linux/system.C Mon May 21 10:19:28 2001+++ ospfd2.4/linux/system.C Thu Sep 13 16:05:44 2001@@ -664,3 +664,37 @@ else exit(0); }+
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -