All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mitsuru KANDA / 神田 充" <mk@karaba.org>
To: "David S. Miller" <davem@redhat.com>
Cc: kunihiro@ipinfusion.com, kuznet@ms2.inr.ac.ru,
	netdev@oss.sgi.com, usagi-core@linux-ipv6.org
Subject: Re: [PATCH] IPv6 IPsec support
Date: Thu, 20 Feb 2003 01:56:48 +0900	[thread overview]
Message-ID: <m3el645hv3.wl@karaba.org> (raw)
In-Reply-To: <20030218.233301.98333082.davem@redhat.com>


Hello David,

> 1) Please, can you split out seperate patch for changes
>    to net/ipv4/xfrm_user.c?  They are independant.
> 
>    Kunihiro sent me identical patch, so please could you
>    add him to credits in comment?  Thank you.
I attached xfrm_user.c patch below.


Just FYI, 
the IPv6 part of this patch depends xfrm6_state_lookup().

Sincerely,

Mitsuru KANDA (mk@karaba.org)
 USAGI Project (mk@linux-ipv6.org)



diff -uNr linux-2.5.62.org/net/ipv4/xfrm_user.c linux-2.5.62/net/ipv4/xfrm_user.c
--- linux-2.5.62.org/net/ipv4/xfrm_user.c	2003-02-18 07:56:17.000000000 +0900
+++ linux-2.5.62/net/ipv4/xfrm_user.c	2003-02-20 00:00:57.000000000 +0900
@@ -1,6 +1,13 @@
 /* xfrm_user.c: User interface to configure xfrm engine.
  *
  * Copyright (C) 2002 David S. Miller (davem@redhat.com)
+ *
+ * Changes
+ *
+ *	Mitsuru KANDA @USAGI       : IPv6 Support 
+ * 	Kazunori MIYAZAWA @USAGI   :
+ * 	Kunihiro Ishiguro          :
+ * 	
  */
 
 #include <linux/module.h>
@@ -17,6 +24,9 @@
 #include <linux/ipsec.h>
 #include <linux/init.h>
 #include <linux/security.h>
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+#include <linux/in6.h>
+#endif
 #include <net/sock.h>
 #include <net/xfrm.h>
 
@@ -63,11 +73,13 @@
 	case AF_INET:
 		break;
 
-	case AF_INET6: /* XXX */
-		err = -EAFNOSUPPORT;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+	case AF_INET6:
+		break;
+#endif
 
-		/* fallthru */
 	default:
+		err = -EAFNOSUPPORT;
 		goto out;
 	};
 
@@ -206,8 +218,21 @@
 	if (!x)
 		return err;
 
