Open eliabieri opened 8 years ago
The issue is probably with some header file. Presently it works fine on linux. Will look into it in some time
For what it's worth, I also tried compiling this with gcc47 (sourced from pkg-src and installed on OS X 10.11.2) instead of clang and it still exited with errors
gcc -c -o icmptunnel.o icmptunnel.c -I.
gcc -c -o icmp.o icmp.c -I.
icmp.c:22:47: warning: 'struct icmphdr' declared inside parameter list [enabled by default]
icmp.c:22:47: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
icmp.c:22:47: warning: 'struct iphdr' declared inside parameter list [enabled by default]
icmp.c: In function 'send_icmp_packet':
icmp.c:103:24: error: invalid application of 'sizeof' to incomplete type 'struct iphdr'
icmp.c:103:47: error: invalid application of 'sizeof' to incomplete type 'struct icmphdr'
icmp.c:114:45: error: invalid application of 'sizeof' to incomplete type 'struct iphdr'
icmp.c:115:43: error: invalid application of 'sizeof' to incomplete type 'struct iphdr'
icmp.c:115:66: error: invalid application of 'sizeof' to incomplete type 'struct icmphdr'
icmp.c:117:3: warning: passing argument 1 of 'prepare_headers' from incompatible pointer type [enabled by default]
icmp.c:22:6: note: expected 'struct iphdr *' but argument is of type 'struct iphdr *'
icmp.c:117:3: warning: passing argument 2 of 'prepare_headers' from incompatible pointer type [enabled by default]
icmp.c:22:6: note: expected 'struct icmphdr *' but argument is of type 'struct icmphdr *'
icmp.c:119:5: error: dereferencing pointer to incomplete type
icmp.c:120:5: error: dereferencing pointer to incomplete type
icmp.c:121:5: error: dereferencing pointer to incomplete type
icmp.c:125:7: error: dereferencing pointer to incomplete type
icmp.c:126:7: error: dereferencing pointer to incomplete type
icmp.c:127:7: error: dereferencing pointer to incomplete type
icmp.c:127:60: error: invalid application of 'sizeof' to incomplete type 'struct icmphdr'
icmp.c: In function 'receive_icmp_packet':
icmp.c:165:45: error: invalid application of 'sizeof' to incomplete type 'struct iphdr'
icmp.c:166:43: error: invalid application of 'sizeof' to incomplete type 'struct iphdr'
icmp.c:166:66: error: invalid application of 'sizeof' to incomplete type 'struct icmphdr'
icmp.c:169:26: error: dereferencing pointer to incomplete type
icmp.c:170:26: error: dereferencing pointer to incomplete type
icmp.c:171:30: error: dereferencing pointer to incomplete type
icmp.c:172:55: error: invalid application of 'sizeof' to incomplete type 'struct iphdr'
icmp.c:172:78: error: invalid application of 'sizeof' to incomplete type 'struct icmphdr'
icmp.c: At top level:
icmp.c:220:47: warning: 'struct icmphdr' declared inside parameter list [enabled by default]
icmp.c:220:47: warning: 'struct iphdr' declared inside parameter list [enabled by default]
icmp.c:220:6: error: conflicting types for 'prepare_headers'
icmp.c:22:6: note: previous declaration of 'prepare_headers' was here
icmp.c: In function 'prepare_headers':
icmp.c:222:5: error: dereferencing pointer to incomplete type
icmp.c:223:5: error: dereferencing pointer to incomplete type
icmp.c:224:5: error: dereferencing pointer to incomplete type
icmp.c:225:5: error: dereferencing pointer to incomplete type
icmp.c:226:5: error: dereferencing pointer to incomplete type
icmp.c:227:5: error: dereferencing pointer to incomplete type
icmp.c:228:5: error: dereferencing pointer to incomplete type
icmp.c:230:7: error: dereferencing pointer to incomplete type
icmp.c:231:7: error: dereferencing pointer to incomplete type
icmp.c:232:7: error: dereferencing pointer to incomplete type
icmp.c:233:7: error: dereferencing pointer to incomplete type
make: *** [icmp.o] Error 1
running echo $?
reveals that it exited with code 2. gcc version used is version 4.7.4 built and installed yesterday.
Perhapsstruct iphdr
is defined differently/not defined in OS X. I'll have to define it myself.
I'm still searching for other solutions though.
:+1:
Yeah, I tried declaring the structs manually in the icmp.c file [struct iphdr{stuff}; , etc], which fixed the 'incomplete type' issues. I do agree that there is probably a more portable solution to the problem though.
@JohnDDuncanIII may you explain how do you do it? Thanks
@martinorob An alternative ICMP tunnel implementation with a working OS X client is Hans: http://code.gerade.org/hans/ https://github.com/friedrich/hans
Any updates on this?
Not yet.
struct iphdr not exists on MacOS, use the define code below
Got the same issues
Same here
I'm having the same.
This is the error I get when I try to compile icmptunnel on OS X Capitain.