aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-12 02:42:11 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-12 18:08:52 -0500
commit7e1dc7b6f709dfc1a9ab4b320dbe723f45992693 (patch)
treedb3a0ae07fb469c7f809a448bc39563f98edfec5 /net/ipv6
parent2032656e76b5355151effdff14de4a1a58643915 (diff)
net: Use flowi4 and flowi6 in xfrm layer.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/xfrm6_policy.c39
-rw-r--r--net/ipv6/xfrm6_state.c14
2 files changed, 29 insertions, 24 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,
120static inline void 122static 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 }
diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c
index b456533a652d..afe941e9415c 100644
--- a/net/ipv6/xfrm6_state.c
+++ b/net/ipv6/xfrm6_state.c
@@ -22,19 +22,21 @@
22static void 22static void
23__xfrm6_init_tempsel(struct xfrm_selector *sel, const struct flowi *fl) 23__xfrm6_init_tempsel(struct xfrm_selector *sel, const struct flowi *fl)
24{ 24{
25 const struct flowi6 *fl6 = &fl->u.ip6;
26
25 /* Initialize temporary selector matching only 27 /* Initialize temporary selector matching only
26 * to current session. */ 28 * to current session. */
27 ipv6_addr_copy((struct in6_addr *)&sel->daddr, &fl->fl6_dst); 29 ipv6_addr_copy((struct in6_addr *)&sel->daddr, &fl6->daddr);
28 ipv6_addr_copy((struct in6_addr *)&sel->saddr, &fl->fl6_src); 30 ipv6_addr_copy((struct in6_addr *)&sel->saddr, &fl6->saddr);
29 sel->dport = xfrm_flowi_dport(fl, &fl->u.ip6.uli); 31 sel->dport = xfrm_flowi_dport(fl, &fl6->uli);
30 sel->dport_mask = htons(0xffff); 32 sel->dport_mask = htons(0xffff);
31 sel->sport = xfrm_flowi_sport(fl, &fl->u.ip6.uli); 33 sel->sport = xfrm_flowi_sport(fl, &fl6->uli);
32 sel->sport_mask = htons(0xffff); 34 sel->sport_mask = htons(0xffff);
33 sel->family = AF_INET6; 35 sel->family = AF_INET6;
34 sel->prefixlen_d = 128; 36 sel->prefixlen_d = 128;
35 sel->prefixlen_s = 128; 37 sel->prefixlen_s = 128;
36 sel->proto = fl->flowi_proto; 38 sel->proto = fl6->flowi6_proto;
37 sel->ifindex = fl->flowi_oif; 39 sel->ifindex = fl6->flowi6_oif;
38} 40}
39 41
40static void 42static void