This commit is contained in:
pvvx 2017-09-06 20:20:53 +03:00
parent c98cbe6e00
commit 9ffd9dac1a
27 changed files with 113 additions and 119 deletions

View file

@ -105,7 +105,7 @@ struct lwip_select_cb {
struct lwip_setgetsockopt_data {
/** socket struct for which to change options */
struct lwip_sock *sock;
#ifdef LWIP_DEBUG
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
/** socket index for which to change options */
int s;
#endif /* LWIP_DEBUG */
@ -1641,7 +1641,7 @@ lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
/* Now do the actual option processing */
data.sock = sock;
#ifdef LWIP_DEBUG
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
data.s = s;
#endif /* LWIP_DEBUG */
data.level = level;
@ -1662,9 +1662,6 @@ static void
lwip_getsockopt_internal(void *arg)
{
struct lwip_sock *sock;
#ifdef LWIP_DEBUG
int s;
#endif /* LWIP_DEBUG */
int level, optname;
void *optval;
struct lwip_setgetsockopt_data *data;
@ -1673,8 +1670,8 @@ lwip_getsockopt_internal(void *arg)
data = (struct lwip_setgetsockopt_data*)arg;
sock = data->sock;
#ifdef LWIP_DEBUG
s = data->s;
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
int s = data->s;
#endif /* LWIP_DEBUG */
level = data->level;
optname = data->optname;
@ -1699,8 +1696,10 @@ lwip_getsockopt_internal(void *arg)
#endif /* SO_REUSE */
/*case SO_USELOOPBACK: UNIMPL */
*(int*)optval = ip_get_option(sock->conn->pcb.ip, optname);
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, SOL_SOCKET, optname=0x%x, ..) = %s\n",
s, optname, (*(int*)optval?"on":"off")));
#endif /* LWIP_DEBUG */
break;
case SO_TYPE:
@ -2059,7 +2058,7 @@ lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t opt
/* Now do the actual option processing */
data.sock = sock;
#ifdef LWIP_DEBUG
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
data.s = s;
#endif /* LWIP_DEBUG */
data.level = level;
@ -2080,7 +2079,7 @@ static void
lwip_setsockopt_internal(void *arg)
{
struct lwip_sock *sock;
#ifdef LWIP_DEBUG
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
int s;
#endif /* LWIP_DEBUG */
int level, optname;
@ -2091,7 +2090,7 @@ lwip_setsockopt_internal(void *arg)
data = (struct lwip_setgetsockopt_data*)arg;
sock = data->sock;
#ifdef LWIP_DEBUG
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
s = data->s;
#endif /* LWIP_DEBUG */
level = data->level;

View file

@ -1008,7 +1008,7 @@ dhcp_bind(struct netif *netif)
ip_addr_copy(gw_addr, dhcp->offered_gw_addr);
/* gateway address not given? */
if (ip_addr_isany(&gw_addr)) {
if (gw_addr.addr == IPADDR_ANY) {
/* copy network address */
ip_addr_get_network(&gw_addr, &dhcp->offered_ip_addr, &sn_mask);
/* use first host address on network as gateway */

View file

@ -77,9 +77,6 @@ void
icmp_input(struct pbuf *p, struct netif *inp)
{
u8_t type;
#ifdef LWIP_DEBUG
u8_t code;
#endif /* LWIP_DEBUG */
struct icmp_echo_hdr *iecho;
struct ip_hdr *iphdr;
s16_t hlen;
@ -96,8 +93,8 @@ icmp_input(struct pbuf *p, struct netif *inp)
}
type = *((u8_t *)p->payload);
#ifdef LWIP_DEBUG
code = *(((u8_t *)p->payload)+1);
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
u8_t code = *(((u8_t *)p->payload)+1);
#endif /* LWIP_DEBUG */
switch (type) {
case ICMP_ER:

View file

@ -500,7 +500,7 @@ ip_input(struct pbuf *p, struct netif *inp)
/* broadcast or multicast packet source address? Compliant with RFC 1122: 3.2.1.3 */
#if IP_ACCEPT_LINK_LAYER_ADDRESSING
/* DHCP servers need 0.0.0.0 to be allowed as source address (RFC 1.1.2.2: 3.2.1.3/a) */
if (check_ip_src && !ip_addr_isany(&current_iphdr_src))
if (check_ip_src && current_iphdr_src.addr != IPADDR_ANY) // !ip_addr_isany(&current_iphdr_src))
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */
{ if ((ip_addr_isbroadcast(&current_iphdr_src, inp)) ||
(ip_addr_ismulticast(&current_iphdr_src))) {