Error building ocserv 0.2.2

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

 



On Mon, Dec 9, 2013 at 12:02 AM, Per Juborg <per at juborg.nu> wrote:
> Hi,
>
> The story continues,
>
> I added the include, I also had to add netinet/ip.h
>
> The this shows up:
>   CC       icmp-ping.o
> icmp-ping.c:229:44: error: incomplete definition of type 'struct iphdr'
>                                 pkt = (struct icmp *) (packet1 + (iphdr->ihl << 2));    /* skip ip hdr */
>                                                                   ~~~~~^

Most probably you need something like the attached patch (which is untested).

regards,
Nikos
-------------- next part --------------
diff --git a/src/icmp-ping.c b/src/icmp-ping.c
index bd39ad7..a7326f6 100644
--- a/src/icmp-ping.c
+++ b/src/icmp-ping.c
@@ -77,6 +77,7 @@
 # include <netinet/in_systm.h>
 #endif
 #include <netinet/ip_icmp.h>
+#include <netinet/ip.h>
 #include <netinet/icmp6.h>
 #include <sys/select.h>
 #include <sys/time.h>
@@ -225,9 +226,13 @@ int icmp_ping4(main_server_st * s, struct sockaddr_in *addr1,
 			    (SA_IN_P(&from), SA_IN_P(addr2),
 			     SA_IN_SIZE(sizeof(*addr2))) == 0) {
 
+#ifdef HAVE_STRUCT_IPHDR_IHL
 				struct iphdr *iphdr =
 				    (struct iphdr *) packet1;
 				pkt = (struct icmp *) (packet1 + (iphdr->ihl << 2));	/* skip ip hdr */
+#else
+				pkt = (struct icmp *) (packet1 + ((packet[0] & 0x0f) << 2));	/* skip ip hdr */
+#endif
 				if (pkt->icmp_id == id1 || pkt->icmp_id == id2) {
 					if (pkt->icmp_type == ICMP_ECHOREPLY)
 						gotreply++;


[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux