patches
Subsystems (4)
The patches in the threads with subject:
1) [AH6] Rearrange routing headers
and
2) [IPSEC] Move generic encap code into xfrm6_output
I've simply lost track of. Herbert, can you resend the patches that I should be reviewing and applying to my tree?
Thanks.
Herbert Xu
maintainerQuoted 4 lines · David S. Miller
I've simply lost track of. Herbert, can you resend the patches that I should be reviewing and applying to my tree?
Yes it has been a bit chaotic.
Here is the routing headers patch again.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt===== net/ipv6/ah6.c 1.34 vs edited =====
net/ipv6/ah6.c +41 -1
@@ -31,6 +31,7 @@#include <net/ah.h> #include <linux/crypto.h> #include <linux/pfkeyv2.h> +#include <linux/string.h> #include <net/icmp.h> #include <net/ipv6.h> #include <net/xfrm.h>
@@ -74,6 +75,45 @@return 0 ; } +/** +* ipv6_rearrange_rthdr - rearrange IPv6 routing header +* @iph: IPv6 header +* @rthdr: routing header +* +* Rearrange the destination address in @iph and the addresses in @rthdr +* so that they appear in the order they will at the final destination. +* See Appendix A2 of RFC 2402 for details. +*/ +static void ipv6_rearrange_rthdr (struct ipv6hdr *iph,struct ipv6_rt_hdr *rthdr) +{ +int segments, segments_left; +struct in6_addr *addrs; +struct in6_addr final_addr; + + segments_left = rthdr->segments_left; +if (segments_left ==0 ) +return ; + rthdr->segments_left =0 ; + +/* The value of rthdr->hdrlen has been verified either by the system +* call if it is locally generated, or by ipv6_rthdr_rcv() for incoming +* packets. So we can assume that it is even and that segments is +* greater than or equal to segments_left. +* +* For the same reason we can assume that this option is of type 0. +*/ + segments = rthdr->hdrlen >>1 ; + + addrs = ((struct rt0_hdr *)rthdr)->addr; +ipv6_addr_copy (&final_addr, addrs + segments -1 ); + + addrs += segments - segments_left; +memmove (addrs +1 , addrs, (segments_left -1 ) *sizeof (*addrs)); + +ipv6_addr_copy (addrs, &iph->daddr); +ipv6_addr_copy (&iph->daddr, &final_addr); +} +static int ipv6_clear_mutable_options (struct ipv6hdr *iph,int len) {union {
@@ -101,7 +141,7 @@break ;case NEXTHDR_ROUTING : - exthdr.rth->segments_left =0 ; +ipv6_rearrange_rthdr (iph, exthdr.rth);break ;default :
Herbert Xu
maintainerQuoted 2 lines · David S. Miller
2) [IPSEC] Move generic encap code into
xfrm6_output
And here is the current gencap patch.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt===== net/ipv6/Makefile 1.17 vs edited =====
net/ipv6/Makefile +1 -1
@@ -11,7 +11,7 @@ ip6_flowlabel.o ipv6_syms.o ipv6-$(CONFIG_XFRM) += xfrm6_policy.o xfrm6_state.o xfrm6_input.o \ - xfrm6_tunnel.o + xfrm6_tunnel.o xfrm6_output.o ipv6-objs += $(ipv6-y) obj-$(CONFIG_INET6_AH) += ah6.o
===== net/ipv6/ah6.c 1.34 vs edited =====
net/ipv6/ah6.c +44 -78
149 lines not on this page · raw message
===== net/ipv6/esp6.c 1.30 vs edited =====
net/ipv6/esp6.c +13 -74
129 lines not on this page · raw message
===== net/ipv6/ipcomp6.c 1.13 vs edited =====
net/ipv6/ipcomp6.c +10 -66
108 lines not on this page · raw message
===== net/ipv6/xfrm6_policy.c 1.19 vs edited =====
net/ipv6/xfrm6_policy.c +1 -1
@@ -157,7 +157,7 @@/* Copy neighbour for reachability confirmation */ dst_prev->neighbour =neigh_clone (rt->u.dst.neighbour); dst_prev->input = rt->u.dst.input; - dst_prev->output = dst_prev->xfrm->type->output; + dst_prev->output = xfrm6_output;/* Sheit... I remember I did this right. Apparently, * it was magically lost, so this code needs audit */ x->u.rt6.rt6i_flags = rt0->rt6i_flags&(RTCF_BROADCAST |RTCF_MULTICAST |RTCF_LOCAL );
===== net/ipv6/xfrm6_tunnel.c 1.2 vs edited =====
net/ipv6/xfrm6_tunnel.c +3 -37
@@ -365,46 +365,12 @@static int xfrm6_tunnel_output (struct sk_buff **pskb) {struct sk_buff *skb = *pskb; -struct dst_entry *dst = skb->dst; -struct xfrm_state *x = dst->xfrm; -struct ipv6hdr *iph, *top_iph; -int err; +struct ipv6hdr *top_iph; -if ((err =xfrm6_tunnel_check_size (skb)) !=0 ) - goto error_nolock; - - iph = skb->nh.ipv6h; - - top_iph = (struct ipv6hdr *)skb_push (skb, x->props.header_len); - top_iph->version =6 ; - top_iph->priority = iph->priority; - top_iph->flow_lbl[0 ] = iph->flow_lbl[0 ]; - top_iph->flow_lbl[1 ] = iph->flow_lbl[1 ]; - top_iph->flow_lbl[2 ] = iph->flow_lbl[2 ]; - top_iph->nexthdr =IPPROTO_IPV6 ; + top_iph = (struct ipv6hdr *)skb->data; top_iph->payload_len =htons (skb->len -sizeof (struct ipv6hdr )); - top_iph->hop_limit = iph->hop_limit; -memcpy (&top_iph->saddr, (struct in6_addr *)&x->props.saddr,sizeof (struct in6_addr )); -memcpy (&top_iph->daddr, (struct in6_addr *)&x->id.daddr,sizeof (struct in6_addr )); - skb->nh.raw = skb->data; - skb->h.raw = skb->nh.raw +sizeof (struct ipv6hdr ); - - x->curlft.bytes += skb->len; - x->curlft.packets++; - -spin_unlock_bh (&x->lock); - -if ((skb->dst =dst_pop (dst)) ==NULL ) { -kfree_skb (skb); - err = -EHOSTUNREACH ; - goto error_nolock; - } - -return NET_XMIT_BYPASS ; -error_nolock: -kfree_skb (skb); -return err; +return 0 ; }static int xfrm6_tunnel_input (struct xfrm_state *x,struct xfrm_decap_state *decap,struct sk_buff *skb)
net/ipv6/xfrm6_output.c new file +123 -0
123 lines not on this page · raw message
David S. Miller
AppliedQuoted 3 lines · On Fri, 30 Jul 2004 11:24:31 +1000 Herbert Xu <[email protected]>…
Here is the routing headers patch again.
Signed-off-by Herbert Xu <[email protected]>
Applied.
Based upon reading of the rest of the thread about this patch I understand that:
1) Direction checking suggested by Yoshifuji is unecessary because on input segments_left will be zero in the type 0 routing header.
2) Both ipv4 and ipv6 erroneously do the xfrm route lookup using the first hop destination not the final destination. And this needs to be fixed with a followon patch.
Is this correct?
Herbert Xu
maintainerQuoted 8 lines · David S. Miller
Based upon reading of the rest of the thread about this patch I understand that:
1) Direction checking suggested by Yoshifuji is unecessary because on input
segments_leftwill be zero in the type 0 routing header.
Quoted 5 lines
2) Both ipv4 and ipv6 erroneously do the xfrm route lookup using the first hop destination not the final destination. And this needs to be fixed with a followon patch.
Is this correct?
Yes.
Thanks,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtDavid S. Miller
AppliedQuoted 5 lines · On Fri, 30 Jul 2004 11:26:02 +1000 Herbert Xu <[email protected]>…
Quoted 2 lines · David S. Miller
2) [IPSEC] Move generic encap code into
xfrm6_outputAnd here is the current gencap patch.
I like this patch very much. Great cleanup Herbert.
Applied.