forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
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,7 +1027,6 @@
10991027 };
11001028
11011029 struct sec_path {
1102
- refcount_t refcnt;
11031030 int len;
11041031 int olen;
11051032
....@@ -1107,41 +1034,13 @@
11071034 struct xfrm_offload ovec[XFRM_MAX_OFFLOAD_DEPTH];
11081035 };
11091036
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);
1037
+struct sec_path *secpath_set(struct sk_buff *skb);
11381038
11391039 static inline void
11401040 secpath_reset(struct sk_buff *skb)
11411041 {
11421042 #ifdef CONFIG_XFRM
1143
- secpath_put(skb->sp);
1144
- skb->sp = NULL;
1043
+ skb_ext_del(skb, SKB_EXT_SEC_PATH);
11451044 #endif
11461045 }
11471046
....@@ -1197,8 +1096,8 @@
11971096 if (sk && sk->sk_policy[XFRM_POLICY_IN])
11981097 return __xfrm_policy_check(sk, ndir, skb, family);
11991098
1200
- return (!net->xfrm.policy_count[dir] && !skb->sp) ||
1201
- (skb_dst(skb)->flags & DST_NOPOLICY) ||
1099
+ return (!net->xfrm.policy_count[dir] && !secpath_exists(skb)) ||
1100
+ (skb_dst(skb) && (skb_dst(skb)->flags & DST_NOPOLICY)) ||
12021101 __xfrm_policy_check(sk, ndir, skb, family);
12031102 }
12041103
....@@ -1506,6 +1405,8 @@
15061405
15071406 struct xfrm6_protocol {
15081407 int (*handler)(struct sk_buff *skb);
1408
+ int (*input_handler)(struct sk_buff *skb, int nexthdr, __be32 spi,
1409
+ int encap_type);
15091410 int (*cb_handler)(struct sk_buff *skb, int err);
15101411 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
15111412 u8 type, u8 code, int offset, __be32 info);
....@@ -1517,6 +1418,7 @@
15171418 /* XFRM tunnel handlers. */
15181419 struct xfrm_tunnel {
15191420 int (*handler)(struct sk_buff *skb);
1421
+ int (*cb_handler)(struct sk_buff *skb, int err);
15201422 int (*err_handler)(struct sk_buff *skb, u32 info);
15211423
15221424 struct xfrm_tunnel __rcu *next;
....@@ -1525,6 +1427,7 @@
15251427
15261428 struct xfrm6_tunnel {
15271429 int (*handler)(struct sk_buff *skb);
1430
+ int (*cb_handler)(struct sk_buff *skb, int err);
15281431 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
15291432 u8 type, u8 code, int offset, __be32 info);
15301433 struct xfrm6_tunnel __rcu *next;
....@@ -1602,21 +1505,19 @@
16021505 u8 proto,
16031506 unsigned short family);
16041507 #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,
1508
+void xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n,
16081509 unsigned short family);
1510
+void xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n,
1511
+ unsigned short family);
16091512 #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,
1513
+static inline void xfrm_tmpl_sort(struct xfrm_tmpl **d, struct xfrm_tmpl **s,
16171514 int n, unsigned short family)
16181515 {
1619
- return -ENOSYS;
1516
+}
1517
+
1518
+static inline void xfrm_state_sort(struct xfrm_state **d, struct xfrm_state **s,
1519
+ int n, unsigned short family)
1520
+{
16201521 }
16211522 #endif
16221523
....@@ -1645,20 +1546,23 @@
16451546 void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
16461547 u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq);
16471548 int xfrm_init_replay(struct xfrm_state *x);
1648
-int xfrm_state_mtu(struct xfrm_state *x, int mtu);
1549
+u32 xfrm_state_mtu(struct xfrm_state *x, int mtu);
16491550 int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload);
16501551 int xfrm_init_state(struct xfrm_state *x);
1651
-int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb);
16521552 int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type);
16531553 int xfrm_input_resume(struct sk_buff *skb, int nexthdr);
1554
+int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb,
1555
+ int (*finish)(struct net *, struct sock *,
1556
+ struct sk_buff *));
16541557 int xfrm_trans_queue(struct sk_buff *skb,
16551558 int (*finish)(struct net *, struct sock *,
16561559 struct sk_buff *));
16571560 int xfrm_output_resume(struct sk_buff *skb, int err);
16581561 int xfrm_output(struct sock *sk, struct sk_buff *skb);
1659
-int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1562
+
1563
+int pktgen_xfrm_outer_mode_output(struct xfrm_state *x, struct sk_buff *skb);
1564
+
16601565 void xfrm_local_error(struct sk_buff *skb, int mtu);
1661
-int xfrm4_extract_header(struct sk_buff *skb);
16621566 int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb);
16631567 int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
16641568 int encap_type);
....@@ -1674,55 +1578,46 @@
16741578 return xfrm_input(skb, nexthdr, spi, 0);
16751579 }
16761580
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);
16791581 int xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb);
16801582 int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb);
1681
-int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
16821583 int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol);
16831584 int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol);
16841585 int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
16851586 int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
16861587 void xfrm4_local_error(struct sk_buff *skb, u32 mtu);
1687
-int xfrm6_extract_header(struct sk_buff *skb);
16881588 int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
16891589 int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi,
16901590 struct ip6_tnl *t);
1591
+int xfrm6_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
1592
+ int encap_type);
16911593 int xfrm6_transport_finish(struct sk_buff *skb, int async);
16921594 int xfrm6_rcv_tnl(struct sk_buff *skb, struct ip6_tnl *t);
16931595 int xfrm6_rcv(struct sk_buff *skb);
16941596 int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
16951597 xfrm_address_t *saddr, u8 proto);
16961598 void xfrm6_local_error(struct sk_buff *skb, u32 mtu);
1697
-int xfrm6_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
16981599 int xfrm6_protocol_register(struct xfrm6_protocol *handler, unsigned char protocol);
16991600 int xfrm6_protocol_deregister(struct xfrm6_protocol *handler, unsigned char protocol);
17001601 int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
17011602 int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
17021603 __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
17031604 __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);
17061605 int xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb);
17071606 int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb);
17081607 int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
17091608 u8 **prevhdr);
17101609
17111610 #ifdef CONFIG_XFRM
1611
+void xfrm6_local_rxpmtu(struct sk_buff *skb, u32 mtu);
17121612 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);
1613
+int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb);
1614
+int xfrm_user_policy(struct sock *sk, int optname, sockptr_t optval,
1615
+ int optlen);
17151616 #else
1716
-static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen)
1617
+static inline int xfrm_user_policy(struct sock *sk, int optname,
1618
+ sockptr_t optval, int optlen)
17171619 {
17181620 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;
17261621 }
17271622 #endif
17281623
....@@ -1739,13 +1634,16 @@
17391634 void *);
17401635 void xfrm_policy_walk_done(struct xfrm_policy_walk *walk, struct net *net);
17411636 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,
1637
+struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net,
1638
+ const struct xfrm_mark *mark,
1639
+ u32 if_id, u8 type, int dir,
17441640 struct xfrm_selector *sel,
17451641 struct xfrm_sec_ctx *ctx, int delete,
17461642 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);
1643
+struct xfrm_policy *xfrm_policy_byid(struct net *net,
1644
+ const struct xfrm_mark *mark, u32 if_id,
1645
+ u8 type, int dir, u32 id, int delete,
1646
+ int *err);
17491647 int xfrm_policy_flush(struct net *net, u8 type, bool task_valid);
17501648 void xfrm_policy_hash_rebuild(struct net *net);
17511649 u32 xfrm_get_acqseq(void);
....@@ -1763,14 +1661,15 @@
17631661 const struct xfrm_migrate *m, int num_bundles,
17641662 const struct xfrm_kmaddress *k,
17651663 const struct xfrm_encap_tmpl *encap);
1766
-struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net);
1664
+struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net,
1665
+ u32 if_id);
17671666 struct xfrm_state *xfrm_state_migrate(struct xfrm_state *x,
17681667 struct xfrm_migrate *m,
17691668 struct xfrm_encap_tmpl *encap);
17701669 int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
17711670 struct xfrm_migrate *m, int num_bundles,
17721671 struct xfrm_kmaddress *k, struct net *net,
1773
- struct xfrm_encap_tmpl *encap);
1672
+ struct xfrm_encap_tmpl *encap, u32 if_id);
17741673 #endif
17751674
17761675 int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
....@@ -1922,14 +1821,16 @@
19221821 #ifdef CONFIG_XFRM
19231822 static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
19241823 {
1925
- return skb->sp->xvec[skb->sp->len - 1];
1824
+ struct sec_path *sp = skb_sec_path(skb);
1825
+
1826
+ return sp->xvec[sp->len - 1];
19261827 }
19271828 #endif
19281829
19291830 static inline struct xfrm_offload *xfrm_offload(struct sk_buff *skb)
19301831 {
19311832 #ifdef CONFIG_XFRM
1932
- struct sec_path *sp = skb->sp;
1833
+ struct sec_path *sp = skb_sec_path(skb);
19331834
19341835 if (!sp || !sp->olen || sp->len != sp->olen)
19351836 return NULL;
....@@ -1987,7 +1888,7 @@
19871888 static inline void xfrm_dev_state_free(struct xfrm_state *x)
19881889 {
19891890 struct xfrm_state_offload *xso = &x->xso;
1990
- struct net_device *dev = xso->dev;
1891
+ struct net_device *dev = xso->dev;
19911892
19921893 if (dev && dev->xfrmdev_ops) {
19931894 if (dev->xfrmdev_ops->xdo_dev_state_free)
....@@ -2088,7 +1989,7 @@
20881989 tunnel = true;
20891990 break;
20901991 }
2091
- if (tunnel && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL))
1992
+ if (tunnel && !(x->outer_mode.flags & XFRM_MODE_FLAG_TUNNEL))
20921993 return -EINVAL;
20931994
20941995 return 0;
....@@ -2127,4 +2028,19 @@
21272028 }
21282029 #endif
21292030
2031
+#if IS_ENABLED(CONFIG_IPV6)
2032
+static inline bool xfrm6_local_dontfrag(const struct sock *sk)
2033
+{
2034
+ int proto;
2035
+
2036
+ if (!sk || sk->sk_family != AF_INET6)
2037
+ return false;
2038
+
2039
+ proto = sk->sk_protocol;
2040
+ if (proto == IPPROTO_UDP || proto == IPPROTO_RAW)
2041
+ return inet6_sk(sk)->dontfrag;
2042
+
2043
+ return false;
2044
+}
2045
+#endif
21302046 #endif /* _NET_XFRM_H */