netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 7/23] [PATCH] [XFRM] STATE: Add a hook to find where to be inserted header in outbound.
@ 2006-07-29  9:30 Masahide NAKAMURA
  2006-07-30 23:31 ` James Morris
  2006-08-02  0:09 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Masahide NAKAMURA @ 2006-07-29  9:30 UTC (permalink / raw)
  To: davem; +Cc: yoshfuji, anttit, vnuorval, netdev, usagi-core, Masahide NAKAMURA

On current kernel, ip6_find_1stfragopt() is used by IPv6 IPsec to find where to
be inserted header in outbound. (BTW, no usage may be needed for IPv4 case.)
Mobile IPv6 requires other logic for routing header and destination
options header respectively.
Based on MIPL2 kernel patch.
---
 include/net/xfrm.h      |    1 +
 net/ipv6/xfrm6_output.c |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index aaef1c4..bcda8c0 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -270,6 +270,7 @@ struct xfrm_type
 	void			(*destructor)(struct xfrm_state *);
 	int			(*input)(struct xfrm_state *, struct sk_buff *skb);
 	int			(*output)(struct xfrm_state *, struct sk_buff *pskb);
+	int			(*place_find)(struct xfrm_state *, struct sk_buff *, u8 **);
 	/* Estimate maximal size of result of transformation of a dgram */
 	u32			(*get_max_size)(struct xfrm_state *, int size);
 };
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index 2736a54..8792b5c 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -48,7 +48,10 @@ static void xfrm6_encap(struct sk_buff *
 		u8 *prevhdr;
 		int hdr_len;
 
-		hdr_len = ip6_find_1stfragopt(skb, &prevhdr);
+		if (x->type->place_find)
+			hdr_len = x->type->place_find(x, skb, &prevhdr);
+		else
+			hdr_len = ip6_find_1stfragopt(skb, &prevhdr);
 		skb->nh.raw = prevhdr - x->props.header_len;
 		skb->h.raw = skb->data + hdr_len;
 		memmove(skb->data, iph, hdr_len);
-- 
1.4.1


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

end of thread, other threads:[~2006-08-02  8:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-29  9:30 [PATCH 7/23] [PATCH] [XFRM] STATE: Add a hook to find where to be inserted header in outbound Masahide NAKAMURA
2006-07-30 23:31 ` James Morris
2006-08-02  0:09 ` David Miller
2006-08-02  2:20   ` Masahide NAKAMURA
2006-08-02  4:11     ` David Miller
2006-08-02  8:31       ` Masahide NAKAMURA

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).