@@ -143,9 +143,9 @@ static int DNAT_parse(int c, char **argv, int invert, unsigned int *flags,
struct ipt_natinfo *info = (void *)*target;
int portok;
- if (entry->ip.proto == IPPROTO_TCP
- || entry->ip.proto == IPPROTO_UDP
- || entry->ip.proto == IPPROTO_ICMP)
+ if (entry->pkt_header.ip4.proto == IPPROTO_TCP
+ || entry->pkt_header.ip4.proto == IPPROTO_UDP
+ || entry->pkt_header.ip4.proto == IPPROTO_ICMP)
portok = 1;
else
portok = 0;
@@ -79,9 +79,9 @@ static int MASQUERADE_parse(int c, char **argv, int invert, unsigned int *flags,
struct ip_nat_multi_range *mr
= (struct ip_nat_multi_range *)(*target)->data;
- if (entry->ip.proto == IPPROTO_TCP
- || entry->ip.proto == IPPROTO_UDP
- || entry->ip.proto == IPPROTO_ICMP)
+ if (entry->pkt_header.ip4.proto == IPPROTO_TCP
+ || entry->pkt_header.ip4.proto == IPPROTO_UDP
+ || entry->pkt_header.ip4.proto == IPPROTO_ICMP)
portok = 1;
else
portok = 0;
@@ -86,9 +86,9 @@ static int REDIRECT_parse(int c, char **argv, int invert, unsigned int *flags,
= (struct ip_nat_multi_range *)(*target)->data;
int portok;
- if (entry->ip.proto == IPPROTO_TCP
- || entry->ip.proto == IPPROTO_UDP
- || entry->ip.proto == IPPROTO_ICMP)
+ if (entry->pkt_header.ip4.proto == IPPROTO_TCP
+ || entry->pkt_header.ip4.proto == IPPROTO_UDP
+ || entry->pkt_header.ip4.proto == IPPROTO_ICMP)
portok = 1;
else
portok = 0;
@@ -143,9 +143,9 @@ static int SNAT_parse(int c, char **argv, int invert, unsigned int *flags,
struct ipt_natinfo *info = (void *)*target;
int portok;
- if (entry->ip.proto == IPPROTO_TCP
- || entry->ip.proto == IPPROTO_UDP
- || entry->ip.proto == IPPROTO_ICMP)
+ if (entry->pkt_header.ip4.proto == IPPROTO_TCP
+ || entry->pkt_header.ip4.proto == IPPROTO_UDP
+ || entry->pkt_header.ip4.proto == IPPROTO_ICMP)
portok = 1;
else
portok = 0;
new file mode 100644
@@ -0,0 +1,44 @@
+/* Shared library add-on to iptables for standard target support. */
+#include <stdio.h>
+#include <netdb.h>
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <getopt.h>
+#include <xtables.h>
+
+/* Function which prints out usage message. */
+static void chain_help(void)
+{
+ printf(
+"chain target options:\n"
+"When using a chain as target\n");
+}
+
+/* Function which parses command options; returns true if it
+ ate an option */
+static int chain_parse(int c, char **argv, int invert, unsigned int *flags,
+ const void *entry, struct xt_entry_target **target)
+{
+ return 0;
+}
+
+void chain_save(const void *ip,
+ const struct xt_entry_target *target){
+}
+
+static struct xtables_target standard_target = {
+ .family = AF_UNSPEC,
+ .name = "chain",
+ .version = XTABLES_VERSION,
+ .size = XT_ALIGN(sizeof(int)),
+ .userspacesize = XT_ALIGN(sizeof(int)),
+ .help = chain_help,
+ .parse = chain_parse,
+ .save = chain_save,
+};
+
+void _init(void)
+{
+ xtables_register_target(&standard_target);
+}
@@ -206,7 +206,7 @@ multiport_parse(int c, char **argv, int invert, unsigned int *flags,
{
const struct ipt_entry *entry = e;
return __multiport_parse(c, argv, invert, flags, match,
- entry->ip.proto, entry->ip.invflags);
+ entry->pkt_header.ip4.proto, entry->pkt_header.ip4.invflags);
}
static int
@@ -269,7 +269,7 @@ multiport_parse_v1(int c, char **argv, int invert, unsigned int *flags,
{
const struct ipt_entry *entry = e;
return __multiport_parse_v1(c, argv, invert, flags, match,
- entry->ip.proto, entry->ip.invflags);
+ entry->pkt_header.ip4.proto, entry->pkt_header.ip4.invflags);
}
static int