@@ -111,7 +111,8 @@ static void
111
111
_decode_session4 (struct sk_buff * skb , struct flowi * fl , int reverse )
112
112
{
113
113
const struct iphdr * iph = ip_hdr (skb );
114
- u8 * xprth = skb_network_header (skb ) + iph -> ihl * 4 ;
114
+ int ihl = iph -> ihl ;
115
+ u8 * xprth = skb_network_header (skb ) + ihl * 4 ;
115
116
struct flowi4 * fl4 = & fl -> u .ip4 ;
116
117
int oif = 0 ;
117
118
@@ -122,6 +123,11 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
122
123
fl4 -> flowi4_mark = skb -> mark ;
123
124
fl4 -> flowi4_oif = reverse ? skb -> skb_iif : oif ;
124
125
126
+ fl4 -> flowi4_proto = iph -> protocol ;
127
+ fl4 -> daddr = reverse ? iph -> saddr : iph -> daddr ;
128
+ fl4 -> saddr = reverse ? iph -> daddr : iph -> saddr ;
129
+ fl4 -> flowi4_tos = iph -> tos ;
130
+
125
131
if (!ip_is_fragment (iph )) {
126
132
switch (iph -> protocol ) {
127
133
case IPPROTO_UDP :
@@ -133,7 +139,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
133
139
pskb_may_pull (skb , xprth + 4 - skb -> data )) {
134
140
__be16 * ports ;
135
141
136
- xprth = skb_network_header (skb ) + iph -> ihl * 4 ;
142
+ xprth = skb_network_header (skb ) + ihl * 4 ;
137
143
ports = (__be16 * )xprth ;
138
144
139
145
fl4 -> fl4_sport = ports [!!reverse ];
@@ -146,7 +152,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
146
152
pskb_may_pull (skb , xprth + 2 - skb -> data )) {
147
153
u8 * icmp ;
148
154
149
- xprth = skb_network_header (skb ) + iph -> ihl * 4 ;
155
+ xprth = skb_network_header (skb ) + ihl * 4 ;
150
156
icmp = xprth ;
151
157
152
158
fl4 -> fl4_icmp_type = icmp [0 ];
@@ -159,7 +165,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
159
165
pskb_may_pull (skb , xprth + 4 - skb -> data )) {
160
166
__be32 * ehdr ;
161
167
162
- xprth = skb_network_header (skb ) + iph -> ihl * 4 ;
168
+ xprth = skb_network_header (skb ) + ihl * 4 ;
163
169
ehdr = (__be32 * )xprth ;
164
170
165
171
fl4 -> fl4_ipsec_spi = ehdr [0 ];
@@ -171,7 +177,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
171
177
pskb_may_pull (skb , xprth + 8 - skb -> data )) {
172
178
__be32 * ah_hdr ;
173
179
174
- xprth = skb_network_header (skb ) + iph -> ihl * 4 ;
180
+ xprth = skb_network_header (skb ) + ihl * 4 ;
175
181
ah_hdr = (__be32 * )xprth ;
176
182
177
183
fl4 -> fl4_ipsec_spi = ah_hdr [1 ];
@@ -183,7 +189,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
183
189
pskb_may_pull (skb , xprth + 4 - skb -> data )) {
184
190
__be16 * ipcomp_hdr ;
185
191
186
- xprth = skb_network_header (skb ) + iph -> ihl * 4 ;
192
+ xprth = skb_network_header (skb ) + ihl * 4 ;
187
193
ipcomp_hdr = (__be16 * )xprth ;
188
194
189
195
fl4 -> fl4_ipsec_spi = htonl (ntohs (ipcomp_hdr [1 ]));
@@ -196,7 +202,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
196
202
__be16 * greflags ;
197
203
__be32 * gre_hdr ;
198
204
199
- xprth = skb_network_header (skb ) + iph -> ihl * 4 ;
205
+ xprth = skb_network_header (skb ) + ihl * 4 ;
200
206
greflags = (__be16 * )xprth ;
201
207
gre_hdr = (__be32 * )xprth ;
202
208
@@ -213,10 +219,6 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
213
219
break ;
214
220
}
215
221
}
216
- fl4 -> flowi4_proto = iph -> protocol ;
217
- fl4 -> daddr = reverse ? iph -> saddr : iph -> daddr ;
218
- fl4 -> saddr = reverse ? iph -> daddr : iph -> saddr ;
219
- fl4 -> flowi4_tos = iph -> tos ;
220
222
}
221
223
222
224
static void xfrm4_update_pmtu (struct dst_entry * dst , struct sock * sk ,
0 commit comments