@@ -118,8 +118,8 @@ static int xfrm_replay_overflow(struct xfrm_state *x, struct sk_buff *skb)
118
118
return err ;
119
119
}
120
120
121
- static int xfrm_replay_check (struct xfrm_state * x ,
122
- struct sk_buff * skb , __be32 net_seq )
121
+ static int xfrm_replay_check_legacy (struct xfrm_state * x ,
122
+ struct sk_buff * skb , __be32 net_seq )
123
123
{
124
124
u32 diff ;
125
125
u32 seq = ntohl (net_seq );
@@ -507,6 +507,21 @@ static int xfrm_replay_check_esn(struct xfrm_state *x,
507
507
return - EINVAL ;
508
508
}
509
509
510
+ int xfrm_replay_check (struct xfrm_state * x ,
511
+ struct sk_buff * skb , __be32 net_seq )
512
+ {
513
+ switch (x -> repl_mode ) {
514
+ case XFRM_REPLAY_MODE_LEGACY :
515
+ break ;
516
+ case XFRM_REPLAY_MODE_BMP :
517
+ return xfrm_replay_check_bmp (x , skb , net_seq );
518
+ case XFRM_REPLAY_MODE_ESN :
519
+ return xfrm_replay_check_esn (x , skb , net_seq );
520
+ }
521
+
522
+ return xfrm_replay_check_legacy (x , skb , net_seq );
523
+ }
524
+
510
525
static int xfrm_replay_recheck_esn (struct xfrm_state * x ,
511
526
struct sk_buff * skb , __be32 net_seq )
512
527
{
@@ -532,7 +547,7 @@ int xfrm_replay_recheck(struct xfrm_state *x,
532
547
return xfrm_replay_recheck_esn (x , skb , net_seq );
533
548
}
534
549
535
- return xfrm_replay_check (x , skb , net_seq );
550
+ return xfrm_replay_check_legacy (x , skb , net_seq );
536
551
}
537
552
538
553
static void xfrm_replay_advance_esn (struct xfrm_state * x , __be32 net_seq )
@@ -723,32 +738,26 @@ static int xfrm_replay_overflow_offload_esn(struct xfrm_state *x, struct sk_buff
723
738
}
724
739
725
740
static const struct xfrm_replay xfrm_replay_legacy = {
726
- .check = xfrm_replay_check ,
727
741
.overflow = xfrm_replay_overflow_offload ,
728
742
};
729
743
730
744
static const struct xfrm_replay xfrm_replay_bmp = {
731
- .check = xfrm_replay_check_bmp ,
732
745
.overflow = xfrm_replay_overflow_offload_bmp ,
733
746
};
734
747
735
748
static const struct xfrm_replay xfrm_replay_esn = {
736
- .check = xfrm_replay_check_esn ,
737
749
.overflow = xfrm_replay_overflow_offload_esn ,
738
750
};
739
751
#else
740
752
static const struct xfrm_replay xfrm_replay_legacy = {
741
- .check = xfrm_replay_check ,
742
753
.overflow = xfrm_replay_overflow ,
743
754
};
744
755
745
756
static const struct xfrm_replay xfrm_replay_bmp = {
746
- .check = xfrm_replay_check_bmp ,
747
757
.overflow = xfrm_replay_overflow_bmp ,
748
758
};
749
759
750
760
static const struct xfrm_replay xfrm_replay_esn = {
751
- .check = xfrm_replay_check_esn ,
752
761
.overflow = xfrm_replay_overflow_esn ,
753
762
};
754
763
#endif
0 commit comments