netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iproute2: Fix building xt module against xtables version 6
@ 2011-07-04 15:17 Andreas Henriksson
  2011-07-04 16:11 ` Jan Engelhardt
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Henriksson @ 2011-07-04 15:17 UTC (permalink / raw)
  To: shemminger; +Cc: netdev, Jan Engelhardt

iptables/xtables apparently changed API again.... Now you need to pass
and extra parameter (orig_opts) which was not needed before.

Sprinkle some lovely pre-processor magic to be compatible with both older
and new versions. In the beginning of times XTABLES_VERSION_CODE didn't
exist. Then it was (0x10000 * major + 0x100 * minor + patch) when it was
first introduced (according to git), but now it's at 6...
Don't know what official iptables releases has defined it to over time.
Lets just hope none of the older versions with is has the define
higher then 6 is still around.... so only the "current" versioning
scheme is supported.... lets see how long this lasts now.

For the API change in xtables, see:
http://git.netfilter.org/cgi-bin/gitweb.cgi?p=iptables.git;a=commitdiff;h=600f38db82548a683775fd89b6e136673e924097

Signed-off-by: Andreas Henriksson <andreas@fatal.se>

---

Would be great if Jan could ack this change first...
I just tested that it atleast builds (against the new xtables version),
nothing more then that...


diff --git a/tc/m_xt.c b/tc/m_xt.c
index 651a59e..13bf19f 100644
--- a/tc/m_xt.c
+++ b/tc/m_xt.c
@@ -160,9 +160,13 @@ static int parse_ipt(struct action_util *a,int *argc_p,
 					return -1;
 				}
 				tcipt_globals.opts =
-				    xtables_merge_options(tcipt_globals.opts,
-				                          m->extra_opts,
-				                          &m->option_offset);
+				    xtables_merge_options(
+#if (XTABLES_VERSION_CODE >= 6)
+				        tcipt_globals.orig_opts,
+#endif
+				        tcipt_globals.opts,
+				        m->extra_opts,
+				        &m->option_offset);
 			} else {
 				fprintf(stderr," failed to find target %s\n\n", optarg);
 				return -1;
@@ -305,7 +309,11 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg)
 			}
 
 			tcipt_globals.opts =
-			    xtables_merge_options(tcipt_globals.opts,
+			    xtables_merge_options(
+#if (XTABLES_VERSION_CODE >= 6)
+				                  tcipt_globals.orig_opts,
+#endif
+				                  tcipt_globals.opts,
 			                          m->extra_opts,
 			                          &m->option_offset);
 		} else {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iproute2: Fix building xt module against xtables version 6
  2011-07-04 15:17 [PATCH] iproute2: Fix building xt module against xtables version 6 Andreas Henriksson
@ 2011-07-04 16:11 ` Jan Engelhardt
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Engelhardt @ 2011-07-04 16:11 UTC (permalink / raw)
  To: Andreas Henriksson; +Cc: shemminger, netdev

On Monday 2011-07-04 17:17, Andreas Henriksson wrote:

>iptables/xtables apparently changed API again.... Now you need to pass
>and extra parameter (orig_opts) which was not needed before.
>
>Sprinkle some lovely pre-processor magic to be compatible with both older
>and new versions. In the beginning of times XTABLES_VERSION_CODE didn't
>exist. Then it was (0x10000 * major + 0x100 * minor + patch) when it was
>first introduced (according to git), but now it's at 6...
>Don't know what official iptables releases has defined it to over time.

It reflects the soversion, IOW, the ABI (if the developer feels like it, 
also API). This increases only when needed rather than at every release. 
It also won't reach versions >=0x10000 anytime soon because of that. 
More importantly though, the API drafting was just finalized for 1.4.3 
(XTABLES_VERSION_CODE=1), so anything before that is a very blurry 
construct anyway.


>Lets just hope none of the older versions with is has the define
>higher then 6 is still around.... so only the "current" versioning
>scheme is supported.... lets see how long this lasts now.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-04 16:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-04 15:17 [PATCH] iproute2: Fix building xt module against xtables version 6 Andreas Henriksson
2011-07-04 16:11 ` Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).