This patch fixes this catched by gcc:

$ make
(...)/lwip/src/netif/etharp.c
(...)/lwip/src/netif/etharp.c: In function 'etharp_arp_input':
(...)/lwip/src/netif/etharp.c:505: warning: dereferencing type-punned pointer will break strict-aliasing rules (...)/lwip/src/netif/etharp.c:506: warning: dereferencing type-punned pointer will break strict-aliasing rules

We could also use memcpy here, but that seems overkill for copying 8 bytes.

Cheers,
Pedro Alves

Index: src/netif/etharp.c
===================================================================
RCS file: /sources/lwip/lwip/src/netif/etharp.c,v
retrieving revision 1.94
diff -u -r1.94 etharp.c
--- src/netif/etharp.c    29 Mar 2006 13:16:40 -0000    1.94
+++ src/netif/etharp.c    18 Apr 2006 10:41:47 -0000
@@ -487,10 +487,11 @@
  }

  hdr = p->payload;
-
  /* get aligned copies of addresses */
-  *(struct ip_addr2 *)&sipaddr = hdr->sipaddr;
-  *(struct ip_addr2 *)&dipaddr = hdr->dipaddr;
+  for(i=0; i<sizeof(hdr->sipaddr); i++)
+    ((u8_t*)&sipaddr)[i] = ((u8_t*)&hdr->sipaddr)[i];
+  for(i=0; i<sizeof(hdr->dipaddr); i++)
+    ((u8_t*)&dipaddr)[i] = ((u8_t*)&hdr->dipaddr)[i];

  /* this interface is not configured? */
  if (netif->ip_addr.addr == 0) {



_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to