-	x1 = xfrm_state_lookup(x->props.saddr.xfrm4_addr,
-			       x->id.spi, x->id.proto);
+	switch (p->family) {
+	case AF_INET:
+		x1 = xfrm_state_lookup(x->props.saddr.xfrm4_addr, 
+				x->id.spi, x->id.proto);
+		break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+	case AF_INET6:
+		x1 = xfrm6_state_lookup((struct in6_addr *)&x->props.saddr,
+				x->id.spi,x->id.proto);
+		break;
+#endif
+	default:
+		return -EAFNOSUPPORT;
+	}
+
 	if (x1) {
 		xfrm_state_put(x);
 		xfrm_state_put(x1);
@@ -224,7 +249,19 @@
 	struct xfrm_state *x;
 	struct xfrm_usersa_id *p = NLMSG_DATA(nlh);
 
-	x = xfrm_state_lookup(p->saddr.xfrm4_addr, p->spi, p->proto);
+	switch (p->family) {
+	case AF_INET:
+		x = xfrm_state_lookup(p->saddr.xfrm4_addr, p->spi, p->proto);
+		break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+	case AF_INET6:
+		x = xfrm6_state_lookup((struct in6_addr *)&p->saddr, p->spi, p->proto);
+		break;
+#endif
+	default:
+		return -EAFNOSUPPORT;
+	}
+
 	if (x == NULL)
 		return -ESRCH;
 
@@ -342,7 +379,19 @@
 	struct sk_buff *resp_skb;
 	int err;
 
-	x = xfrm_state_lookup(p->saddr.xfrm4_addr, p->spi, p->proto);
+	switch (p->family) {
+	case AF_INET:
+		x = xfrm_state_lookup(p->saddr.xfrm4_addr, p->spi, p->proto);
+		break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+	case AF_INET6:
+		x = xfrm6_state_lookup((struct in6_addr *)&p->saddr, p->spi, p->proto);
+		break;
+#endif
+	default:
+		return -EAFNOSUPPORT;
+	}
+
 	err = -ESRCH;
 	if (x == NULL)
 		goto out_noput;
@@ -393,9 +442,25 @@
 	err = verify_userspi_info(p);
 	if (err)
 		goto out_noput;
-	x = xfrm_find_acq(p->info.mode, p->info.reqid, p->info.id.proto,
-			  p->info.sel.daddr.xfrm4_addr,
-			  p->info.sel.saddr.xfrm4_addr, 1);
+
+	switch (p->info.family) {
+	case AF_INET:
+		x = xfrm_find_acq(p->info.mode, p->info.reqid, p->info.id.proto, 
+				p->info.sel.daddr.xfrm4_addr, 
+				p->info.sel.saddr.xfrm4_addr, 1);
+		break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+	case AF_INET6:
+		x = xfrm6_find_acq(p->info.mode, p->info.reqid, p->info.id.proto,
+				(struct in6_addr *)&p->info.sel.daddr,
+				(struct in6_addr *)&p->info.sel.saddr, 1);
+		break;
+#endif
+	default:
+		err = -EAFNOSUPPORT;
+		goto out_noput;
+	}
+
 	err = -ENOENT;
 	if (x == NULL)
 		goto out_noput;

  parent reply	other threads:[~2003-02-19 16:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-19  4:48 [PATCH] IPv6 IPsec support Kazunori MIyazawa
2003-02-19  4:50 ` David S. Miller
2003-02-19  5:10   ` Kunihiro Ishiguro
2003-02-19  5:17     ` Mitsuru KANDA / 神田 充
2003-02-19  5:58       ` Kazunori Miyazawa
2003-02-19  5:30   ` YOSHIFUJI Hideaki / 吉藤英明
2003-02-19  5:57 ` Kunihiro Ishiguro
2003-02-19  7:02   ` David S. Miller
2003-02-19  9:13     ` Kunihiro Ishiguro
2003-02-19  7:13 ` David S. Miller
2003-02-19  7:33 ` David S. Miller
2003-02-19 14:39   ` (usagi-core 11926) " Kazunori MIyazawa
2003-02-19 21:27     ` David S. Miller
2003-02-19 16:56   ` Mitsuru KANDA / 神田 充 [this message]
2003-02-19 21:43     ` David S. Miller
2003-02-19 23:10     ` Kunihiro Ishiguro
2003-02-20  0:37       ` David S. Miller
  -- strict thread matches above, loose matches on Subject: below --
2003-02-22 11:26 [PATCH] IPv6 IPSEC support Kazunori Miyazawa
2003-02-22 11:13 ` David S. Miller
2003-02-22 12:15   ` Kazunori Miyazawa
2003-02-22 12:49   ` YOSHIFUJI Hideaki / 吉藤英明
2003-02-22 23:47     ` David S. Miller
2003-02-23  0:44       ` YOSHIFUJI Hideaki / 吉藤英明
2003-02-23 15:35   ` Kazunori Miyazawa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3el645hv3.wl@karaba.org \
    --to=mk@karaba.org \
    --cc=davem@redhat.com \
    --cc=kunihiro@ipinfusion.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@oss.sgi.com \
    --cc=usagi-core@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.