📄 netshow.c
字号:
} printf ("%-8s: %3d\n", "TOTAL", totalMbufs); printf ("number of mbufs: %ld\n", pNetPool->pPoolStat->mNum); printf ("number of times failed to find space: %ld\n", pNetPool->pPoolStat->mDrops); printf ("number of times waited for space: %ld\n", pNetPool->pPoolStat->mWait); printf ("number of times drained protocols for space: %ld\n", pNetPool->pPoolStat->mDrain); clPoolShow (pNetPool); } /********************************************************************************* netStackDataPoolShow - show network stack data pool statistics** This routine displays the distribution of `mBlk's and clusters in a* the network data pool. The network data pool is used only for data* transfer through the network stack.** The "clusters" column indicates the total number of clusters of that size* that have been allocated. The "free" column indicates the number of* available clusters of that size (the total number of clusters minus those* clusters that are in use). The "usage" column indicates the number of times* clusters have been allocated (not, as you might expect, the number of* clusters currently in use).** RETURNS: N/A** SEE ALSO: netStackSysPoolShow(), netBufLib*/void netStackDataPoolShow (void) {#ifdef VIRTUAL_STACK virtualStackIdCheck(); printf("stack number %d\n", myStackNum);#endif /* VIRTUAL_STACK */ netPoolShow (_pNetDpool); }/********************************************************************************* netStackSysPoolShow - show network stack system pool statistics** This routine displays the distribution of `mBlk's and clusters in a* the network system pool. The network system pool is used only for system* structures such as sockets, routes, interface addresses, protocol control* blocks, multicast addresses, and multicast route entries.** The "clusters" column indicates the total number of clusters of that size* that have been allocated. The "free" column indicates the number of* available clusters of that size (the total number of clusters minus those* clusters that are in use). The "usage" column indicates the number of times* clusters have been allocated (not, as you might expect, the number of* clusters currently in use).** RETURNS: N/A** SEE ALSO: netStackDataPoolShow(), netBufLib*/void netStackSysPoolShow (void) {#ifdef VIRTUAL_STACK virtualStackIdCheck(); printf("stack number %d\n", myStackNum);#endif /* VIRTUAL_STACK */ netPoolShow (_pNetSysPool); }/********************************************************************************* mbufShow - report mbuf statistics** This routine displays the distribution of mbufs in the network.** RETURNS: N/A*/void mbufShow (void) {#ifdef VIRTUAL_STACK virtualStackIdCheck(); printf("stack number %d\n", myStackNum);#endif /* VIRTUAL_STACK */ netPoolShow (_pNetDpool); }/******************************************************************************** netShowInit - initialize network show routines** This routine links the network show facility into the VxWorks system.* These routines are included automatically if INCLUDE_NET_SHOW* is defined.** RETURNS: N/A*/void netShowInit (void) { if (bufferedRtShow) routeBuf = KHEAP_ALLOC (rtMem); }/********************************************************************************* arpShow - display entries in the system ARP table** This routine displays the current Internet-to-Ethernet address mappings * in the ARP table.** EXAMPLE* .CS* -> arpShow** LINK LEVEL ARP TABLE* Destination LL Address Flags Refcnt Use Interface* ---------------------------------------------------------------------* 90.0.0.63 08:00:3e:23:79:e7 0x405 0 82 lo0* ---------------------------------------------------------------------* .CE** Some configuration is required when this routine is to be used remotely over* the network eg. through a telnet session or through the host shell using * WDB_COMM_NETWORK. If more than 5 entries are expected in the table the * parameter RT_BUFFERED_DISPLAY should be set to TRUE to prevent a possible* deadlock. This requires a buffer whose size can be set with RT_DISPLAY_MEMORY.* It will limit the number of entries that can be displayed (each entry requires* approx. 70 bytes).** RETURNS: N/A*/void arpShow (void) { char *dashLine = "---------------------------------------------------------------------\n"; char *topLine = "Destination LL Address Flags Refcnt Use Interface\n";#ifdef VIRTUAL_STACK printf("stack number %d\n", myStackNum);#endif /* VIRTUAL_STACK */ printf ("\nLINK LEVEL ARP TABLE\n"); printf ("%s", topLine); printf ("%s", dashLine); routeTableShow (RT_ARP); /* show ARP routes */ printf ("%s", dashLine); }/********************************************************************************* arptabShow - display the known ARP entries** This routine displays current Internet-to-Ethernet address mappings in the* ARP table.** RETURNS: N/A** INTERNAL* This just calls arpShow. It is provided for compatablity.* Migrating to arpShow to be more compliant with WRS naming.*/void arptabShow (void) { arpShow (); }/******************************************************************************* routestatShow - display routing statistics** This routine displays routing statistics.** RETURNS: N/A** INTERNAL* When using the Tornado shell, this routine is only available if an* "@" sign is prepended to the routine name. Otherwise, it is preempted* by a built-in version.*/void routestatShow (void) {#ifdef VIRTUAL_STACK virtualStackIdCheck(); printf ("routing: (stack number %d)\n", myStackNum);#else printf ("routing:\n");#endif /* VIRTUAL_STACK */ printf ("\t%u bad routing redirect%s\n", rtstat.rts_badredirect, plural (rtstat.rts_badredirect)); printf ("\t%u dynamically created route%s\n", rtstat.rts_dynamic, plural (rtstat.rts_dynamic)); printf ("\t%u new gateway%s due to redirects\n", rtstat.rts_newgateway, plural (rtstat.rts_newgateway)); printf ("\t%u destination%s found unreachable\n", rtstat.rts_unreach, plural (rtstat.rts_unreach)); printf ("\t%u use%s of a wildcard route\n", rtstat.rts_wildcard, plural (rtstat.rts_wildcard)); }/********************************************************************************* routeShow - display all IP routes (summary information)** This routine displays the list of destinations in the routing table* along with the next-hop gateway and associated interface for each entry.* It separates the routes into network routes and host-specific entries,* but does not display the netmask for a route since it was created for* class-based routes which used predetermined values for that field.** The IP forwarding process will only use the first route entry to a * destination. When multiple routes exist to the same destination with* the same netmask (which is not shown), the first route entry uses the* lowest administrative weight. The remaining entries (listed as additional* routes) use the same destination address. One of those entries will* replace the primary route if it is deleted.** EXAMPLE* .CS* -> routeShow** ROUTE NET TABLE* Destination Gateway Flags Refcnt Use Interface* --------------------------------------------------------------------* 90.0.0.0 90.0.0.63 0x1 1 142 enp0* 10.0.0.0 90.0.0.70 0x1 1 142 enp0* Additional routes to 10.0.0.0:* 80.0.0.70 0x1 0 120 enp1* --------------------------------------------------------------------** ROUTE HOST TABLE* Destination Gateway Flags Refcnt Use Interface* --------------------------------------------------------------------* 127.0.0.1 127.0.0.1 0x101 0 82 lo0* --------------------------------------------------------------------* .CE** The flags field represents a decimal value of the flags specified* for a given route. The following is a list of currently available* flag values:** .TS* tab(|);* l l .* 0x1 | - route is usable (that is, "up")* 0x2 | - destination is a gateway* 0x4 | - host specific routing entry* 0x8 | - host or net unreachable* 0x10 | - created dynamically (by redirect)* 0x20 | - modified dynamically (by redirect)* 0x40 | - message confirmed* 0x80 | - subnet mask present* 0x100 | - generate new routes on use* 0x200 | - external daemon resolves name* 0x400 | - generated by ARP* 0x800 | - manually added (static)* 0x1000 | - just discard packets (during updates)* 0x2000 | - modified by management protocol* 0x4000 | - protocol specific routing flag* 0x8000 | - protocol specific routing flag* .TE** In the above display example, the entry in the ROUTE NET TABLE has a * flag value of 1, which indicates that this route is "up" and usable and * network specific (the 0x4 bit is turned off). The entry in the ROUTE * HOST TABLE has a flag value of 5 (0x1 OR'ed with 0x4), which indicates * that this route is "up" and usable and host-specific.** Some configuration is required when this routine is to be used remotely over* the network eg. through a telnet session or through the host shell using * WDB_COMM_NETWORK. If more than 5 routes are expected in the table the * parameter RT_BUFFERED_DISPLAY should be set to TRUE to prevent a possible* deadlock. This requires a buffer whose size can be set with RT_DISPLAY_MEMORY.* It will limit the number of routes that can be displayed (each route requires* approx. 70 bytes).** RETURNS: N/A*/void routeShow (void) { char *dashLine = "--------------------------------------------------------------------\n"; char *topLine = "Destination Gateway Flags Refcnt Use Interface\n";#ifdef VIRTUAL_STACK virtualStackIdCheck(); printf("stack number %d\n", myStackNum);#endif /* VIRTUAL_STACK */ printf ("\nROUTE NET TABLE\n"); printf ("%s", topLine); printf ("%s", dashLine); routeTableShow (RT_NET); /* show network routes */ printf ("%s", dashLine); printf ("\nROUTE HOST TABLE\n"); printf ("%s", topLine); printf ("%s", dashLine); routeTableShow (RT_HST); /* show host routes */ printf ("%s", dashLine); }/****************************************************************************** routeNodeShow - print all route entries attached to a node in the tree** This routine displays every route entry with a particular destination* and netmask. Only the initial entry attached to the tree is visible to* the IP forwarding process. The remaining entries are duplicates.** The return value of 0 continues the tree traversal to access the next* element.** RETURNS: OK on success and ERROR on failure*/LOCAL int routeNodeShow ( struct radix_node * pRoute, void* w ) { ROUTE_ENTRY * pHead; /* Start of route list for a protocol. */ ROUTE_ENTRY * pNext; BOOL printFlag; /* Available route actually displayed? */ struct sockaddr * pAddress; char addressString [INET_ADDR_LEN]; int len; pHead = (ROUTE_ENTRY *)pRoute; /* Print the route entry which is visible to IP. */ printFlag = routeEntryPrint ( (struct rtentry *)pHead, w, TRUE); if (printFlag == FALSE) { /* * The primary route entry did not match the requested type. Ignore * any duplicate routes, which also will not meet the criteria. */ return (OK); } /* Get the next entry to display, if any. */ pNext = pHead->sameNode.pFrwd; if (pNext == NULL) { pHead = pNext = pHead->diffNode.pFrwd; } if (pNext != NULL) { /* Additional entries exist. Print the appropriate subheading. */ pAddress = rt_key ( (struct rtentry *)pRoute); inet_ntoa_b ( ((struct sockaddr_in *)pAddress)->sin_addr, addressString); if (!bufferedRtShow) printf (" Additional routes to %s:\n", addressString); else { len = sprintf (routeBuf + bufIndex, " Additional routes to %s:\n", addressString); bufIndex += len; } } /* Print any duplicate routes for the visible node. */ while (pHead) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -