[PATCH 07/26] IPVS: Add IPv6 handler functions to AH protocol handler.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Julius R. Volz
Date: Wednesday, June 11, 2008 - 10:11 am

Define new IPv6-specific handler functions in AH protocol handler. Set new
function pointers in ip_vs_protocol struct to point to these functions.

Signed-off-by: Julius R. Volz <juliusv@google.com>

 1 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_proto_ah.c b/net/netfilter/ipvs/ip_vs_proto_ah.c
index 4bf835e..674c9d8 100644
--- a/net/netfilter/ipvs/ip_vs_proto_ah.c
+++ b/net/netfilter/ipvs/ip_vs_proto_ah.c
@@ -79,6 +79,47 @@ ah_conn_in_get(const struct sk_buff *skb,
 	return cp;
 }
 
+#ifdef CONFIG_IP_VS_IPV6
+static struct ip_vs_conn *
+ah_conn_in_get_v6(const struct sk_buff *skb,
+	          struct ip_vs_protocol *pp,
+	          const struct ipv6hdr *iph,
+	          unsigned int proto_off,
+	          int inverse)
+{
+	struct ip_vs_conn *cp;
+
+	if (likely(!inverse)) {
+		cp = ip_vs_conn_in_get_v6(IPPROTO_UDP,
+				          &iph->saddr,
+				          htons(PORT_ISAKMP),
+				          &iph->daddr,
+				          htons(PORT_ISAKMP));
+	} else {
+		cp = ip_vs_conn_in_get_v6(IPPROTO_UDP,
+				          &iph->daddr,
+				          htons(PORT_ISAKMP),
+				          &iph->saddr,
+				          htons(PORT_ISAKMP));
+	}
+
+	if (!cp) {
+		/*
+		 * We are not sure if the packet is from our
+		 * service, so our conn_schedule hook should return NF_ACCEPT
+		 */
+		IP_VS_DBG(12, "Unknown ISAKMP entry for outin packet "
+			  "%s%s " NIP6_FMT "->" NIP6_FMT "\n",
+			  inverse ? "ICMP+" : "",
+			  pp->name,
+			  NIP6(iph->saddr),
+			  NIP6(iph->daddr));
+	}
+
+	return cp;
+}
+#endif
+
 
 static struct ip_vs_conn *
 ah_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp,
@@ -112,6 +153,40 @@ ah_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp,
 	return cp;
 }
 
+#ifdef CONFIG_IP_VS_IPV6
+static struct ip_vs_conn *
+ah_conn_out_get_v6(const struct sk_buff *skb, struct ip_vs_protocol *pp,
+		   const struct ipv6hdr *iph, unsigned int proto_off, int inverse)
+{
+	struct ip_vs_conn *cp;
+
+	if (likely(!inverse)) {
+		cp = ip_vs_conn_out_get_v6(IPPROTO_UDP,
+					   &iph->saddr,
+					   htons(PORT_ISAKMP),
+					   &iph->daddr,
+					   htons(PORT_ISAKMP));
+	} else {
+		cp = ip_vs_conn_out_get_v6(IPPROTO_UDP,
+					   &iph->daddr,
+					   htons(PORT_ISAKMP),
+					   &iph->saddr,
+					   htons(PORT_ISAKMP));
+	}
+
+	if (!cp) {
+		IP_VS_DBG(12, "Unknown ISAKMP entry for inout packet "
+			  "%s%s " NIP6_FMT "->" NIP6_FMT "\n",
+			  inverse ? "ICMP+" : "",
+			  pp->name,
+			  NIP6(iph->saddr),
+			  NIP6(iph->daddr));
+	}
+
+	return cp;
+}
+#endif
+
 
 static int
 ah_conn_schedule(struct sk_buff *skb,
@@ -165,10 +240,21 @@ struct ip_vs_protocol ip_vs_protocol_ah = {
 	.init =			ah_init,
 	.exit =			ah_exit,
 	.conn_schedule =	ah_conn_schedule,
+#ifdef CONFIG_IP_VS_IPV6
+	.conn_schedule_v6 =	ah_conn_schedule,
+#endif
 	.conn_in_get =		ah_conn_in_get,
 	.conn_out_get =		ah_conn_out_get,
+#ifdef CONFIG_IP_VS_IPV6
+	.conn_in_get_v6 =	ah_conn_in_get_v6,
+	.conn_out_get_v6 =	ah_conn_out_get_v6,
+#endif
 	.snat_handler =		NULL,
 	.dnat_handler =		NULL,
+#ifdef CONFIG_IP_VS_IPV6
+	.snat_handler_v6 =	NULL,
+	.dnat_handler_v6 =	NULL,
+#endif
 	.csum_check =		NULL,
 	.state_transition =	NULL,
 	.register_app =		NULL,
-- 
1.5.3.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Julius R. Volz, (Wed Jun 11, 10:11 am)
[PATCH 07/26] IPVS: Add IPv6 handler functions to AH proto ..., Julius R. Volz, (Wed Jun 11, 10:11 am)
[PATCH 11/26] IPVS: Add supports_ipv6 flag to schedulers., Julius R. Volz, (Wed Jun 11, 10:11 am)
[PATCH 15/26] IPVS: Modify IP_VS_XMIT() to support IPv6., Julius R. Volz, (Wed Jun 11, 10:11 am)
[PATCH 16/26] IPVS: Add IPv6 xmit forwarding functions., Julius R. Volz, (Wed Jun 11, 10:11 am)
[PATCH 24/26] IPVS: Add IPv6 support to userspace interface., Julius R. Volz, (Wed Jun 11, 10:12 am)
[PATCH 26/26] IPVS: Add some blame/credits for IPv6 version., Julius R. Volz, (Wed Jun 11, 10:12 am)
Re: [PATCH 10/26] IPVS: Add IPv6 handler functions to UDP ..., Patrick McHardy, (Wed Jun 11, 10:18 am)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Wed Jun 11, 10:23 am)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Julius Volz, (Wed Jun 11, 11:23 am)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Wed Jun 11, 11:42 am)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Julius Volz, (Wed Jun 11, 12:05 pm)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Wed Jun 11, 12:10 pm)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Julius Volz, (Wed Jun 11, 12:29 pm)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Wed Jun 11, 12:31 pm)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Julius Volz, (Wed Jun 11, 12:53 pm)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Simon Horman, (Wed Jun 11, 6:45 pm)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Thu Jun 12, 6:38 am)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Thu Jun 12, 8:46 am)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Julius Volz, (Thu Jun 12, 12:33 pm)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Simon Horman, (Thu Jun 12, 11:26 pm)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Fri Jun 13, 8:14 am)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Mon Jun 16, 4:47 am)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Tue Jun 17, 4:52 am)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Julius Volz, (Tue Jun 17, 10:18 am)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Tue Jun 17, 1:08 pm)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Wed Jun 18, 1:57 am)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Wed Jun 18, 7:19 am)
Re: [PATCH 00/26] IPVS: Add first IPv6 support to IPVS., Patrick McHardy, (Wed Jun 18, 7:30 am)