about ip_tables.h code correction
Hello.
I work on my little project and need to use C++ compiler for that code. But it's impossible now cause in ip_tables.h we can see
/* Helper functions */
static __inline__ struct ipt_entry_target *ipt_get_target(struct ipt_entry *e)
{
return (void *)e + e->target_offset;
}For any c++ compiler it's a wrong code.
I know what all netfilter guru use plain C only but explict type correction it's a good style of programming in any case :)
I make a little patch (in attchment).
It's correct this function to
/* Helper functions */
static __inline__ struct ipt_entry_target *ipt_get_target(struct ipt_entry *e)
{
return (struct ipt_entry_target *)((u_int8_t*)e + e->target_offset);
}In other words - it's patch only one line.
Please tell me - i'm idiot or i'm right ? :)
........................................................................
IRC: irc.openprojects.net #asplinux Grigory Bakunov
EMAIL: [email protected] ASPLinux Support Team
ICQ: 51369901 http://www.asplinux.ru
-----BEGIN GEEK CODE BLOCK-----
GCS/MU d-(--) s:- a- C+++>++$ UBLAVSX+++$ 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+ z++(+++)
------END GEEK CODE BLOCK------
ip_tables.h renamed from ip_tables.h.old +1 -1
@@ -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 *)((u_int8_t *)e + e->target_offset); }/* fn returns 0 to continue iteration */