mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-16 08:43:17 +00:00
Added SNMP call-outs for monitoring of default SNMP status items for TCP/IP.
This commit is contained in:
parent
dfe1ab7438
commit
c9bd32d12b
@ -42,6 +42,9 @@
|
|||||||
|
|
||||||
#include "lwip/stats.h"
|
#include "lwip/stats.h"
|
||||||
|
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
# include "snmp.h"
|
||||||
|
#endif
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
icmp_input(struct pbuf *p, struct netif *inp)
|
icmp_input(struct pbuf *p, struct netif *inp)
|
||||||
@ -55,6 +58,9 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
#ifdef ICMP_STATS
|
#ifdef ICMP_STATS
|
||||||
++stats.icmp.recv;
|
++stats.icmp.recv;
|
||||||
#endif /* ICMP_STATS */
|
#endif /* ICMP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_icmpinmsgs();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
iphdr = p->payload;
|
iphdr = p->payload;
|
||||||
@ -82,6 +88,9 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
#ifdef ICMP_STATS
|
#ifdef ICMP_STATS
|
||||||
++stats.icmp.lenerr;
|
++stats.icmp.lenerr;
|
||||||
#endif /* ICMP_STATS */
|
#endif /* ICMP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_icmpinerrors();
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -92,6 +101,9 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
#ifdef ICMP_STATS
|
#ifdef ICMP_STATS
|
||||||
++stats.icmp.chkerr;
|
++stats.icmp.chkerr;
|
||||||
#endif /* ICMP_STATS */
|
#endif /* ICMP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_icmpinerrors();
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpaddr.addr = iphdr->src.addr;
|
tmpaddr.addr = iphdr->src.addr;
|
||||||
@ -107,6 +119,12 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
#ifdef ICMP_STATS
|
#ifdef ICMP_STATS
|
||||||
++stats.icmp.xmit;
|
++stats.icmp.xmit;
|
||||||
#endif /* ICMP_STATS */
|
#endif /* ICMP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
/* increase number of messages attempted to send */
|
||||||
|
snmp_inc_icmpoutmsgs();
|
||||||
|
/* increase number of echo replies attempted to send */
|
||||||
|
snmp_inc_icmpoutechoreps();
|
||||||
|
#endif
|
||||||
|
|
||||||
pbuf_header(p, hlen);
|
pbuf_header(p, hlen);
|
||||||
ip_output_if(p, &(iphdr->src), IP_HDRINCL,
|
ip_output_if(p, &(iphdr->src), IP_HDRINCL,
|
||||||
@ -146,6 +164,12 @@ icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
|||||||
#ifdef ICMP_STATS
|
#ifdef ICMP_STATS
|
||||||
++stats.icmp.xmit;
|
++stats.icmp.xmit;
|
||||||
#endif /* ICMP_STATS */
|
#endif /* ICMP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
/* increase number of messages attempted to send */
|
||||||
|
snmp_inc_icmpoutmsgs();
|
||||||
|
/* increase number of destination unreachable messages attempted to send */
|
||||||
|
snmp_inc_icmpoutdestunreachs();
|
||||||
|
#endif
|
||||||
|
|
||||||
ip_output(q, NULL, &(iphdr->src),
|
ip_output(q, NULL, &(iphdr->src),
|
||||||
ICMP_TTL, IP_PROTO_ICMP);
|
ICMP_TTL, IP_PROTO_ICMP);
|
||||||
@ -184,6 +208,12 @@ icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
|
|||||||
#ifdef ICMP_STATS
|
#ifdef ICMP_STATS
|
||||||
++stats.icmp.xmit;
|
++stats.icmp.xmit;
|
||||||
#endif /* ICMP_STATS */
|
#endif /* ICMP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
/* increase number of messages attempted to send */
|
||||||
|
snmp_inc_icmpoutmsgs();
|
||||||
|
/* increase number of destination unreachable messages attempted to send */
|
||||||
|
snmp_inc_icmpouttimeexcds();
|
||||||
|
#endif
|
||||||
ip_output(q, NULL, &(iphdr->src),
|
ip_output(q, NULL, &(iphdr->src),
|
||||||
ICMP_TTL, IP_PROTO_ICMP);
|
ICMP_TTL, IP_PROTO_ICMP);
|
||||||
pbuf_free(q);
|
pbuf_free(q);
|
||||||
|
@ -54,6 +54,9 @@
|
|||||||
|
|
||||||
#include "arch/perf.h"
|
#include "arch/perf.h"
|
||||||
|
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
# include "snmp.h"
|
||||||
|
#endif
|
||||||
#if LWIP_DHCP
|
#if LWIP_DHCP
|
||||||
#include "lwip/dhcp.h"
|
#include "lwip/dhcp.h"
|
||||||
#endif /* LWIP_DHCP */
|
#endif /* LWIP_DHCP */
|
||||||
@ -163,6 +166,9 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
|||||||
DEBUGF(IP_DEBUG, ("ip_forward: no forwarding route for 0x%lx found\n",
|
DEBUGF(IP_DEBUG, ("ip_forward: no forwarding route for 0x%lx found\n",
|
||||||
iphdr->dest.addr));
|
iphdr->dest.addr));
|
||||||
|
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipnoroutes();
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,6 +177,9 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
|||||||
if(netif == inp) {
|
if(netif == inp) {
|
||||||
DEBUGF(IP_DEBUG, ("ip_forward: not forward packets back on incoming interface.\n"));
|
DEBUGF(IP_DEBUG, ("ip_forward: not forward packets back on incoming interface.\n"));
|
||||||
|
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipnoroutes();
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,6 +189,9 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
|||||||
/* Don't send ICMP messages in response to ICMP messages */
|
/* Don't send ICMP messages in response to ICMP messages */
|
||||||
if(IPH_PROTO(iphdr) != IP_PROTO_ICMP) {
|
if(IPH_PROTO(iphdr) != IP_PROTO_ICMP) {
|
||||||
icmp_time_exceeded(p, ICMP_TE_TTL);
|
icmp_time_exceeded(p, ICMP_TE_TTL);
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_icmpouttimeexcds();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -198,6 +210,9 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
|||||||
++stats.ip.fw;
|
++stats.ip.fw;
|
||||||
++stats.ip.xmit;
|
++stats.ip.xmit;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipforwdatagrams();
|
||||||
|
#endif
|
||||||
|
|
||||||
PERF_STOP("ip_forward");
|
PERF_STOP("ip_forward");
|
||||||
|
|
||||||
@ -389,6 +404,9 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
#ifdef IP_STATS
|
#ifdef IP_STATS
|
||||||
++stats.ip.recv;
|
++stats.ip.recv;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipinreceives();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* identify the IP header */
|
/* identify the IP header */
|
||||||
iphdr = p->payload;
|
iphdr = p->payload;
|
||||||
@ -402,6 +420,9 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
++stats.ip.err;
|
++stats.ip.err;
|
||||||
++stats.ip.drop;
|
++stats.ip.drop;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipunknownprotos();
|
||||||
|
#endif
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,6 +436,9 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
++stats.ip.lenerr;
|
++stats.ip.lenerr;
|
||||||
++stats.ip.drop;
|
++stats.ip.drop;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipindiscards();
|
||||||
|
#endif
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,6 +454,9 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
++stats.ip.chkerr;
|
++stats.ip.chkerr;
|
||||||
++stats.ip.drop;
|
++stats.ip.drop;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipindiscards();
|
||||||
|
#endif
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,7 +502,13 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
if(!ip_addr_isbroadcast(&(iphdr->dest), &(inp->netmask))) {
|
if(!ip_addr_isbroadcast(&(iphdr->dest), &(inp->netmask))) {
|
||||||
ip_forward(p, iphdr, inp);
|
ip_forward(p, iphdr, inp);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
#endif /* IP_FORWARD */
|
#endif /* IP_FORWARD */
|
||||||
|
{
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipindiscards();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
@ -497,6 +530,9 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
++stats.ip.opterr;
|
++stats.ip.opterr;
|
||||||
++stats.ip.drop;
|
++stats.ip.drop;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipunknownprotos();
|
||||||
|
#endif
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
#endif /* IP_REASSEMBLY */
|
#endif /* IP_REASSEMBLY */
|
||||||
@ -510,6 +546,9 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
++stats.ip.opterr;
|
++stats.ip.opterr;
|
||||||
++stats.ip.drop;
|
++stats.ip.drop;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipunknownprotos();
|
||||||
|
#endif
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
#endif /* IP_OPTIONS == 0 */
|
#endif /* IP_OPTIONS == 0 */
|
||||||
@ -525,15 +564,24 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
switch(IPH_PROTO(iphdr)) {
|
switch(IPH_PROTO(iphdr)) {
|
||||||
#if LWIP_UDP > 0
|
#if LWIP_UDP > 0
|
||||||
case IP_PROTO_UDP:
|
case IP_PROTO_UDP:
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipindelivers();
|
||||||
|
#endif
|
||||||
udp_input(p, inp);
|
udp_input(p, inp);
|
||||||
break;
|
break;
|
||||||
#endif /* LWIP_UDP */
|
#endif /* LWIP_UDP */
|
||||||
#if LWIP_TCP > 0
|
#if LWIP_TCP > 0
|
||||||
case IP_PROTO_TCP:
|
case IP_PROTO_TCP:
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipindelivers();
|
||||||
|
#endif
|
||||||
tcp_input(p, inp);
|
tcp_input(p, inp);
|
||||||
break;
|
break;
|
||||||
#endif /* LWIP_TCP */
|
#endif /* LWIP_TCP */
|
||||||
case IP_PROTO_ICMP:
|
case IP_PROTO_ICMP:
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipindelivers();
|
||||||
|
#endif
|
||||||
icmp_input(p, inp);
|
icmp_input(p, inp);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -551,6 +599,9 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
++stats.ip.proterr;
|
++stats.ip.proterr;
|
||||||
++stats.ip.drop;
|
++stats.ip.drop;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipunknownprotos();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
@ -574,6 +625,9 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
|||||||
static u16_t ip_id = 0;
|
static u16_t ip_id = 0;
|
||||||
|
|
||||||
|
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipoutrequests();
|
||||||
|
#endif
|
||||||
|
|
||||||
if(dest != IP_HDRINCL) {
|
if(dest != IP_HDRINCL) {
|
||||||
if(pbuf_header(p, IP_HLEN)) {
|
if(pbuf_header(p, IP_HLEN)) {
|
||||||
@ -582,6 +636,9 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
|||||||
#ifdef IP_STATS
|
#ifdef IP_STATS
|
||||||
++stats.ip.err;
|
++stats.ip.err;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipoutdiscards();
|
||||||
|
#endif
|
||||||
return ERR_BUF;
|
return ERR_BUF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,6 +676,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
|||||||
ip_debug_print(p);
|
ip_debug_print(p);
|
||||||
#endif /* IP_DEBUG */
|
#endif /* IP_DEBUG */
|
||||||
|
|
||||||
|
DEBUGF(IP_DEBUG, ("netif->output()"));
|
||||||
|
|
||||||
return netif->output(netif, p, dest);
|
return netif->output(netif, p, dest);
|
||||||
}
|
}
|
||||||
@ -642,6 +700,9 @@ ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
|||||||
#ifdef IP_STATS
|
#ifdef IP_STATS
|
||||||
++stats.ip.rterr;
|
++stats.ip.rterr;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_ipoutdiscards();
|
||||||
|
#endif
|
||||||
return ERR_RTE;
|
return ERR_RTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
|
* $Id: udp.c,v 1.3 2002/11/21 10:32:19 likewise Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
@ -49,6 +50,9 @@
|
|||||||
#include "lwip/stats.h"
|
#include "lwip/stats.h"
|
||||||
|
|
||||||
#include "arch/perf.h"
|
#include "arch/perf.h"
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
# include "snmp.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -219,6 +223,9 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
++stats.udp.chkerr;
|
++stats.udp.chkerr;
|
||||||
++stats.udp.drop;
|
++stats.udp.drop;
|
||||||
#endif /* UDP_STATS */
|
#endif /* UDP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_udpinerrors();
|
||||||
|
#endif
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -233,6 +240,9 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
++stats.udp.chkerr;
|
++stats.udp.chkerr;
|
||||||
++stats.udp.drop;
|
++stats.udp.drop;
|
||||||
#endif /* UDP_STATS */
|
#endif /* UDP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_udpinerrors();
|
||||||
|
#endif
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -240,6 +250,9 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
}
|
}
|
||||||
pbuf_header(p, -UDP_HLEN);
|
pbuf_header(p, -UDP_HLEN);
|
||||||
if(pcb != NULL) {
|
if(pcb != NULL) {
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_udpindatagrams();
|
||||||
|
#endif
|
||||||
pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src), src);
|
pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src), src);
|
||||||
} else {
|
} else {
|
||||||
DEBUGF(UDP_DEBUG, ("udp_input: not for us.\n"));
|
DEBUGF(UDP_DEBUG, ("udp_input: not for us.\n"));
|
||||||
@ -262,6 +275,9 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
++stats.udp.proterr;
|
++stats.udp.proterr;
|
||||||
++stats.udp.drop;
|
++stats.udp.drop;
|
||||||
#endif /* UDP_STATS */
|
#endif /* UDP_STATS */
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_udpnoports();
|
||||||
|
#endif
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -281,6 +297,8 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
err_t err;
|
err_t err;
|
||||||
struct pbuf *hdr;
|
struct pbuf *hdr;
|
||||||
|
|
||||||
|
|
||||||
|
DEBUGF(UDP_DEBUG, ("udp_send"));
|
||||||
/* hdr will point to the UDP header pbuf if an extra header pbuf has
|
/* hdr will point to the UDP header pbuf if an extra header pbuf has
|
||||||
to be allocated. */
|
to be allocated. */
|
||||||
hdr = NULL;
|
hdr = NULL;
|
||||||
@ -293,6 +311,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
pbuf_chain(hdr, p);
|
pbuf_chain(hdr, p);
|
||||||
p = hdr;
|
p = hdr;
|
||||||
}
|
}
|
||||||
|
DEBUGF(UDP_DEBUG, ("udp_send: got pbuf"));
|
||||||
|
|
||||||
udphdr = p->payload;
|
udphdr = p->payload;
|
||||||
udphdr->src = htons(pcb->local_port);
|
udphdr->src = htons(pcb->local_port);
|
||||||
@ -316,6 +335,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
DEBUGF(UDP_DEBUG, ("udp_send: sending datagram of length %d\n", p->tot_len));
|
DEBUGF(UDP_DEBUG, ("udp_send: sending datagram of length %d\n", p->tot_len));
|
||||||
|
|
||||||
if(pcb->flags & UDP_FLAGS_UDPLITE) {
|
if(pcb->flags & UDP_FLAGS_UDPLITE) {
|
||||||
|
DEBUGF(UDP_DEBUG, ("udp_send: UDP LITE packet length %u", p->tot_len));
|
||||||
udphdr->len = htons(pcb->chksum_len);
|
udphdr->len = htons(pcb->chksum_len);
|
||||||
/* calculate checksum */
|
/* calculate checksum */
|
||||||
udphdr->chksum = inet_chksum_pseudo(p, src_ip, &(pcb->remote_ip),
|
udphdr->chksum = inet_chksum_pseudo(p, src_ip, &(pcb->remote_ip),
|
||||||
@ -324,7 +344,11 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
udphdr->chksum = 0xffff;
|
udphdr->chksum = 0xffff;
|
||||||
}
|
}
|
||||||
err = ip_output_if(p, src_ip, &pcb->remote_ip, UDP_TTL, IP_PROTO_UDPLITE, netif);
|
err = ip_output_if(p, src_ip, &pcb->remote_ip, UDP_TTL, IP_PROTO_UDPLITE, netif);
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_udpoutdatagrams();
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
DEBUGF(UDP_DEBUG, ("udp_send: UDP packet length %u", p->tot_len));
|
||||||
udphdr->len = htons(p->tot_len);
|
udphdr->len = htons(p->tot_len);
|
||||||
/* calculate checksum */
|
/* calculate checksum */
|
||||||
if((pcb->flags & UDP_FLAGS_NOCHKSUM) == 0) {
|
if((pcb->flags & UDP_FLAGS_NOCHKSUM) == 0) {
|
||||||
@ -334,6 +358,11 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
udphdr->chksum = 0xffff;
|
udphdr->chksum = 0xffff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DEBUGF(UDP_DEBUG, ("udp_send: UDP checksum %x", udphdr->chksum));
|
||||||
|
#if LWIP_SNMP > 0
|
||||||
|
snmp_inc_udpoutdatagrams();
|
||||||
|
#endif
|
||||||
|
DEBUGF(UDP_DEBUG, ("udp_send: ip_output_if(,,,,IP_PROTO_UDP,)"));
|
||||||
err = ip_output_if(p, src_ip, &pcb->remote_ip, UDP_TTL, IP_PROTO_UDP, netif);
|
err = ip_output_if(p, src_ip, &pcb->remote_ip, UDP_TTL, IP_PROTO_UDP, netif);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user