|

楼主 |
发表于 2004-4-18 13:39:39
|
显示全部楼层
终于找到了解决方案,FC1的ip.h和tcp.h确实有问题。
(1) The first set of errors,
/usr/include/linux/ip.h:95: syntax error before "__u8"
/usr/include/linux/ip.h:102: syntax error before "tot_len"
/usr/include/linux/ip.h:103: syntax error before "id"
/usr/include/linux/ip.h:104: syntax error before "frag_off"
/usr/include/linux/ip.h:105: syntax error before "ttl"
/usr/include/linux/ip.h:106: syntax error before "protocol"
/usr/include/linux/ip.h:107: syntax error before "check"
/usr/include/linux/ip.h:108: syntax error before "saddr"
/usr/include/linux/ip.h:109: syntax error before "daddr"
can be eliminated by adding <asm/types.h> to fw-ipchains. This
adds the definition for __u8 and __u32.
(2) The second set of errors,
/usr/include/linux/tcp.h:105: braced-group within expression allowed only
inside
a function
/usr/include/linux/tcp.h:105: enumerator value for `TCP_FLAG_CWR' not
integer co
nstant
/usr/include/linux/tcp.h:106: syntax error before "__u32"
/usr/include/linux/tcp.h:107: syntax error before "__u32"
/usr/include/linux/tcp.h:108: syntax error before "__u32"
/usr/include/linux/tcp.h:109: syntax error before "__u32"
/usr/include/linux/tcp.h:110: syntax error before "__u32"
/usr/include/linux/tcp.h:111: syntax error before "__u32"
/usr/include/linux/tcp.h:112: syntax error before "__u32"
/usr/include/linux/tcp.h:113: syntax error before "__u32"
/usr/include/linux/tcp.h:114: syntax error before "__u32"
Seem to stem from the following lines in tcp.h:
enum {
TCP_FLAG_CWR = htonl(0x00800000)
TCP_FLAG_ECE = htonl(0x00400000),
TCP_FLAG_URG = htonl(0x00200000),
TCP_FLAG_ACK = htonl(0x00100000),
TCP_FLAG_PSH = htonl(0x00080000),
TCP_FLAG_RST = htonl(0x00040000),
TCP_FLAG_SYN = htonl(0x00020000),
TCP_FLAG_FIN = htonl(0x00010000),
TCP_RESERVED_BITS = htonl(0x0FC000000),
TCP_DATA_OFFSET = htonl(0xF0000000)
};
It appears that the compiler does not like a function call in the
enumeration. I checked this by doing the following:
a. copying tcp.h to tcp_new.h
b. removing the htonl in the above enumeration
c. changing #include<linux/tcp.h> to #include<linux/tcp_new.h>
compiling removes these errors. Additionally, in my new header I
made the change from an enumeration to a series of defines:
#define TCP_FLAG_CWR = htonl(0x00800000);
#define TCP_FLAG_ECE = htonl(0x00400000);
#define TCP_FLAG_URG = htonl(0x00200000);
#define TCP_FLAG_ACK = htonl(0x00100000);
#define TCP_FLAG_PSH = htonl(0x00080000);
#define TCP_FLAG_RST = htonl(0x00040000);
#define TCP_FLAG_SYN = htonl(0x00020000);
#define TCP_FLAG_FIN = htonl(0x00010000);
#define TCP_RESERVED_BITS = htonl(0x0FC000000);
#define TCP_DATA_OFFSET = htonl(0xF0000000);
which also removes the second set of errors.
In addition, these two changes remove the third set of errors
/usr/include/linux/netfilter_ipv4/ipchains_core.h:114: field `fwp_iph' has
incom
plete type
/usr/include/linux/netfilter_ipv4/ipchains_core.h:122: confused by earlier
error
s, bailing out
but introduce a new set of errors"
In file included from fw-ipchains.c:27
/usr/include/linux/netfilter_ipv4/ipchains_core.h:30: error: `fw_src' has
incomplete type
[several more of these types of errors...]
these errors can be fixed by making sure the file netinet/in.h is included
prior to
including any of the network related includes.
Thus with these modifications:
(1) addition of #include<asm/types.h> as line 14
(2) addition of #include<netinet/in.h> as line 15
(3) creation of tcp_new.h as described above
(4) modification of #include<linux/tcp.h> to #include<linux/tcp_new.h>
libdnet compiles and links start to finish. |
|