@@ -249,29 +249,25 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
249
249
const struct ipv6_pinfo * np = inet6_sk (sk );
250
250
struct in6_addr * first_hop = & fl6 -> daddr ;
251
251
struct dst_entry * dst = skb_dst (skb );
252
+ struct net_device * dev = dst -> dev ;
253
+ struct inet6_dev * idev = ip6_dst_idev (dst );
252
254
unsigned int head_room ;
253
255
struct ipv6hdr * hdr ;
254
256
u8 proto = fl6 -> flowi6_proto ;
255
257
int seg_len = skb -> len ;
256
258
int hlimit = -1 ;
257
259
u32 mtu ;
258
260
259
- head_room = sizeof (struct ipv6hdr ) + LL_RESERVED_SPACE (dst -> dev );
261
+ head_room = sizeof (struct ipv6hdr ) + LL_RESERVED_SPACE (dev );
260
262
if (opt )
261
263
head_room += opt -> opt_nflen + opt -> opt_flen ;
262
264
263
- if (unlikely (skb_headroom (skb ) < head_room )) {
264
- struct sk_buff * skb2 = skb_realloc_headroom (skb , head_room );
265
- if (!skb2 ) {
266
- IP6_INC_STATS (net , ip6_dst_idev (skb_dst (skb )),
267
- IPSTATS_MIB_OUTDISCARDS );
268
- kfree_skb (skb );
265
+ if (unlikely (head_room > skb_headroom (skb ))) {
266
+ skb = skb_expand_head (skb , head_room );
267
+ if (!skb ) {
268
+ IP6_INC_STATS (net , idev , IPSTATS_MIB_OUTDISCARDS );
269
269
return - ENOBUFS ;
270
270
}
271
- if (skb -> sk )
272
- skb_set_owner_w (skb2 , skb -> sk );
273
- consume_skb (skb );
274
- skb = skb2 ;
275
271
}
276
272
277
273
if (opt ) {
@@ -313,8 +309,7 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
313
309
314
310
mtu = dst_mtu (dst );
315
311
if ((skb -> len <= mtu ) || skb -> ignore_df || skb_is_gso (skb )) {
316
- IP6_UPD_PO_STATS (net , ip6_dst_idev (skb_dst (skb )),
317
- IPSTATS_MIB_OUT , skb -> len );
312
+ IP6_UPD_PO_STATS (net , idev , IPSTATS_MIB_OUT , skb -> len );
318
313
319
314
/* if egress device is enslaved to an L3 master device pass the
320
315
* skb to its handler for processing
@@ -327,17 +322,17 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
327
322
* we promote our socket to non const
328
323
*/
329
324
return NF_HOOK (NFPROTO_IPV6 , NF_INET_LOCAL_OUT ,
330
- net , (struct sock * )sk , skb , NULL , dst -> dev ,
325
+ net , (struct sock * )sk , skb , NULL , dev ,
331
326
dst_output );
332
327
}
333
328
334
- skb -> dev = dst -> dev ;
329
+ skb -> dev = dev ;
335
330
/* ipv6_local_error() does not require socket lock,
336
331
* we promote our socket to non const
337
332
*/
338
333
ipv6_local_error ((struct sock * )sk , EMSGSIZE , fl6 , mtu );
339
334
340
- IP6_INC_STATS (net , ip6_dst_idev ( skb_dst ( skb )) , IPSTATS_MIB_FRAGFAILS );
335
+ IP6_INC_STATS (net , idev , IPSTATS_MIB_FRAGFAILS );
341
336
kfree_skb (skb );
342
337
return - EMSGSIZE ;
343
338
}
0 commit comments