lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] Error compiling socket.c with LWIP_TCPIP_CORE_LOCKING=1


From: Mason
Subject: Re: [lwip-devel] Error compiling socket.c with LWIP_TCPIP_CORE_LOCKING=1 and LWIP_RAW=0
Date: Fri, 14 Oct 2011 14:12:54 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20110928 Firefox/7.0.1 SeaMonkey/2.4.1

Kieran Mansley wrote:

> Mason wrote:
> 
>> I suppose the patch involves sprinkling
>> #ifdef LWIP_RAW
>> #endif
>> in strategic places?
> 
> Yes.  Should be easy to find the places as most will be checking for
> NETCONN_RAW

Here's the patch I've come up with. It might have a few rough edges.
How do you handle conditional compilation mixed with if/else blocks?

--- sockets.c.orig      2011-05-06 10:51:25.000000000 +0200
+++ sockets.c   2011-10-14 14:04:27.328125000 +0200
@@ -845,22 +845,29 @@

       if (to_in != NULL) {
         inet_addr_to_ipaddr_p(remote_addr, &to_in->sin_addr);
         remote_port = ntohs(to_in->sin_port);
       } else {
-        remote_addr = &sock->conn->pcb.raw->remote_ip;
+#if LWIP_RAW
         if (sock->conn->type == NETCONN_RAW) {
+          remote_addr = &sock->conn->pcb.raw->remote_ip;
           remote_port = 0;
-        } else {
+        } else
+#endif
+        {
+          remote_addr = &sock->conn->pcb.udp->remote_ip;
           remote_port = sock->conn->pcb.udp->remote_port;
         }
       }

       LOCK_TCPIP_CORE();
+#if LWIP_RAW
       if (sock->conn->type == NETCONN_RAW) {
         err = sock->conn->last_err = raw_sendto(sock->conn->pcb.raw, p, 
remote_addr);
-      } else {
+      } else
+#endif
+      {
 #if LWIP_UDP
 #if LWIP_CHECKSUM_ON_COPY && LWIP_NETIF_TX_SINGLE_PBUF
         err = sock->conn->last_err = udp_sendto_chksum(sock->conn->pcb.udp, p,
           remote_addr, remote_port, 1, chksum);
 #else /* LWIP_CHECKSUM_ON_COPY && LWIP_NETIF_TX_SINGLE_PBUF */


-- 
Regards.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]