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/ipv4/xfrm4_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/ipv4/xfrm4_policy.c')
-rw-r--r-- | net/ipv4/xfrm4_policy.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index b111f468fa29..30b312c577bc 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -56,7 +56,7 @@ static int xfrm4_get_saddr(struct net *net, | |||
56 | 56 | ||
57 | static int xfrm4_get_tos(const struct flowi *fl) | 57 | static int xfrm4_get_tos(const struct flowi *fl) |
58 | { | 58 | { |
59 | return IPTOS_RT_MASK & fl->fl4_tos; /* Strip ECN bits */ | 59 | return IPTOS_RT_MASK & fl->u.ip4.flowi4_tos; /* Strip ECN bits */ |
60 | } | 60 | } |
61 | 61 | ||
62 | static int xfrm4_init_path(struct xfrm_dst *path, struct dst_entry *dst, | 62 | static int xfrm4_init_path(struct xfrm_dst *path, struct dst_entry *dst, |
@@ -69,13 +69,14 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, | |||
69 | const struct flowi *fl) | 69 | const struct flowi *fl) |
70 | { | 70 | { |
71 | struct rtable *rt = (struct rtable *)xdst->route; | 71 | struct rtable *rt = (struct rtable *)xdst->route; |
72 | const struct flowi4 *fl4 = &fl->u.ip4; | ||
72 | 73 | ||
73 | rt->rt_key_dst = fl->fl4_dst; | 74 | rt->rt_key_dst = fl4->daddr; |
74 | rt->rt_key_src = fl->fl4_src; | 75 | rt->rt_key_src = fl4->saddr; |
75 | rt->rt_tos = fl->fl4_tos; | 76 | rt->rt_tos = fl4->flowi4_tos; |
76 | rt->rt_iif = fl->flowi_iif; | 77 | rt->rt_iif = fl4->flowi4_iif; |
77 | rt->rt_oif = fl->flowi_oif; | 78 | rt->rt_oif = fl4->flowi4_oif; |
78 | rt->rt_mark = fl->flowi_mark; | 79 | rt->rt_mark = fl4->flowi4_mark; |
79 | 80 | ||
80 | xdst->u.dst.dev = dev; | 81 | xdst->u.dst.dev = dev; |
81 | dev_hold(dev); | 82 | dev_hold(dev); |
@@ -102,9 +103,10 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
102 | { | 103 | { |
103 | struct iphdr *iph = ip_hdr(skb); | 104 | struct iphdr *iph = ip_hdr(skb); |
104 | u8 *xprth = skb_network_header(skb) + iph->ihl * 4; | 105 | u8 *xprth = skb_network_header(skb) + iph->ihl * 4; |
106 | struct flowi4 *fl4 = &fl->u.ip4; | ||
105 | 107 | ||
106 | memset(fl, 0, sizeof(struct flowi)); | 108 | memset(fl4, 0, sizeof(struct flowi4)); |
107 | fl->flowi_mark = skb->mark; | 109 | fl4->flowi4_mark = skb->mark; |
108 | 110 | ||
109 | if (!(iph->frag_off & htons(IP_MF | IP_OFFSET))) { | 111 | if (!(iph->frag_off & htons(IP_MF | IP_OFFSET))) { |
110 | switch (iph->protocol) { | 112 | switch (iph->protocol) { |
@@ -117,8 +119,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
117 | pskb_may_pull(skb, xprth + 4 - skb->data)) { | 119 | pskb_may_pull(skb, xprth + 4 - skb->data)) { |
118 | __be16 *ports = (__be16 *)xprth; | 120 | __be16 *ports = (__be16 *)xprth; |
119 | 121 | ||
120 | fl->fl4_sport = ports[!!reverse]; | 122 | fl4->uli.ports.sport = ports[!!reverse]; |
121 | fl->fl4_dport = ports[!reverse]; | 123 | fl4->uli.ports.dport = ports[!reverse]; |
122 | } | 124 | } |
123 | break; | 125 | break; |
124 | 126 | ||
@@ -126,8 +128,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
126 | if (pskb_may_pull(skb, xprth + 2 - skb->data)) { | 128 | if (pskb_may_pull(skb, xprth + 2 - skb->data)) { |
127 | u8 *icmp = xprth; | 129 | u8 *icmp = xprth; |
128 | 130 | ||
129 | fl->fl4_icmp_type = icmp[0]; | 131 | fl4->uli.icmpt.type = icmp[0]; |
130 | fl->fl4_icmp_code = icmp[1]; | 132 | fl4->uli.icmpt.code = icmp[1]; |
131 | } | 133 | } |
132 | break; | 134 | break; |
133 | 135 | ||
@@ -135,7 +137,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
135 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { | 137 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { |
136 | __be32 *ehdr = (__be32 *)xprth; | 138 | __be32 *ehdr = (__be32 *)xprth; |
137 | 139 | ||
138 | fl->fl4_ipsec_spi = ehdr[0]; | 140 | fl4->uli.spi = ehdr[0]; |
139 | } | 141 | } |
140 | break; | 142 | break; |
141 | 143 | ||
@@ -143,7 +145,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
143 | if (pskb_may_pull(skb, xprth + 8 - skb->data)) { | 145 | if (pskb_may_pull(skb, xprth + 8 - skb->data)) { |
144 | __be32 *ah_hdr = (__be32*)xprth; | 146 | __be32 *ah_hdr = (__be32*)xprth; |
145 | 147 | ||
146 | fl->fl4_ipsec_spi = ah_hdr[1]; | 148 | fl4->uli.spi = ah_hdr[1]; |
147 | } | 149 | } |
148 | break; | 150 | break; |
149 | 151 | ||
@@ -151,7 +153,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
151 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { | 153 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { |
152 | __be16 *ipcomp_hdr = (__be16 *)xprth; | 154 | __be16 *ipcomp_hdr = (__be16 *)xprth; |
153 | 155 | ||
154 | fl->fl4_ipsec_spi = htonl(ntohs(ipcomp_hdr[1])); | 156 | fl4->uli.spi = htonl(ntohs(ipcomp_hdr[1])); |
155 | } | 157 | } |
156 | break; | 158 | break; |
157 | 159 | ||
@@ -163,20 +165,20 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
163 | if (greflags[0] & GRE_KEY) { | 165 | if (greflags[0] & GRE_KEY) { |
164 | if (greflags[0] & GRE_CSUM) | 166 | if (greflags[0] & GRE_CSUM) |
165 | gre_hdr++; | 167 | gre_hdr++; |
166 | fl->fl4_gre_key = gre_hdr[1]; | 168 | fl4->uli.gre_key = gre_hdr[1]; |
167 | } | 169 | } |
168 | } | 170 | } |
169 | break; | 171 | break; |
170 | 172 | ||
171 | default: | 173 | default: |
172 | fl->fl4_ipsec_spi = 0; | 174 | fl4->uli.spi = 0; |
173 | break; | 175 | break; |
174 | } | 176 | } |
175 | } | 177 | } |
176 | fl->flowi_proto = iph->protocol; | 178 | fl4->flowi4_proto = iph->protocol; |
177 | fl->fl4_dst = reverse ? iph->saddr : iph->daddr; | 179 | fl4->daddr = reverse ? iph->saddr : iph->daddr; |
178 | fl->fl4_src = reverse ? iph->daddr : iph->saddr; | 180 | fl4->saddr = reverse ? iph->daddr : iph->saddr; |
179 | fl->fl4_tos = iph->tos; | 181 | fl4->flowi4_tos = iph->tos; |
180 | } | 182 | } |
181 | 183 | ||
182 | static inline int xfrm4_garbage_collect(struct dst_ops *ops) | 184 | static inline int xfrm4_garbage_collect(struct dst_ops *ops) |