@@ -132,6 +132,17 @@ struct xfrm_state_offload {
132
132
u8 flags ;
133
133
};
134
134
135
+ struct xfrm_mode {
136
+ u8 encap ;
137
+ u8 family ;
138
+ u8 flags ;
139
+ };
140
+
141
+ /* Flags for xfrm_mode. */
142
+ enum {
143
+ XFRM_MODE_FLAG_TUNNEL = 1 ,
144
+ };
145
+
135
146
/* Full description of state of transformer. */
136
147
struct xfrm_state {
137
148
possible_net_t xs_net ;
@@ -234,9 +245,9 @@ struct xfrm_state {
234
245
/* Reference to data common to all the instances of this
235
246
* transformer. */
236
247
const struct xfrm_type * type ;
237
- struct xfrm_mode * inner_mode ;
238
- struct xfrm_mode * inner_mode_iaf ;
239
- struct xfrm_mode * outer_mode ;
248
+ struct xfrm_mode inner_mode ;
249
+ struct xfrm_mode inner_mode_iaf ;
250
+ struct xfrm_mode outer_mode ;
240
251
241
252
const struct xfrm_type_offload * type_offload ;
242
253
@@ -315,13 +326,6 @@ struct xfrm_policy_afinfo {
315
326
xfrm_address_t * saddr ,
316
327
xfrm_address_t * daddr ,
317
328
u32 mark );
318
- void (* decode_session )(struct sk_buff * skb ,
319
- struct flowi * fl ,
320
- int reverse );
321
- int (* get_tos )(const struct flowi * fl );
322
- int (* init_path )(struct xfrm_dst * path ,
323
- struct dst_entry * dst ,
324
- int nfheader_len );
325
329
int (* fill_dst )(struct xfrm_dst * xdst ,
326
330
struct net_device * dev ,
327
331
const struct flowi * fl );
@@ -347,7 +351,6 @@ struct xfrm_state_afinfo {
347
351
struct module * owner ;
348
352
const struct xfrm_type * type_map [IPPROTO_MAX ];
349
353
const struct xfrm_type_offload * type_offload_map [IPPROTO_MAX ];
350
- struct xfrm_mode * mode_map [XFRM_MODE_MAX ];
351
354
352
355
int (* init_flags )(struct xfrm_state * x );
353
356
void (* init_tempsel )(struct xfrm_selector * sel ,
@@ -422,78 +425,6 @@ struct xfrm_type_offload {
422
425
int xfrm_register_type_offload (const struct xfrm_type_offload * type , unsigned short family );
423
426
int xfrm_unregister_type_offload (const struct xfrm_type_offload * type , unsigned short family );
424
427
425
- struct xfrm_mode {
426
- /*
427
- * Remove encapsulation header.
428
- *
429
- * The IP header will be moved over the top of the encapsulation
430
- * header.
431
- *
432
- * On entry, the transport header shall point to where the IP header
433
- * should be and the network header shall be set to where the IP
434
- * header currently is. skb->data shall point to the start of the
435
- * payload.
436
- */
437
- int (* input2 )(struct xfrm_state * x , struct sk_buff * skb );
438
-
439
- /*
440
- * This is the actual input entry point.
441
- *
442
- * For transport mode and equivalent this would be identical to
443
- * input2 (which does not need to be set). While tunnel mode
444
- * and equivalent would set this to the tunnel encapsulation function
445
- * xfrm4_prepare_input that would in turn call input2.
446
- */
447
- int (* input )(struct xfrm_state * x , struct sk_buff * skb );
448
-
449
- /*
450
- * Add encapsulation header.
451
- *
452
- * On exit, the transport header will be set to the start of the
453
- * encapsulation header to be filled in by x->type->output and
454
- * the mac header will be set to the nextheader (protocol for
455
- * IPv4) field of the extension header directly preceding the
456
- * encapsulation header, or in its absence, that of the top IP
457
- * header. The value of the network header will always point
458
- * to the top IP header while skb->data will point to the payload.
459
- */
460
- int (* output2 )(struct xfrm_state * x ,struct sk_buff * skb );
461
-
462
- /*
463
- * This is the actual output entry point.
464
- *
465
- * For transport mode and equivalent this would be identical to
466
- * output2 (which does not need to be set). While tunnel mode
467
- * and equivalent would set this to a tunnel encapsulation function
468
- * (xfrm4_prepare_output or xfrm6_prepare_output) that would in turn
469
- * call output2.
470
- */
471
- int (* output )(struct xfrm_state * x , struct sk_buff * skb );
472
-
473
- /*
474
- * Adjust pointers into the packet and do GSO segmentation.
475
- */
476
- struct sk_buff * (* gso_segment )(struct xfrm_state * x , struct sk_buff * skb , netdev_features_t features );
477
-
478
- /*
479
- * Adjust pointers into the packet when IPsec is done at layer2.
480
- */
481
- void (* xmit )(struct xfrm_state * x , struct sk_buff * skb );
482
-
483
- struct xfrm_state_afinfo * afinfo ;
484
- struct module * owner ;
485
- unsigned int encap ;
486
- int flags ;
487
- };
488
-
489
- /* Flags for xfrm_mode. */
490
- enum {
491
- XFRM_MODE_FLAG_TUNNEL = 1 ,
492
- };
493
-
494
- int xfrm_register_mode (struct xfrm_mode * mode , int family );
495
- int xfrm_unregister_mode (struct xfrm_mode * mode , int family );
496
-
497
428
static inline int xfrm_af2proto (unsigned int family )
498
429
{
499
430
switch (family ) {
@@ -506,13 +437,13 @@ static inline int xfrm_af2proto(unsigned int family)
506
437
}
507
438
}
508
439
509
- static inline struct xfrm_mode * xfrm_ip2inner_mode (struct xfrm_state * x , int ipproto )
440
+ static inline const struct xfrm_mode * xfrm_ip2inner_mode (struct xfrm_state * x , int ipproto )
510
441
{
511
442
if ((ipproto == IPPROTO_IPIP && x -> props .family == AF_INET ) ||
512
443
(ipproto == IPPROTO_IPV6 && x -> props .family == AF_INET6 ))
513
- return x -> inner_mode ;
444
+ return & x -> inner_mode ;
514
445
else
515
- return x -> inner_mode_iaf ;
446
+ return & x -> inner_mode_iaf ;
516
447
}
517
448
518
449
struct xfrm_tmpl {
@@ -1605,15 +1536,18 @@ int xfrm_init_replay(struct xfrm_state *x);
1605
1536
int xfrm_state_mtu (struct xfrm_state * x , int mtu );
1606
1537
int __xfrm_init_state (struct xfrm_state * x , bool init_replay , bool offload );
1607
1538
int xfrm_init_state (struct xfrm_state * x );
1608
- int xfrm_prepare_input (struct xfrm_state * x , struct sk_buff * skb );
1609
1539
int xfrm_input (struct sk_buff * skb , int nexthdr , __be32 spi , int encap_type );
1610
1540
int xfrm_input_resume (struct sk_buff * skb , int nexthdr );
1611
1541
int xfrm_trans_queue (struct sk_buff * skb ,
1612
1542
int (* finish )(struct net * , struct sock * ,
1613
1543
struct sk_buff * ));
1614
1544
int xfrm_output_resume (struct sk_buff * skb , int err );
1615
1545
int xfrm_output (struct sock * sk , struct sk_buff * skb );
1616
- int xfrm_inner_extract_output (struct xfrm_state * x , struct sk_buff * skb );
1546
+
1547
+ #if IS_ENABLED (CONFIG_NET_PKTGEN )
1548
+ int pktgen_xfrm_outer_mode_output (struct xfrm_state * x , struct sk_buff * skb );
1549
+ #endif
1550
+
1617
1551
void xfrm_local_error (struct sk_buff * skb , int mtu );
1618
1552
int xfrm4_extract_header (struct sk_buff * skb );
1619
1553
int xfrm4_extract_input (struct xfrm_state * x , struct sk_buff * skb );
@@ -1632,10 +1566,8 @@ static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
1632
1566
}
1633
1567
1634
1568
int xfrm4_extract_output (struct xfrm_state * x , struct sk_buff * skb );
1635
- int xfrm4_prepare_output (struct xfrm_state * x , struct sk_buff * skb );
1636
1569
int xfrm4_output (struct net * net , struct sock * sk , struct sk_buff * skb );
1637
1570
int xfrm4_output_finish (struct sock * sk , struct sk_buff * skb );
1638
- int xfrm4_rcv_cb (struct sk_buff * skb , u8 protocol , int err );
1639
1571
int xfrm4_protocol_register (struct xfrm4_protocol * handler , unsigned char protocol );
1640
1572
int xfrm4_protocol_deregister (struct xfrm4_protocol * handler , unsigned char protocol );
1641
1573
int xfrm4_tunnel_register (struct xfrm_tunnel * handler , unsigned short family );
@@ -1651,15 +1583,13 @@ int xfrm6_rcv(struct sk_buff *skb);
1651
1583
int xfrm6_input_addr (struct sk_buff * skb , xfrm_address_t * daddr ,
1652
1584
xfrm_address_t * saddr , u8 proto );
1653
1585
void xfrm6_local_error (struct sk_buff * skb , u32 mtu );
1654
- int xfrm6_rcv_cb (struct sk_buff * skb , u8 protocol , int err );
1655
1586
int xfrm6_protocol_register (struct xfrm6_protocol * handler , unsigned char protocol );
1656
1587
int xfrm6_protocol_deregister (struct xfrm6_protocol * handler , unsigned char protocol );
1657
1588
int xfrm6_tunnel_register (struct xfrm6_tunnel * handler , unsigned short family );
1658
1589
int xfrm6_tunnel_deregister (struct xfrm6_tunnel * handler , unsigned short family );
1659
1590
__be32 xfrm6_tunnel_alloc_spi (struct net * net , xfrm_address_t * saddr );
1660
1591
__be32 xfrm6_tunnel_spi_lookup (struct net * net , const xfrm_address_t * saddr );
1661
1592
int xfrm6_extract_output (struct xfrm_state * x , struct sk_buff * skb );
1662
- int xfrm6_prepare_output (struct xfrm_state * x , struct sk_buff * skb );
1663
1593
int xfrm6_output (struct net * net , struct sock * sk , struct sk_buff * skb );
1664
1594
int xfrm6_output_finish (struct sock * sk , struct sk_buff * skb );
1665
1595
int xfrm6_find_1stfragopt (struct xfrm_state * x , struct sk_buff * skb ,
@@ -2051,7 +1981,7 @@ static inline int xfrm_tunnel_check(struct sk_buff *skb, struct xfrm_state *x,
2051
1981
tunnel = true;
2052
1982
break ;
2053
1983
}
2054
- if (tunnel && !(x -> outer_mode -> flags & XFRM_MODE_FLAG_TUNNEL ))
1984
+ if (tunnel && !(x -> outer_mode . flags & XFRM_MODE_FLAG_TUNNEL ))
2055
1985
return - EINVAL ;
2056
1986
2057
1987
return 0 ;
0 commit comments