mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-15 23:42:33 +00:00
SNMP functions are now unconditionally called and defined empty if LWIP_SNMP == 0
This removes a lot of #if #endif cluttering the source code.
This commit is contained in:
parent
32fbec2e48
commit
c68ee2b2ed
@ -42,9 +42,7 @@
|
|||||||
|
|
||||||
#include "lwip/stats.h"
|
#include "lwip/stats.h"
|
||||||
|
|
||||||
#if LWIP_SNMP > 0
|
#include "snmp.h"
|
||||||
# include "snmp.h"
|
|
||||||
#endif
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
icmp_input(struct pbuf *p, struct netif *inp)
|
icmp_input(struct pbuf *p, struct netif *inp)
|
||||||
@ -58,9 +56,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
#ifdef ICMP_STATS
|
#ifdef ICMP_STATS
|
||||||
++lwip_stats.icmp.recv;
|
++lwip_stats.icmp.recv;
|
||||||
#endif /* ICMP_STATS */
|
#endif /* ICMP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_icmpinmsgs();
|
snmp_inc_icmpinmsgs();
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
iphdr = p->payload;
|
iphdr = p->payload;
|
||||||
@ -88,9 +84,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
#ifdef ICMP_STATS
|
#ifdef ICMP_STATS
|
||||||
++lwip_stats.icmp.lenerr;
|
++lwip_stats.icmp.lenerr;
|
||||||
#endif /* ICMP_STATS */
|
#endif /* ICMP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_icmpinerrors();
|
snmp_inc_icmpinerrors();
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -101,9 +95,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
#ifdef ICMP_STATS
|
#ifdef ICMP_STATS
|
||||||
++lwip_stats.icmp.chkerr;
|
++lwip_stats.icmp.chkerr;
|
||||||
#endif /* ICMP_STATS */
|
#endif /* ICMP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_icmpinerrors();
|
snmp_inc_icmpinerrors();
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpaddr.addr = iphdr->src.addr;
|
tmpaddr.addr = iphdr->src.addr;
|
||||||
@ -119,12 +111,10 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
#ifdef ICMP_STATS
|
#ifdef ICMP_STATS
|
||||||
++lwip_stats.icmp.xmit;
|
++lwip_stats.icmp.xmit;
|
||||||
#endif /* ICMP_STATS */
|
#endif /* ICMP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
/* increase number of messages attempted to send */
|
/* increase number of messages attempted to send */
|
||||||
snmp_inc_icmpoutmsgs();
|
snmp_inc_icmpoutmsgs();
|
||||||
/* increase number of echo replies attempted to send */
|
/* increase number of echo replies attempted to send */
|
||||||
snmp_inc_icmpoutechoreps();
|
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,
|
||||||
@ -164,12 +154,10 @@ icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
|
|||||||
#ifdef ICMP_STATS
|
#ifdef ICMP_STATS
|
||||||
++lwip_stats.icmp.xmit;
|
++lwip_stats.icmp.xmit;
|
||||||
#endif /* ICMP_STATS */
|
#endif /* ICMP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
/* increase number of messages attempted to send */
|
/* increase number of messages attempted to send */
|
||||||
snmp_inc_icmpoutmsgs();
|
snmp_inc_icmpoutmsgs();
|
||||||
/* increase number of destination unreachable messages attempted to send */
|
/* increase number of destination unreachable messages attempted to send */
|
||||||
snmp_inc_icmpoutdestunreachs();
|
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);
|
||||||
@ -208,12 +196,10 @@ icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
|
|||||||
#ifdef ICMP_STATS
|
#ifdef ICMP_STATS
|
||||||
++lwip_stats.icmp.xmit;
|
++lwip_stats.icmp.xmit;
|
||||||
#endif /* ICMP_STATS */
|
#endif /* ICMP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
/* increase number of messages attempted to send */
|
/* increase number of messages attempted to send */
|
||||||
snmp_inc_icmpoutmsgs();
|
snmp_inc_icmpoutmsgs();
|
||||||
/* increase number of destination unreachable messages attempted to send */
|
/* increase number of destination unreachable messages attempted to send */
|
||||||
snmp_inc_icmpouttimeexcds();
|
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);
|
||||||
|
@ -55,9 +55,7 @@
|
|||||||
|
|
||||||
#include "arch/perf.h"
|
#include "arch/perf.h"
|
||||||
|
|
||||||
#if LWIP_SNMP > 0
|
#include "snmp.h"
|
||||||
# include "snmp.h"
|
|
||||||
#endif
|
|
||||||
#if LWIP_DHCP
|
#if LWIP_DHCP
|
||||||
#include "lwip/dhcp.h"
|
#include "lwip/dhcp.h"
|
||||||
#endif /* LWIP_DHCP */
|
#endif /* LWIP_DHCP */
|
||||||
@ -169,18 +167,14 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
|||||||
if(netif == NULL) {
|
if(netif == NULL) {
|
||||||
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();
|
snmp_inc_ipnoroutes();
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Do not forward packets onto the same network interface on which
|
/* Do not forward packets onto the same network interface on which
|
||||||
they arrived. */
|
they arrived. */
|
||||||
if(netif == inp) {
|
if(netif == inp) {
|
||||||
DEBUGF(IP_DEBUG, ("ip_forward: not bouncing packets back on incoming interface.\n"));
|
DEBUGF(IP_DEBUG, ("ip_forward: not bouncing packets back on incoming interface.\n"));
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_ipnoroutes();
|
snmp_inc_ipnoroutes();
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,9 +185,7 @@ 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();
|
snmp_inc_icmpouttimeexcds();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -212,9 +204,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
|||||||
++lwip_stats.ip.fw;
|
++lwip_stats.ip.fw;
|
||||||
++lwip_stats.ip.xmit;
|
++lwip_stats.ip.xmit;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_ipforwdatagrams();
|
snmp_inc_ipforwdatagrams();
|
||||||
#endif
|
|
||||||
|
|
||||||
PERF_STOP("ip_forward");
|
PERF_STOP("ip_forward");
|
||||||
/* transmit pbuf on chosen interface */
|
/* transmit pbuf on chosen interface */
|
||||||
@ -242,9 +232,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
#ifdef IP_STATS
|
#ifdef IP_STATS
|
||||||
++lwip_stats.ip.recv;
|
++lwip_stats.ip.recv;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
snmp_inc_ipinreceives();
|
||||||
snmp_inc_ipinreceives();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* identify the IP header */
|
/* identify the IP header */
|
||||||
iphdr = p->payload;
|
iphdr = p->payload;
|
||||||
@ -258,9 +246,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
++lwip_stats.ip.err;
|
++lwip_stats.ip.err;
|
||||||
++lwip_stats.ip.drop;
|
++lwip_stats.ip.drop;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_ipunknownprotos();
|
snmp_inc_ipunknownprotos();
|
||||||
#endif
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
/* obtain IP header length in number of 32-bit words */
|
/* obtain IP header length in number of 32-bit words */
|
||||||
@ -278,9 +264,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
++lwip_stats.ip.lenerr;
|
++lwip_stats.ip.lenerr;
|
||||||
++lwip_stats.ip.drop;
|
++lwip_stats.ip.drop;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_ipindiscards();
|
snmp_inc_ipindiscards();
|
||||||
#endif
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,9 +280,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
++lwip_stats.ip.chkerr;
|
++lwip_stats.ip.chkerr;
|
||||||
++lwip_stats.ip.drop;
|
++lwip_stats.ip.drop;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_ipindiscards();
|
snmp_inc_ipindiscards();
|
||||||
#endif
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,9 +343,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
else
|
else
|
||||||
#endif /* IP_FORWARD */
|
#endif /* IP_FORWARD */
|
||||||
{
|
{
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_ipindiscards();
|
snmp_inc_ipindiscards();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
@ -387,9 +367,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
++lwip_stats.ip.opterr;
|
++lwip_stats.ip.opterr;
|
||||||
++lwip_stats.ip.drop;
|
++lwip_stats.ip.drop;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_ipunknownprotos();
|
snmp_inc_ipunknownprotos();
|
||||||
#endif
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
#endif /* IP_REASSEMBLY */
|
#endif /* IP_REASSEMBLY */
|
||||||
@ -402,9 +380,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
++lwip_stats.ip.opterr;
|
++lwip_stats.ip.opterr;
|
||||||
++lwip_stats.ip.drop;
|
++lwip_stats.ip.drop;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_ipunknownprotos();
|
snmp_inc_ipunknownprotos();
|
||||||
#endif
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
#endif /* IP_OPTIONS == 0 */
|
#endif /* IP_OPTIONS == 0 */
|
||||||
@ -419,24 +395,18 @@ 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();
|
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();
|
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();
|
snmp_inc_ipindelivers();
|
||||||
#endif
|
|
||||||
icmp_input(p, inp);
|
icmp_input(p, inp);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -454,9 +424,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
|||||||
++lwip_stats.ip.proterr;
|
++lwip_stats.ip.proterr;
|
||||||
++lwip_stats.ip.drop;
|
++lwip_stats.ip.drop;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_ipunknownprotos();
|
snmp_inc_ipunknownprotos();
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
@ -479,10 +447,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
|||||||
static struct ip_hdr *iphdr;
|
static struct ip_hdr *iphdr;
|
||||||
static u16_t ip_id = 0;
|
static u16_t ip_id = 0;
|
||||||
|
|
||||||
|
snmp_inc_ipoutrequests();
|
||||||
#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)) {
|
||||||
@ -491,9 +456,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
|||||||
#ifdef IP_STATS
|
#ifdef IP_STATS
|
||||||
++lwip_stats.ip.err;
|
++lwip_stats.ip.err;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
snmp_inc_ipoutdiscards();
|
||||||
snmp_inc_ipoutdiscards();
|
|
||||||
#endif
|
|
||||||
return ERR_BUF;
|
return ERR_BUF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,9 +523,7 @@ ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
|||||||
#ifdef IP_STATS
|
#ifdef IP_STATS
|
||||||
++lwip_stats.ip.rterr;
|
++lwip_stats.ip.rterr;
|
||||||
#endif /* IP_STATS */
|
#endif /* IP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_ipoutdiscards();
|
snmp_inc_ipoutdiscards();
|
||||||
#endif
|
|
||||||
return ERR_RTE;
|
return ERR_RTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,17 @@
|
|||||||
struct netif *netif_list = NULL;
|
struct netif *netif_list = NULL;
|
||||||
struct netif *netif_default = NULL;
|
struct netif *netif_default = NULL;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/**
|
||||||
|
* Add a network interface to the list of lwIP netifs.
|
||||||
|
*
|
||||||
|
* @param ipaddr IP address for the new netif
|
||||||
|
* @param netmask network mask for the new netif
|
||||||
|
* @param gw default gateway IP address for the new netif
|
||||||
|
* @init callback function that initializes the interface
|
||||||
|
* @input callback function that...
|
||||||
|
*
|
||||||
|
* @return netif, or NULL if failed.
|
||||||
|
*/
|
||||||
struct netif *
|
struct netif *
|
||||||
netif_add(struct ip_addr *ipaddr, struct ip_addr *netmask,
|
netif_add(struct ip_addr *ipaddr, struct ip_addr *netmask,
|
||||||
struct ip_addr *gw,
|
struct ip_addr *gw,
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: udp.c,v 1.17 2003/02/06 22:18:56 davidhaas Exp $
|
* $Id: udp.c,v 1.18 2003/02/10 13:47:47 likewise Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
@ -50,9 +50,7 @@
|
|||||||
#include "lwip/stats.h"
|
#include "lwip/stats.h"
|
||||||
|
|
||||||
#include "arch/perf.h"
|
#include "arch/perf.h"
|
||||||
#if LWIP_SNMP > 0
|
#include "snmp.h"
|
||||||
# include "snmp.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -259,9 +257,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
++lwip_stats.udp.chkerr;
|
++lwip_stats.udp.chkerr;
|
||||||
++lwip_stats.udp.drop;
|
++lwip_stats.udp.drop;
|
||||||
#endif /* UDP_STATS */
|
#endif /* UDP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
snmp_inc_udpinerrors();
|
||||||
snmp_inc_udpinerrors();
|
|
||||||
#endif
|
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -276,9 +272,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
++lwip_stats.udp.chkerr;
|
++lwip_stats.udp.chkerr;
|
||||||
++lwip_stats.udp.drop;
|
++lwip_stats.udp.drop;
|
||||||
#endif /* UDP_STATS */
|
#endif /* UDP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_udpinerrors();
|
snmp_inc_udpinerrors();
|
||||||
#endif
|
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -286,10 +280,8 @@ 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();
|
snmp_inc_udpindatagrams();
|
||||||
#endif
|
pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src), src);
|
||||||
pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src), udphdr->src);
|
|
||||||
} else {
|
} else {
|
||||||
DEBUGF(UDP_DEBUG, ("udp_input: not for us.\n"));
|
DEBUGF(UDP_DEBUG, ("udp_input: not for us.\n"));
|
||||||
|
|
||||||
@ -307,9 +299,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
++lwip_stats.udp.proterr;
|
++lwip_stats.udp.proterr;
|
||||||
++lwip_stats.udp.drop;
|
++lwip_stats.udp.drop;
|
||||||
#endif /* UDP_STATS */
|
#endif /* UDP_STATS */
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_udpnoports();
|
snmp_inc_udpnoports();
|
||||||
#endif
|
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -404,9 +394,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
if(udphdr->chksum == 0x0000) udphdr->chksum = 0xffff;
|
if(udphdr->chksum == 0x0000) udphdr->chksum = 0xffff;
|
||||||
/* output to IP */
|
/* output to IP */
|
||||||
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();
|
snmp_inc_udpoutdatagrams();
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
DEBUGF(UDP_DEBUG, ("udp_send: UDP packet length %u\n", p->tot_len));
|
DEBUGF(UDP_DEBUG, ("udp_send: UDP packet length %u\n", p->tot_len));
|
||||||
udphdr->len = htons(p->tot_len);
|
udphdr->len = htons(p->tot_len);
|
||||||
@ -417,9 +405,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
if(udphdr->chksum == 0x0000) udphdr->chksum = 0xffff;
|
if(udphdr->chksum == 0x0000) udphdr->chksum = 0xffff;
|
||||||
}
|
}
|
||||||
DEBUGF(UDP_DEBUG, ("udp_send: UDP checksum %x\n", udphdr->chksum));
|
DEBUGF(UDP_DEBUG, ("udp_send: UDP checksum %x\n", udphdr->chksum));
|
||||||
#if LWIP_SNMP > 0
|
|
||||||
snmp_inc_udpoutdatagrams();
|
snmp_inc_udpoutdatagrams();
|
||||||
#endif
|
|
||||||
DEBUGF(UDP_DEBUG, ("udp_send: ip_output_if(,,,,IP_PROTO_UDP,)\n"));
|
DEBUGF(UDP_DEBUG, ("udp_send: ip_output_if(,,,,IP_PROTO_UDP,)\n"));
|
||||||
/* output to IP */
|
/* output to IP */
|
||||||
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);
|
||||||
@ -519,15 +505,15 @@ udp_connect(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
|||||||
struct udp_pcb *ipcb;
|
struct udp_pcb *ipcb;
|
||||||
|
|
||||||
if(pcb->local_port == 0) {
|
if(pcb->local_port == 0) {
|
||||||
err_t err = udp_bind(pcb, &pcb->local_ip, pcb->local_port);
|
err_t err = udp_bind(pcb, &pcb->local_ip, pcb->local_port);
|
||||||
if(err != ERR_OK)
|
if(err != ERR_OK)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
ip_addr_set(&pcb->remote_ip, ipaddr);
|
ip_addr_set(&pcb->remote_ip, ipaddr);
|
||||||
pcb->remote_port = port;
|
pcb->remote_port = port;
|
||||||
|
#if 1
|
||||||
pcb->flags |= UDP_FLAGS_CONNECTED;
|
pcb->flags |= UDP_FLAGS_CONNECTED;
|
||||||
|
|
||||||
/* Nail down local IP for netconn_addr()/getsockname() */
|
/* Nail down local IP for netconn_addr()/getsockname() */
|
||||||
if(ip_addr_isany(&pcb->local_ip) && !ip_addr_isany(&pcb->remote_ip)) {
|
if(ip_addr_isany(&pcb->local_ip) && !ip_addr_isany(&pcb->remote_ip)) {
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
@ -535,7 +521,7 @@ udp_connect(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
|||||||
if((netif = ip_route(&(pcb->remote_ip))) == NULL) {
|
if((netif = ip_route(&(pcb->remote_ip))) == NULL) {
|
||||||
DEBUGF(UDP_DEBUG, ("udp_connect: No route to 0x%lx\n", pcb->remote_ip.addr));
|
DEBUGF(UDP_DEBUG, ("udp_connect: No route to 0x%lx\n", pcb->remote_ip.addr));
|
||||||
#ifdef UDP_STATS
|
#ifdef UDP_STATS
|
||||||
++lwip_stats.udp.rterr;
|
++lwip_stats.udp.rterr;
|
||||||
#endif /* UDP_STATS */
|
#endif /* UDP_STATS */
|
||||||
return ERR_RTE;
|
return ERR_RTE;
|
||||||
}
|
}
|
||||||
@ -544,7 +530,7 @@ udp_connect(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
|||||||
} else if(ip_addr_isany(&pcb->remote_ip)) {
|
} else if(ip_addr_isany(&pcb->remote_ip)) {
|
||||||
pcb->local_ip.addr = 0;
|
pcb->local_ip.addr = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/* Insert UDP PCB into the list of active UDP PCBs. */
|
/* Insert UDP PCB into the list of active UDP PCBs. */
|
||||||
for(ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) {
|
for(ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) {
|
||||||
if(pcb == ipcb) {
|
if(pcb == ipcb) {
|
||||||
|
@ -114,8 +114,6 @@ PACK_STRUCT_END
|
|||||||
#define IPH_PROTO_SET(hdr, proto) (hdr)->_ttl_proto = (HTONS((proto) | (IPH_TTL(hdr) << 8)))
|
#define IPH_PROTO_SET(hdr, proto) (hdr)->_ttl_proto = (HTONS((proto) | (IPH_TTL(hdr) << 8)))
|
||||||
#define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum)
|
#define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if IP_DEBUG
|
#if IP_DEBUG
|
||||||
void ip_debug_print(struct pbuf *p);
|
void ip_debug_print(struct pbuf *p);
|
||||||
#endif /* IP_DEBUG */
|
#endif /* IP_DEBUG */
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#error this is the original lwIP debug.h file. do not include
|
||||||
|
|
||||||
#ifndef __LWIP_DEBUG_H__
|
#ifndef __LWIP_DEBUG_H__
|
||||||
#define __LWIP_DEBUG_H__
|
#define __LWIP_DEBUG_H__
|
||||||
|
|
||||||
|
@ -106,6 +106,24 @@ void snmp_inc_udpoutdatagrams(void);
|
|||||||
/* define everything to be empty */
|
/* define everything to be empty */
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
/* network interface */
|
||||||
|
#define snmp_add_ifinoctets()
|
||||||
|
#define snmp_inc_ifinucastpkts()
|
||||||
|
#define snmp_inc_ifinnucastpkts()
|
||||||
|
#define snmp_inc_ifindiscards()
|
||||||
|
#define snmp_add_ifoutoctets()
|
||||||
|
#define snmp_inc_ifoutucastpkts()
|
||||||
|
#define snmp_inc_ifoutnucastpkts()
|
||||||
|
#define snmp_inc_ifoutdiscards()
|
||||||
|
|
||||||
|
/* IP */
|
||||||
|
#define snmp_inc_ipinreceives()
|
||||||
|
#define snmp_inc_ipindelivers()
|
||||||
|
#define snmp_inc_ipindiscards()
|
||||||
|
#define snmp_inc_ipoutdiscards()
|
||||||
|
#define snmp_inc_ipoutrequests()
|
||||||
|
#define snmp_inc_ipunknownprotos()
|
||||||
|
|
||||||
// ICMP
|
// ICMP
|
||||||
#define snmp_inc_icmpinmsgs()
|
#define snmp_inc_icmpinmsgs()
|
||||||
#define snmp_inc_icmpinerrors()
|
#define snmp_inc_icmpinerrors()
|
||||||
@ -133,7 +151,6 @@ void snmp_inc_udpoutdatagrams(void);
|
|||||||
#define snmp_inc_icmpouttimestampreps()
|
#define snmp_inc_icmpouttimestampreps()
|
||||||
#define snmp_inc_icmpoutaddrmasks()
|
#define snmp_inc_icmpoutaddrmasks()
|
||||||
#define snmp_inc_icmpoutaddrmaskreps()
|
#define snmp_inc_icmpoutaddrmaskreps()
|
||||||
|
|
||||||
// TCP
|
// TCP
|
||||||
#define snmp_inc_tcpactiveopens()
|
#define snmp_inc_tcpactiveopens()
|
||||||
#define snmp_inc_tcppassiveopens()
|
#define snmp_inc_tcppassiveopens()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user