mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-12 00:39:53 +00:00
Added SNMP counters.
This commit is contained in:
parent
2dcbd016e6
commit
cdb7557d88
@ -47,6 +47,7 @@
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/snmp.h"
|
||||
|
||||
#include "lwip/tcp.h"
|
||||
#if LWIP_TCP
|
||||
@ -144,17 +145,26 @@ tcp_close(struct tcp_pcb *pcb)
|
||||
tcp_pcb_remove(&tcp_active_pcbs, pcb);
|
||||
memp_free(MEMP_TCP_PCB, pcb);
|
||||
pcb = NULL;
|
||||
snmp_inc_tcpattemptfails();
|
||||
break;
|
||||
case SYN_RCVD:
|
||||
err = tcp_send_ctrl(pcb, TCP_FIN);
|
||||
if (err == ERR_OK) {
|
||||
snmp_inc_tcpattemptfails();
|
||||
pcb->state = FIN_WAIT_1;
|
||||
}
|
||||
break;
|
||||
case ESTABLISHED:
|
||||
err = tcp_send_ctrl(pcb, TCP_FIN);
|
||||
if (err == ERR_OK) {
|
||||
snmp_inc_tcpestabresets();
|
||||
pcb->state = FIN_WAIT_1;
|
||||
}
|
||||
break;
|
||||
case CLOSE_WAIT:
|
||||
err = tcp_send_ctrl(pcb, TCP_FIN);
|
||||
if (err == ERR_OK) {
|
||||
snmp_inc_tcpestabresets();
|
||||
pcb->state = LAST_ACK;
|
||||
}
|
||||
break;
|
||||
@ -435,6 +445,8 @@ tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
|
||||
pcb->connected = connected;
|
||||
#endif /* LWIP_CALLBACK_API */
|
||||
TCP_REG(&tcp_active_pcbs, pcb);
|
||||
|
||||
snmp_inc_tcpactiveopens();
|
||||
|
||||
/* Build an MSS option */
|
||||
optdata = htonl(((u32_t)2 << 24) |
|
||||
|
@ -54,8 +54,9 @@
|
||||
#include "lwip/tcp.h"
|
||||
|
||||
#include "lwip/stats.h"
|
||||
|
||||
#include "arch/perf.h"
|
||||
#include "lwip/snmp.h"
|
||||
|
||||
#if LWIP_TCP
|
||||
/* These variables are global to all functions involved in the input
|
||||
processing of TCP segments. They are set by the tcp_input()
|
||||
@ -99,6 +100,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
PERF_START;
|
||||
|
||||
TCP_STATS_INC(tcp.recv);
|
||||
snmp_inc_tcpinsegs();
|
||||
|
||||
iphdr = p->payload;
|
||||
tcphdr = (struct tcp_hdr *)((u8_t *)p->payload + IPH_HL(iphdr) * 4);
|
||||
@ -120,6 +122,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
/* Don't even process incoming broadcasts/multicasts. */
|
||||
if (ip_addr_isbroadcast(&(iphdr->dest), inp) ||
|
||||
ip_addr_ismulticast(&(iphdr->dest))) {
|
||||
snmp_inc_tcpinerrs();
|
||||
pbuf_free(p);
|
||||
return;
|
||||
}
|
||||
@ -137,7 +140,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
#endif /* TCP_DEBUG */
|
||||
TCP_STATS_INC(tcp.chkerr);
|
||||
TCP_STATS_INC(tcp.drop);
|
||||
|
||||
snmp_inc_tcpinerrs();
|
||||
pbuf_free(p);
|
||||
return;
|
||||
}
|
||||
@ -390,6 +393,8 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
||||
/* Parse any options in the SYN. */
|
||||
tcp_parseopt(npcb);
|
||||
|
||||
snmp_inc_tcppassiveopens();
|
||||
|
||||
/* Build an MSS option. */
|
||||
optdata = htonl(((u32_t)2 << 24) |
|
||||
((u32_t)4 << 16) |
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "lwip/inet.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/stats.h"
|
||||
#include "lwip/snmp.h"
|
||||
|
||||
#if LWIP_TCP
|
||||
|
||||
@ -520,6 +521,9 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
|
||||
u16_t len;
|
||||
struct netif *netif;
|
||||
|
||||
/** @bug Exclude retransmitted segments from this count. */
|
||||
snmp_inc_tcpoutsegs();
|
||||
|
||||
/* The TCP header has already been constructed, but the ackno and
|
||||
wnd fields remain. */
|
||||
seg->tcphdr->ackno = htonl(pcb->rcv_nxt);
|
||||
@ -603,6 +607,7 @@ tcp_rst(u32_t seqno, u32_t ackno,
|
||||
IP_PROTO_TCP, p->tot_len);
|
||||
#endif
|
||||
TCP_STATS_INC(tcp.xmit);
|
||||
snmp_inc_tcpoutrsts();
|
||||
/* Send output with hardcoded TTL since we have no access to the pcb */
|
||||
ip_output(p, local_ip, remote_ip, TCP_TTL, 0, IP_PROTO_TCP);
|
||||
pbuf_free(p);
|
||||
@ -662,6 +667,7 @@ tcp_rexmit(struct tcp_pcb *pcb)
|
||||
pcb->rttest = 0;
|
||||
|
||||
/* Do the actual retransmission. */
|
||||
snmp_inc_tcpretranssegs();
|
||||
tcp_output(pcb);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user