hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/include/net/xfrm.h
....@@ -15,6 +15,7 @@
1515 #include <linux/audit.h>
1616 #include <linux/slab.h>
1717 #include <linux/refcount.h>
18
+#include <linux/sockptr.h>
1819
1920 #include <net/sock.h>
2021 #include <net/dst.h>
....@@ -127,9 +128,21 @@
127128
128129 struct xfrm_state_offload {
129130 struct net_device *dev;
131
+ struct net_device *real_dev;
130132 unsigned long offload_handle;
131133 unsigned int num_exthdrs;
132134 u8 flags;
135
+};
136
+
137
+struct xfrm_mode {
138
+ u8 encap;
139
+ u8 family;
140
+ u8 flags;
141
+};
142
+
143
+/* Flags for xfrm_mode. */
144
+enum {
145
+ XFRM_MODE_FLAG_TUNNEL = 1,
133146 };
134147
135148 /* Full description of state of transformer. */
....@@ -182,6 +195,7 @@
182195
183196 /* Data for encapsulator */
184197 struct xfrm_encap_tmpl *encap;
198
+ struct sock __rcu *encap_sk;
185199
186200 /* Data for care-of address */
187201 xfrm_address_t *coaddr;
....@@ -219,7 +233,7 @@
219233 struct xfrm_stats stats;
220234
221235 struct xfrm_lifetime_cur curlft;
222
- struct tasklet_hrtimer mtimer;
236
+ struct hrtimer mtimer;
223237
224238 struct xfrm_state_offload xso;
225239
....@@ -234,9 +248,9 @@
234248 /* Reference to data common to all the instances of this
235249 * transformer. */
236250 const struct xfrm_type *type;
237
- struct xfrm_mode *inner_mode;
238
- struct xfrm_mode *inner_mode_iaf;
239
- struct xfrm_mode *outer_mode;
251
+ struct xfrm_mode inner_mode;
252
+ struct xfrm_mode inner_mode_iaf;
253
+ struct xfrm_mode outer_mode;
240254
241255 const struct xfrm_type_offload *type_offload;
242256
....@@ -316,13 +330,6 @@
316330 xfrm_address_t *saddr,
317331 xfrm_address_t *daddr,
318332 u32 mark);
319
- void (*decode_session)(struct sk_buff *skb,
320
- struct flowi *fl,
321
- int reverse);
322
- int (*get_tos)(const struct flowi *fl);
323
- int (*init_path)(struct xfrm_dst *path,
324
- struct dst_entry *dst,
325
- int nfheader_len);
326333 int (*fill_dst)(struct xfrm_dst *xdst,
327334 struct net_device *dev,
328335 const struct flowi *fl);
....@@ -342,29 +349,20 @@
342349 int __xfrm_state_delete(struct xfrm_state *x);
343350
344351 struct xfrm_state_afinfo {
345
- unsigned int family;
346
- unsigned int proto;
347
- __be16 eth_proto;
348
- struct module *owner;
349
- const struct xfrm_type *type_map[IPPROTO_MAX];
350
- const struct xfrm_type_offload *type_offload_map[IPPROTO_MAX];
351
- struct xfrm_mode *mode_map[XFRM_MODE_MAX];
352
+ u8 family;
353
+ u8 proto;
352354
353
- int (*init_flags)(struct xfrm_state *x);
354
- void (*init_tempsel)(struct xfrm_selector *sel,
355
- const struct flowi *fl);
356
- void (*init_temprop)(struct xfrm_state *x,
357
- const struct xfrm_tmpl *tmpl,
358
- const xfrm_address_t *daddr,
359
- const xfrm_address_t *saddr);
360
- int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n);
361
- int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n);
355
+ const struct xfrm_type_offload *type_offload_esp;
356
+
357
+ const struct xfrm_type *type_esp;
358
+ const struct xfrm_type *type_ipip;
359
+ const struct xfrm_type *type_ipip6;
360
+ const struct xfrm_type *type_comp;
361
+ const struct xfrm_type *type_ah;
362
+ const struct xfrm_type *type_routing;
363
+ const struct xfrm_type *type_dstopts;
364
+
362365 int (*output)(struct net *net, struct sock *sk, struct sk_buff *skb);
363
- int (*output_finish)(struct sock *sk, struct sk_buff *skb);
364
- int (*extract_input)(struct xfrm_state *x,
365
- struct sk_buff *skb);
366
- int (*extract_output)(struct xfrm_state *x,
367
- struct sk_buff *skb);
368366 int (*transport_finish)(struct sk_buff *skb,
369367 int async);
370368 void (*local_error)(struct sk_buff *skb, u32 mtu);
....@@ -376,7 +374,8 @@
376374 struct xfrm_state_afinfo *xfrm_state_afinfo_get_rcu(unsigned int family);
377375
378376 struct xfrm_input_afinfo {
379
- unsigned int family;
377
+ u8 family;
378
+ bool is_ipip;
380379 int (*callback)(struct sk_buff *skb, u8 protocol,
381380 int err);
382381 };
....@@ -404,12 +403,10 @@
404403 int (*reject)(struct xfrm_state *, struct sk_buff *,
405404 const struct flowi *);
406405 int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **);
407
- /* Estimate maximal size of result of transformation of a dgram */
408
- u32 (*get_mtu)(struct xfrm_state *, int size);
409406 };
410407
411408 int xfrm_register_type(const struct xfrm_type *type, unsigned short family);
412
-int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family);
409
+void xfrm_unregister_type(const struct xfrm_type *type, unsigned short family);
413410
414411 struct xfrm_type_offload {
415412 char *description;
....@@ -421,79 +418,7 @@
421418 };
422419
423420 int xfrm_register_type_offload(const struct xfrm_type_offload *type, unsigned short family);
424
-int xfrm_unregister_type_offload(const struct xfrm_type_offload *type, unsigned short family);
425
-
426
-struct xfrm_mode {
427
- /*
428
- * Remove encapsulation header.
429
- *
430
- * The IP header will be moved over the top of the encapsulation
431
- * header.
432
- *
433
- * On entry, the transport header shall point to where the IP header
434
- * should be and the network header shall be set to where the IP
435
- * header currently is. skb->data shall point to the start of the
436
- * payload.
437
- */
438
- int (*input2)(struct xfrm_state *x, struct sk_buff *skb);
439
-
440
- /*
441
- * This is the actual input entry point.
442
- *
443
- * For transport mode and equivalent this would be identical to
444
- * input2 (which does not need to be set). While tunnel mode
445
- * and equivalent would set this to the tunnel encapsulation function
446
- * xfrm4_prepare_input that would in turn call input2.
447
- */
448
- int (*input)(struct xfrm_state *x, struct sk_buff *skb);
449
-
450
- /*
451
- * Add encapsulation header.
452
- *
453
- * On exit, the transport header will be set to the start of the
454
- * encapsulation header to be filled in by x->type->output and
455
- * the mac header will be set to the nextheader (protocol for
456
- * IPv4) field of the extension header directly preceding the
457
- * encapsulation header, or in its absence, that of the top IP
458
- * header. The value of the network header will always point
459
- * to the top IP header while skb->data will point to the payload.
460
- */
461
- int (*output2)(struct xfrm_state *x,struct sk_buff *skb);
462
-
463
- /*
464
- * This is the actual output entry point.
465
- *
466
- * For transport mode and equivalent this would be identical to
467
- * output2 (which does not need to be set). While tunnel mode
468
- * and equivalent would set this to a tunnel encapsulation function
469
- * (xfrm4_prepare_output or xfrm6_prepare_output) that would in turn
470
- * call output2.
471
- */
472
- int (*output)(struct xfrm_state *x, struct sk_buff *skb);
473
-
474
- /*
475
- * Adjust pointers into the packet and do GSO segmentation.
476
- */
477
- struct sk_buff *(*gso_segment)(struct xfrm_state *x, struct sk_buff *skb, netdev_features_t features);
478
-
479
- /*
480
- * Adjust pointers into the packet when IPsec is done at layer2.
481
- */
482
- void (*xmit)(struct xfrm_state *x, struct sk_buff *skb);
483
-
484
- struct xfrm_state_afinfo *afinfo;
485
- struct module *owner;
486
- unsigned int encap;
487
- int flags;
488
-};
489
-
490
-/* Flags for xfrm_mode. */
491
-enum {
492
- XFRM_MODE_FLAG_TUNNEL = 1,
493
-};
494
-
495
-int xfrm_register_mode(struct xfrm_mode *mode, int family);
496
-int xfrm_unregister_mode(struct xfrm_mode *mode, int family);
421
+void xfrm_unregister_type_offload(const struct xfrm_type_offload *type, unsigned short family);
497422
498423 static inline int xfrm_af2proto(unsigned int family)
499424 {
....@@ -507,13 +432,13 @@
507432 }
508433 }
509434
510
-static inline struct xfrm_mode *xfrm_ip2inner_mode(struct xfrm_state *x, int ipproto)
435
+static inline const struct xfrm_mode *xfrm_ip2inner_mode(struct xfrm_state *x, int ipproto)
511436 {
512437 if ((ipproto == IPPROTO_IPIP && x->props.family == AF_INET) ||
513438 (ipproto == IPPROTO_IPV6 && x->props.family == AF_INET6))
514
- return x->inner_mode;
439
+ return &x->inner_mode;
515440 else
516
- return x->inner_mode_iaf;
441
+ return &x->inner_mode_iaf;
517442 }
518443
519444 struct xfrm_tmpl {
....@@ -578,6 +503,7 @@
578503 /* This lock only affects elements except for entry. */
579504 rwlock_t lock;
580505 refcount_t refcnt;
506
+ u32 pos;
581507 struct timer_list timer;
582508
583509 atomic_t genid;
....@@ -590,6 +516,7 @@
590516 struct xfrm_lifetime_cur curlft;
591517 struct xfrm_policy_walk_entry walk;
592518 struct xfrm_policy_queue polq;
519
+ bool bydst_reinsert;
593520 u8 type;
594521 u8 action;
595522 u8 flags;
....@@ -597,6 +524,7 @@
597524 u16 family;
598525 struct xfrm_sec_ctx *security;
599526 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
527
+ struct hlist_node bydst_inexact_list;
600528 struct rcu_head rcu;
601529 };
602530
....@@ -1099,49 +1027,21 @@
10991027 };
11001028
11011029 struct sec_path {
1102
- refcount_t refcnt;
11031030 int len;
11041031 int olen;
1032
+ int verified_cnt;
11051033
11061034 struct xfrm_state *xvec[XFRM_MAX_DEPTH];
11071035 struct xfrm_offload ovec[XFRM_MAX_OFFLOAD_DEPTH];
11081036 };
11091037
1110
-static inline int secpath_exists(struct sk_buff *skb)
1111
-{
1112
-#ifdef CONFIG_XFRM
1113
- return skb->sp != NULL;
1114
-#else
1115
- return 0;
1116
-#endif
1117
-}
1118
-
1119
-static inline struct sec_path *
1120
-secpath_get(struct sec_path *sp)
1121
-{
1122
- if (sp)
1123
- refcount_inc(&sp->refcnt);
1124
- return sp;
1125
-}
1126
-
1127
-void __secpath_destroy(struct sec_path *sp);
1128
-
1129
-static inline void
1130
-secpath_put(struct sec_path *sp)
1131
-{
1132
- if (sp && refcount_dec_and_test(&sp->refcnt))
1133
- __secpath_destroy(sp);
1134
-}
1135
-
1136
-struct sec_path *secpath_dup(struct sec_path *src);
1137
-int secpath_set(struct sk_buff *skb);
1038
+struct sec_path *secpath_set(struct sk_buff *skb);
11381039
11391040 static inline void
11401041 secpath_reset(struct sk_buff *skb)
11411042 {
11421043 #ifdef CONFIG_XFRM
1143
- secpath_put(skb->sp);
1144
- skb->sp = NULL;
1044
+ skb_ext_del(skb, SKB_EXT_SEC_PATH);
11451045 #endif
11461046 }
11471047
....@@ -1197,8 +1097,8 @@
11971097 if (sk && sk->sk_policy[XFRM_POLICY_IN])
11981098 return __xfrm_policy_check(sk, ndir, skb, family);
11991099
1200
- return (!net->xfrm.policy_count[dir] && !skb->sp) ||
1201
- (skb_dst(skb)->flags & DST_NOPOLICY) ||
1100
+ return (!net->xfrm.policy_count[dir] && !secpath_exists(skb)) ||
1101
+ (skb_dst(skb) && (skb_dst(skb)->flags & DST_NOPOLICY)) ||
12021102 __xfrm_policy_check(sk, ndir, skb, family);
12031103 }
12041104
....@@ -1506,6 +1406,8 @@
15061406
15071407 struct xfrm6_protocol {
15081408 int (*handler)(struct sk_buff *skb);
1409
+ int (*input_handler)(struct sk_buff *skb, int nexthdr, __be32 spi,
1410
+ int encap_type);
15091411 int (*cb_handler)(struct sk_buff *skb, int err);
15101412 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
15111413 u8 type, u8 code, int offset, __be32 info);
....@@ -1517,6 +1419,7 @@
15171419 /* XFRM tunnel handlers. */
15181420 struct xfrm_tunnel {
15191421 int (*handler)(struct sk_buff *skb);
1422
+ int (*cb_handler)(struct sk_buff *skb, int err);
15201423 int (*err_handler)(struct sk_buff *skb, u32 info);
15211424
15221425 struct xfrm_tunnel __rcu *next;
....@@ -1525,6 +1428,7 @@
15251428
15261429 struct xfrm6_tunnel {
15271430 int (*handler)(struct sk_buff *skb);
1431
+ int (*cb_handler)(struct sk_buff *skb, int err);
15281432 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
15291433 u8 type, u8 code, int offset, __be32 info);
15301434 struct xfrm6_tunnel __rcu *next;
....@@ -1602,21 +1506,19 @@
16021506 u8 proto,
16031507 unsigned short family);
16041508 #ifdef CONFIG_XFRM_SUB_POLICY
1605
-int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n,
1606
- unsigned short family, struct net *net);
1607
-int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n,
1509
+void xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n,
16081510 unsigned short family);
1511
+void xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n,
1512
+ unsigned short family);
16091513 #else
1610
-static inline int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
1611
- int n, unsigned short family, struct net *net)
1612
-{
1613
- return -ENOSYS;
1614
-}
1615
-
1616
-static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src,
1514
+static inline void xfrm_tmpl_sort(struct xfrm_tmpl **d, struct xfrm_tmpl **s,
16171515 int n, unsigned short family)
16181516 {
1619
- return -ENOSYS;
1517
+}
1518
+
1519
+static inline void xfrm_state_sort(struct xfrm_state **d, struct xfrm_state **s,
1520
+ int n, unsigned short family)
1521
+{
16201522 }
16211523 #endif
16221524
....@@ -1645,20 +1547,23 @@
16451547 void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
16461548 u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq);
16471549 int xfrm_init_replay(struct xfrm_state *x);
1648
-int xfrm_state_mtu(struct xfrm_state *x, int mtu);
1550
+u32 xfrm_state_mtu(struct xfrm_state *x, int mtu);
16491551 int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload);
16501552 int xfrm_init_state(struct xfrm_state *x);
1651
-int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb);
16521553 int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type);
16531554 int xfrm_input_resume(struct sk_buff *skb, int nexthdr);
1555
+int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb,
1556
+ int (*finish)(struct net *, struct sock *,
1557
+ struct sk_buff *));
16541558 int xfrm_trans_queue(struct sk_buff *skb,
16551559 int (*finish)(struct net *, struct sock *,
16561560 struct sk_buff *));
16571561 int xfrm_output_resume(struct sk_buff *skb, int err);
16581562 int xfrm_output(struct sock *sk, struct sk_buff *skb);
1659
-int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1563
+
1564
+int pktgen_xfrm_outer_mode_output(struct xfrm_state *x, struct sk_buff *skb);
1565
+
16601566 void xfrm_local_error(struct sk_buff *skb, int mtu);
1661
-int xfrm4_extract_header(struct sk_buff *skb);
16621567 int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb);
16631568 int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
16641569 int encap_type);
....@@ -1674,55 +1579,46 @@
16741579 return xfrm_input(skb, nexthdr, spi, 0);
16751580 }
16761581
1677
-int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1678
-int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
16791582 int xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb);
16801583 int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb);
1681
-int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
16821584 int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol);
16831585 int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol);
16841586 int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
16851587 int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
16861588 void xfrm4_local_error(struct sk_buff *skb, u32 mtu);
1687
-int xfrm6_extract_header(struct sk_buff *skb);
16881589 int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
16891590 int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi,
16901591 struct ip6_tnl *t);
1592
+int xfrm6_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
1593
+ int encap_type);
16911594 int xfrm6_transport_finish(struct sk_buff *skb, int async);
16921595 int xfrm6_rcv_tnl(struct sk_buff *skb, struct ip6_tnl *t);
16931596 int xfrm6_rcv(struct sk_buff *skb);
16941597 int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
16951598 xfrm_address_t *saddr, u8 proto);
16961599 void xfrm6_local_error(struct sk_buff *skb, u32 mtu);
1697
-int xfrm6_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
16981600 int xfrm6_protocol_register(struct xfrm6_protocol *handler, unsigned char protocol);
16991601 int xfrm6_protocol_deregister(struct xfrm6_protocol *handler, unsigned char protocol);
17001602 int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
17011603 int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
17021604 __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
17031605 __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr);
1704
-int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1705
-int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
17061606 int xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb);
17071607 int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb);
17081608 int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
17091609 u8 **prevhdr);
17101610
17111611 #ifdef CONFIG_XFRM
1612
+void xfrm6_local_rxpmtu(struct sk_buff *skb, u32 mtu);
17121613 int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb);
1713
-int xfrm_user_policy(struct sock *sk, int optname,
1714
- u8 __user *optval, int optlen);
1614
+int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb);
1615
+int xfrm_user_policy(struct sock *sk, int optname, sockptr_t optval,
1616
+ int optlen);
17151617 #else
1716
-static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen)
1618
+static inline int xfrm_user_policy(struct sock *sk, int optname,
1619
+ sockptr_t optval, int optlen)
17171620 {
17181621 return -ENOPROTOOPT;
1719
-}
1720
-
1721
-static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
1722
-{
1723
- /* should not happen */
1724
- kfree_skb(skb);
1725
- return 0;
17261622 }
17271623 #endif
17281624
....@@ -1739,13 +1635,16 @@
17391635 void *);
17401636 void xfrm_policy_walk_done(struct xfrm_policy_walk *walk, struct net *net);
17411637 int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1742
-struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark, u32 if_id,
1743
- u8 type, int dir,
1638
+struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net,
1639
+ const struct xfrm_mark *mark,
1640
+ u32 if_id, u8 type, int dir,
17441641 struct xfrm_selector *sel,
17451642 struct xfrm_sec_ctx *ctx, int delete,
17461643 int *err);
1747
-struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u32 if_id, u8,
1748
- int dir, u32 id, int delete, int *err);
1644
+struct xfrm_policy *xfrm_policy_byid(struct net *net,
1645
+ const struct xfrm_mark *mark, u32 if_id,
1646
+ u8 type, int dir, u32 id, int delete,
1647
+ int *err);
17491648 int xfrm_policy_flush(struct net *net, u8 type, bool task_valid);
17501649 void xfrm_policy_hash_rebuild(struct net *net);
17511650 u32 xfrm_get_acqseq(void);
....@@ -1763,14 +1662,15 @@
17631662 const struct xfrm_migrate *m, int num_bundles,
17641663 const struct xfrm_kmaddress *k,
17651664 const struct xfrm_encap_tmpl *encap);
1766
-struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net);
1665
+struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net,
1666
+ u32 if_id);
17671667 struct xfrm_state *xfrm_state_migrate(struct xfrm_state *x,
17681668 struct xfrm_migrate *m,
17691669 struct xfrm_encap_tmpl *encap);
17701670 int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
17711671 struct xfrm_migrate *m, int num_bundles,
17721672 struct xfrm_kmaddress *k, struct net *net,
1773
- struct xfrm_encap_tmpl *encap);
1673
+ struct xfrm_encap_tmpl *encap, u32 if_id);
17741674 #endif
17751675
17761676 int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
....@@ -1922,14 +1822,16 @@
19221822 #ifdef CONFIG_XFRM
19231823 static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
19241824 {
1925
- return skb->sp->xvec[skb->sp->len - 1];
1825
+ struct sec_path *sp = skb_sec_path(skb);
1826
+
1827
+ return sp->xvec[sp->len - 1];
19261828 }
19271829 #endif
19281830
19291831 static inline struct xfrm_offload *xfrm_offload(struct sk_buff *skb)
19301832 {
19311833 #ifdef CONFIG_XFRM
1932
- struct sec_path *sp = skb->sp;
1834
+ struct sec_path *sp = skb_sec_path(skb);
19331835
19341836 if (!sp || !sp->olen || sp->len != sp->olen)
19351837 return NULL;
....@@ -1987,7 +1889,7 @@
19871889 static inline void xfrm_dev_state_free(struct xfrm_state *x)
19881890 {
19891891 struct xfrm_state_offload *xso = &x->xso;
1990
- struct net_device *dev = xso->dev;
1892
+ struct net_device *dev = xso->dev;
19911893
19921894 if (dev && dev->xfrmdev_ops) {
19931895 if (dev->xfrmdev_ops->xdo_dev_state_free)
....@@ -2088,7 +1990,7 @@
20881990 tunnel = true;
20891991 break;
20901992 }
2091
- if (tunnel && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL))
1993
+ if (tunnel && !(x->outer_mode.flags & XFRM_MODE_FLAG_TUNNEL))
20921994 return -EINVAL;
20931995
20941996 return 0;
....@@ -2127,4 +2029,19 @@
21272029 }
21282030 #endif
21292031
2032
+#if IS_ENABLED(CONFIG_IPV6)
2033
+static inline bool xfrm6_local_dontfrag(const struct sock *sk)
2034
+{
2035
+ int proto;
2036
+
2037
+ if (!sk || sk->sk_family != AF_INET6)
2038
+ return false;
2039
+
2040
+ proto = sk->sk_protocol;
2041
+ if (proto == IPPROTO_UDP || proto == IPPROTO_RAW)
2042
+ return inet6_sk(sk)->dontfrag;
2043
+
2044
+ return false;
2045
+}
2046
+#endif
21302047 #endif /* _NET_XFRM_H */