Skip to contentSkip to conversation

ip_tables.h does not compile when using g++

DISCUSSION Scott Andrew Baillie 1 participant 1 message Sep 16, 2002 netfilter

lore
Share & tools
lore
#0 lore raw

Hi Harald,

Quoted 11 lines

why does it have to be (char *) ? There are no characters involved, hence it (in the spirit of this gcc extension) should be (void *).

The typecast to struct ipt_entry_target is correct, however.

Does it compile with

return ((struct ipt_entry_target *)((void *)e + e->target_offset));

If yes, I will submit this modified version of your patch.

No, it does not compile with (void *) at all. Here is the error message from gcc-3.2 when compiling using g++ :

ip_tables.h: In
function `ipt_entry_target* ipt_get_target(ipt_entry*)':
ip_tables.h:295: pointer
of type `void *' used in arithmetic

I agree that the (char *) looks a little confusing but I dont know what else to use.

Also, just below the function 'ipt_get_target' there is 2 macros defined that use the same (void *) cast. These casts should also be patched.

Regards,

Scott.