diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-12 02:42:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-12 18:08:52 -0500 |
commit | 7e1dc7b6f709dfc1a9ab4b320dbe723f45992693 (patch) | |
tree | db3a0ae07fb469c7f809a448bc39563f98edfec5 /net/ipv6/xfrm6_policy.c | |
parent | 2032656e76b5355151effdff14de4a1a58643915 (diff) |
net: Use flowi4 and flowi6 in xfrm layer.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/xfrm6_policy.c')
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 213c7594144b..254aa6d79506 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -30,15 +30,17 @@ static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos, | |||
30 | const xfrm_address_t *saddr, | 30 | const xfrm_address_t *saddr, |
31 | const xfrm_address_t *daddr) | 31 | const xfrm_address_t *daddr) |
32 | { | 32 | { |
33 | struct flowi fl = {}; | 33 | struct flowi6 fl6; |
34 | struct dst_entry *dst; | 34 | struct dst_entry *dst; |
35 | int err; | 35 | int err; |
36 | 36 | ||
37 | memcpy(&fl.fl6_dst, daddr, sizeof(fl.fl6_dst)); | 37 | memset(&fl6, 0, sizeof(fl6)); |
38 | memcpy(&fl6.daddr, daddr, sizeof(fl6.daddr)); | ||
38 | if (saddr) | 39 | if (saddr) |
39 | memcpy(&fl.fl6_src, saddr, sizeof(fl.fl6_src)); | 40 | memcpy(&fl6.saddr, saddr, sizeof(fl6.saddr)); |
40 | 41 | ||
41 | dst = ip6_route_output(net, NULL, &fl); | 42 | dst = ip6_route_output(net, NULL, |
43 | flowi6_to_flowi(&fl6)); | ||
42 | 44 | ||
43 | err = dst->error; | 45 | err = dst->error; |
44 | if (dst->error) { | 46 | if (dst->error) { |
@@ -120,6 +122,7 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, | |||
120 | static inline void | 122 | static inline void |
121 | _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | 123 | _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) |
122 | { | 124 | { |
125 | struct flowi6 *fl6 = &fl->u.ip6; | ||
123 | int onlyproto = 0; | 126 | int onlyproto = 0; |
124 | u16 offset = skb_network_header_len(skb); | 127 | u16 offset = skb_network_header_len(skb); |
125 | struct ipv6hdr *hdr = ipv6_hdr(skb); | 128 | struct ipv6hdr *hdr = ipv6_hdr(skb); |
@@ -127,11 +130,11 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
127 | const unsigned char *nh = skb_network_header(skb); | 130 | const unsigned char *nh = skb_network_header(skb); |
128 | u8 nexthdr = nh[IP6CB(skb)->nhoff]; | 131 | u8 nexthdr = nh[IP6CB(skb)->nhoff]; |
129 | 132 | ||
130 | memset(fl, 0, sizeof(struct flowi)); | 133 | memset(fl6, 0, sizeof(struct flowi6)); |
131 | fl->flowi_mark = skb->mark; | 134 | fl6->flowi6_mark = skb->mark; |
132 | 135 | ||
133 | ipv6_addr_copy(&fl->fl6_dst, reverse ? &hdr->saddr : &hdr->daddr); | 136 | ipv6_addr_copy(&fl6->daddr, reverse ? &hdr->saddr : &hdr->daddr); |
134 | ipv6_addr_copy(&fl->fl6_src, reverse ? &hdr->daddr : &hdr->saddr); | 137 | ipv6_addr_copy(&fl6->saddr, reverse ? &hdr->daddr : &hdr->saddr); |
135 | 138 | ||
136 | while (nh + offset + 1 < skb->data || | 139 | while (nh + offset + 1 < skb->data || |
137 | pskb_may_pull(skb, nh + offset + 1 - skb->data)) { | 140 | pskb_may_pull(skb, nh + offset + 1 - skb->data)) { |
@@ -158,20 +161,20 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
158 | pskb_may_pull(skb, nh + offset + 4 - skb->data))) { | 161 | pskb_may_pull(skb, nh + offset + 4 - skb->data))) { |
159 | __be16 *ports = (__be16 *)exthdr; | 162 | __be16 *ports = (__be16 *)exthdr; |
160 | 163 | ||
161 | fl->fl6_sport = ports[!!reverse]; | 164 | fl6->uli.ports.sport = ports[!!reverse]; |
162 | fl->fl6_dport = ports[!reverse]; | 165 | fl6->uli.ports.dport = ports[!reverse]; |
163 | } | 166 | } |
164 | fl->flowi_proto = nexthdr; | 167 | fl6->flowi6_proto = nexthdr; |
165 | return; | 168 | return; |
166 | 169 | ||
167 | case IPPROTO_ICMPV6: | 170 | case IPPROTO_ICMPV6: |
168 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 2 - skb->data)) { | 171 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 2 - skb->data)) { |
169 | u8 *icmp = (u8 *)exthdr; | 172 | u8 *icmp = (u8 *)exthdr; |
170 | 173 | ||
171 | fl->fl6_icmp_type = icmp[0]; | 174 | fl6->uli.icmpt.type = icmp[0]; |
172 | fl->fl6_icmp_code = icmp[1]; | 175 | fl6->uli.icmpt.code = icmp[1]; |
173 | } | 176 | } |
174 | fl->flowi_proto = nexthdr; | 177 | fl6->flowi6_proto = nexthdr; |
175 | return; | 178 | return; |
176 | 179 | ||
177 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | 180 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
@@ -180,9 +183,9 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
180 | struct ip6_mh *mh; | 183 | struct ip6_mh *mh; |
181 | mh = (struct ip6_mh *)exthdr; | 184 | mh = (struct ip6_mh *)exthdr; |
182 | 185 | ||
183 | fl->fl6_mh_type = mh->ip6mh_type; | 186 | fl6->uli.mht.type = mh->ip6mh_type; |
184 | } | 187 | } |
185 | fl->flowi_proto = nexthdr; | 188 | fl6->flowi6_proto = nexthdr; |
186 | return; | 189 | return; |
187 | #endif | 190 | #endif |
188 | 191 | ||
@@ -191,8 +194,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
191 | case IPPROTO_ESP: | 194 | case IPPROTO_ESP: |
192 | case IPPROTO_COMP: | 195 | case IPPROTO_COMP: |
193 | default: | 196 | default: |
194 | fl->fl6_ipsec_spi = 0; | 197 | fl6->uli.spi = 0; |
195 | fl->flowi_proto = nexthdr; | 198 | fl6->flowi6_proto = nexthdr; |
196 | return; | 199 | return; |
197 | } | 200 | } |
198 | } | 201 | } |