Skip to contentSkip to conversation

IPtablestng/UserSpace - patch extensions

PATCH New hamid jafarian 1 participant 1 message Oct 27, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 5/5 IPtablestng/UserSpace - patch extensions

use 'pktt_entry' instead of 'ipt_entry'.

also he creates new target named 'libipt_chain.c'. he is a helper target like 'standard' that provides the ability to use chains as target.

extensions/libipt_DNAT.c +3 -3
index fed7611..e3cc2eb 100644
@@ -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;
extensions/libipt_MASQUERADE.c +3 -3
index ea4f5cd..f3ec4d3 100644
@@ -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;
extensions/libipt_REDIRECT.c +3 -3
index c03562b..9f373de 100644
@@ -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;
extensions/libipt_SNAT.c +3 -3
index 11536c6..7881bc1 100644
@@ -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;
extensions/libxt_chain.c new file +44 -0

44 lines not on this page · raw message

extensions/libxt_multiport.c +2 -2
index 413f178..de6a650 100644
@@ -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