* ip_tables.h does not compile when using g++
@ 2002-09-14 12:07 Scott Andrew Baillie
2002-09-15 11:20 ` Harald Welte
0 siblings, 1 reply; 3+ messages in thread
From: Scott Andrew Baillie @ 2002-09-14 12:07 UTC (permalink / raw)
To: netfilter List
[-- Attachment #1: Type: text/plain, Size: 897 bytes --]
Hi,
I noticed a discussion on this list in May regarding this problem
but nobody seemed to care.
The file linux-2.4.19/include/linux/netfilter_ipv4/ip_tables.h is
included by user space programs as well as the kernel, hence I think
that it should compile using g++.
This patch makes it compile. Patch is also attached.
diff -ur linux-2.4.19/include/linux/netfilter_ipv4/ip_tables.h
linux-2.4.19-new/include/linux/netfilter_ipv4/ip_tables.h
--- linux-2.4.19/include/linux/netfilter_ipv4/ip_tables.h Mon Feb 25
19:38:13 2002
+++ linux-2.4.19-new/include/linux/netfilter_ipv4/ip_tables.h Sat Sep 14
11:11:01 2002
@@ -292,7 +292,7 @@
static __inline__ struct ipt_entry_target *
ipt_get_target(struct ipt_entry *e)
{
- return (void *)e + e->target_offset;
+ return ((struct ipt_entry_target *)((char *)e + e->target_offset));
}
/* fn returns 0 to continue iteration */
Regards,
Scott.
[-- Attachment #2: linux-2.4.19-new.patch --]
[-- Type: text/x-patch, Size: 564 bytes --]
diff -ur linux-2.4.19/include/linux/netfilter_ipv4/ip_tables.h linux-2.4.19-new/include/linux/netfilter_ipv4/ip_tables.h
--- linux-2.4.19/include/linux/netfilter_ipv4/ip_tables.h Mon Feb 25 19:38:13 2002
+++ linux-2.4.19-new/include/linux/netfilter_ipv4/ip_tables.h Sat Sep 14 11:11:01 2002
@@ -292,7 +292,7 @@
static __inline__ struct ipt_entry_target *
ipt_get_target(struct ipt_entry *e)
{
- return (void *)e + e->target_offset;
+ return ((struct ipt_entry_target *)((char *)e + e->target_offset));
}
/* fn returns 0 to continue iteration */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ip_tables.h does not compile when using g++
2002-09-14 12:07 ip_tables.h does not compile when using g++ Scott Andrew Baillie
@ 2002-09-15 11:20 ` Harald Welte
0 siblings, 0 replies; 3+ messages in thread
From: Harald Welte @ 2002-09-15 11:20 UTC (permalink / raw)
To: Scott Andrew Baillie; +Cc: netfilter List
[-- Attachment #1: Type: text/plain, Size: 1603 bytes --]
On Sat, Sep 14, 2002 at 12:07:22PM +0000, Scott Andrew Baillie wrote:
> The file linux-2.4.19/include/linux/netfilter_ipv4/ip_tables.h is
> included by user space programs as well as the kernel, hence I think
> that it should compile using g++.
You are right.
> This patch makes it compile. Patch is also attached.
>
>
> diff -ur linux-2.4.19/include/linux/netfilter_ipv4/ip_tables.h
> linux-2.4.19-new/include/linux/netfilter_ipv4/ip_tables.h
> --- linux-2.4.19/include/linux/netfilter_ipv4/ip_tables.h Mon Feb 25
> 19:38:13 2002
> +++ linux-2.4.19-new/include/linux/netfilter_ipv4/ip_tables.h Sat Sep 14
> 11:11:01 2002
> @@ -292,7 +292,7 @@
> static __inline__ struct ipt_entry_target *
> ipt_get_target(struct ipt_entry *e)
> {
> - return (void *)e + e->target_offset;
> + return ((struct ipt_entry_target *)((char *)e + e->target_offset));
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.
> Regards,
> Scott.
--
Live long and prosper
- Harald Welte / laforge@gnumonks.org http://www.gnumonks.org/
============================================================================
GCS/E/IT d- s-: a-- C+++ UL++++$ P+++ L++++$ E--- W- N++ o? K- w--- O- M+
V-- PS++ PE-- Y++ PGP++ t+ 5-- !X !R tv-- b+++ !DI !D G+ e* h--- r++ y+(*)
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ip_tables.h does not compile when using g++
@ 2002-09-16 14:12 Scott Andrew Baillie
0 siblings, 0 replies; 3+ messages in thread
From: Scott Andrew Baillie @ 2002-09-16 14:12 UTC (permalink / raw)
To: netfilter List; +Cc: Harald Welte
Hi Harald,
>
> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-09-16 14:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-14 12:07 ip_tables.h does not compile when using g++ Scott Andrew Baillie
2002-09-15 11:20 ` Harald Welte
-- strict thread matches above, loose matches on Subject: below --
2002-09-16 14:12 Scott Andrew Baillie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.