aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/xfrm6_mode_beet.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/xfrm6_mode_beet.c')
-rw-r--r--net/ipv6/xfrm6_mode_beet.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c
index 9949a356d62..3437d7d4eed 100644
--- a/net/ipv6/xfrm6_mode_beet.c
+++ b/net/ipv6/xfrm6_mode_beet.c
@@ -72,14 +72,15 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
72 top_iph->nexthdr = IPPROTO_BEETPH; 72 top_iph->nexthdr = IPPROTO_BEETPH;
73 } 73 }
74 74
75 top_iph->saddr = *(struct in6_addr *)&x->props.saddr; 75 ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr);
76 top_iph->daddr = *(struct in6_addr *)&x->id.daddr; 76 ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr);
77 return 0; 77 return 0;
78} 78}
79 79
80static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb) 80static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
81{ 81{
82 struct ipv6hdr *ip6h; 82 struct ipv6hdr *ip6h;
83 const unsigned char *old_mac;
83 int size = sizeof(struct ipv6hdr); 84 int size = sizeof(struct ipv6hdr);
84 int err; 85 int err;
85 86
@@ -89,14 +90,17 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
89 90
90 __skb_push(skb, size); 91 __skb_push(skb, size);
91 skb_reset_network_header(skb); 92 skb_reset_network_header(skb);
92 skb_mac_header_rebuild(skb); 93
94 old_mac = skb_mac_header(skb);
95 skb_set_mac_header(skb, -skb->mac_len);
96 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
93 97
94 xfrm6_beet_make_header(skb); 98 xfrm6_beet_make_header(skb);
95 99
96 ip6h = ipv6_hdr(skb); 100 ip6h = ipv6_hdr(skb);
97 ip6h->payload_len = htons(skb->len - size); 101 ip6h->payload_len = htons(skb->len - size);
98 ip6h->daddr = *(struct in6_addr *)&x->sel.daddr.a6; 102 ipv6_addr_copy(&ip6h->daddr, (struct in6_addr *) &x->sel.daddr.a6);
99 ip6h->saddr = *(struct in6_addr *)&x->sel.saddr.a6; 103 ipv6_addr_copy(&ip6h->saddr, (struct in6_addr *) &x->sel.saddr.a6);
100 err = 0; 104 err = 0;
101out: 105out:
102 return err; 106 return err;