Skip to content

Commit 1b077ce

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git
/klassert/ipsec-next Steffen Klassert says: ==================== pull request (net-next): ipsec-next 2021-06-28 1) Remove an unneeded error assignment in esp4_gro_receive(). From Yang Li. 2) Add a new byseq state hashtable to find acquire states faster. From Sabrina Dubroca. 3) Remove some unnecessary variables in pfkey_create(). From zuoqilin. 4) Remove the unused description from xfrm_type struct. From Florian Westphal. 5) Fix a spelling mistake in the comment of xfrm_state_ok(). From gushengxian. 6) Replace hdr_off indirections by a small helper function. From Florian Westphal. 7) Remove xfrm4_output_finish and xfrm6_output_finish declarations, they are not used anymore.From Antony Antony. 8) Remove xfrm replay indirections. From Florian Westphal. Please pull or let me know if there are problems. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 007b312 + b5a1d1f commit 1b077ce

21 files changed

+266
-236
lines changed

include/net/netns/xfrm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ struct netns_xfrm {
4242
struct hlist_head __rcu *state_bydst;
4343
struct hlist_head __rcu *state_bysrc;
4444
struct hlist_head __rcu *state_byspi;
45+
struct hlist_head __rcu *state_byseq;
4546
unsigned int state_hmask;
4647
unsigned int state_num;
4748
struct work_struct state_hash_work;

include/net/xfrm.h

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ enum {
145145
XFRM_MODE_FLAG_TUNNEL = 1,
146146
};
147147

148+
enum xfrm_replay_mode {
149+
XFRM_REPLAY_MODE_LEGACY,
150+
XFRM_REPLAY_MODE_BMP,
151+
XFRM_REPLAY_MODE_ESN,
152+
};
153+
148154
/* Full description of state of transformer. */
149155
struct xfrm_state {
150156
possible_net_t xs_net;
@@ -154,6 +160,7 @@ struct xfrm_state {
154160
};
155161
struct hlist_node bysrc;
156162
struct hlist_node byspi;
163+
struct hlist_node byseq;
157164

158165
refcount_t refcnt;
159166
spinlock_t lock;
@@ -214,9 +221,8 @@ struct xfrm_state {
214221
struct xfrm_replay_state preplay;
215222
struct xfrm_replay_state_esn *preplay_esn;
216223

217-
/* The functions for replay detection. */
218-
const struct xfrm_replay *repl;
219-
224+
/* replay detection mode */
225+
enum xfrm_replay_mode repl_mode;
220226
/* internal flag that only holds state for delayed aevent at the
221227
* moment
222228
*/
@@ -296,18 +302,6 @@ struct km_event {
296302
struct net *net;
297303
};
298304

299-
struct xfrm_replay {
300-
void (*advance)(struct xfrm_state *x, __be32 net_seq);
301-
int (*check)(struct xfrm_state *x,
302-
struct sk_buff *skb,
303-
__be32 net_seq);
304-
int (*recheck)(struct xfrm_state *x,
305-
struct sk_buff *skb,
306-
__be32 net_seq);
307-
void (*notify)(struct xfrm_state *x, int event);
308-
int (*overflow)(struct xfrm_state *x, struct sk_buff *skb);
309-
};
310-
311305
struct xfrm_if_cb {
312306
struct xfrm_if *(*decode_session)(struct sk_buff *skb,
313307
unsigned short family);
@@ -387,7 +381,6 @@ void xfrm_flush_gc(void);
387381
void xfrm_state_delete_tunnel(struct xfrm_state *x);
388382

389383
struct xfrm_type {
390-
char *description;
391384
struct module *owner;
392385
u8 proto;
393386
u8 flags;
@@ -402,14 +395,12 @@ struct xfrm_type {
402395
int (*output)(struct xfrm_state *, struct sk_buff *pskb);
403396
int (*reject)(struct xfrm_state *, struct sk_buff *,
404397
const struct flowi *);
405-
int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **);
406398
};
407399

408400
int xfrm_register_type(const struct xfrm_type *type, unsigned short family);
409401
void xfrm_unregister_type(const struct xfrm_type *type, unsigned short family);
410402

411403
struct xfrm_type_offload {
412-
char *description;
413404
struct module *owner;
414405
u8 proto;
415406
void (*encap)(struct xfrm_state *, struct sk_buff *pskb);
@@ -1582,7 +1573,6 @@ static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
15821573
}
15831574

15841575
int xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb);
1585-
int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb);
15861576
int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol);
15871577
int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol);
15881578
int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
@@ -1606,9 +1596,6 @@ int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family)
16061596
__be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
16071597
__be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr);
16081598
int xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb);
1609-
int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb);
1610-
int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
1611-
u8 **prevhdr);
16121599

16131600
#ifdef CONFIG_XFRM
16141601
void xfrm6_local_rxpmtu(struct sk_buff *skb, u32 mtu);
@@ -1722,6 +1709,12 @@ static inline int xfrm_policy_id2dir(u32 index)
17221709
}
17231710

17241711
#ifdef CONFIG_XFRM
1712+
void xfrm_replay_advance(struct xfrm_state *x, __be32 net_seq);
1713+
int xfrm_replay_check(struct xfrm_state *x, struct sk_buff *skb, __be32 net_seq);
1714+
void xfrm_replay_notify(struct xfrm_state *x, int event);
1715+
int xfrm_replay_overflow(struct xfrm_state *x, struct sk_buff *skb);
1716+
int xfrm_replay_recheck(struct xfrm_state *x, struct sk_buff *skb, __be32 net_seq);
1717+
17251718
static inline int xfrm_aevent_is_on(struct net *net)
17261719
{
17271720
struct sock *nlsk;

net/ipv4/ah4.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,6 @@ static int ah4_rcv_cb(struct sk_buff *skb, int err)
554554

555555
static const struct xfrm_type ah_type =
556556
{
557-
.description = "AH4",
558557
.owner = THIS_MODULE,
559558
.proto = IPPROTO_AH,
560559
.flags = XFRM_TYPE_REPLAY_PROT,

net/ipv4/esp4.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,6 @@ static int esp4_rcv_cb(struct sk_buff *skb, int err)
11981198

11991199
static const struct xfrm_type esp_type =
12001200
{
1201-
.description = "ESP4",
12021201
.owner = THIS_MODULE,
12031202
.proto = IPPROTO_ESP,
12041203
.flags = XFRM_TYPE_REPLAY_PROT,

net/ipv4/esp4_offload.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head,
3333
struct xfrm_state *x;
3434
__be32 seq;
3535
__be32 spi;
36-
int err;
3736

3837
if (!pskb_pull(skb, offset))
3938
return NULL;
4039

41-
if ((err = xfrm_parse_spi(skb, IPPROTO_ESP, &spi, &seq)) != 0)
40+
if (xfrm_parse_spi(skb, IPPROTO_ESP, &spi, &seq) != 0)
4241
goto out;
4342

4443
xo = xfrm_offload(skb);
@@ -343,7 +342,6 @@ static const struct net_offload esp4_offload = {
343342
};
344343

345344
static const struct xfrm_type_offload esp_type_offload = {
346-
.description = "ESP4 OFFLOAD",
347345
.owner = THIS_MODULE,
348346
.proto = IPPROTO_ESP,
349347
.input_tail = esp_input_tail,

net/ipv4/ipcomp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ static int ipcomp4_rcv_cb(struct sk_buff *skb, int err)
152152
}
153153

154154
static const struct xfrm_type ipcomp_type = {
155-
.description = "IPCOMP4",
156155
.owner = THIS_MODULE,
157156
.proto = IPPROTO_COMP,
158157
.init_state = ipcomp4_init_state,

net/ipv4/xfrm4_tunnel.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ static void ipip_destroy(struct xfrm_state *x)
4242
}
4343

4444
static const struct xfrm_type ipip_type = {
45-
.description = "IPIP",
4645
.owner = THIS_MODULE,
4746
.proto = IPPROTO_IPIP,
4847
.init_state = ipip_init_state,

net/ipv6/ah6.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,15 +755,13 @@ static int ah6_rcv_cb(struct sk_buff *skb, int err)
755755
}
756756

757757
static const struct xfrm_type ah6_type = {
758-
.description = "AH6",
759758
.owner = THIS_MODULE,
760759
.proto = IPPROTO_AH,
761760
.flags = XFRM_TYPE_REPLAY_PROT,
762761
.init_state = ah6_init_state,
763762
.destructor = ah6_destroy,
764763
.input = ah6_input,
765764
.output = ah6_output,
766-
.hdr_offset = xfrm6_find_1stfragopt,
767765
};
768766

769767
static struct xfrm6_protocol ah6_protocol = {

net/ipv6/esp6.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,15 +1243,13 @@ static int esp6_rcv_cb(struct sk_buff *skb, int err)
12431243
}
12441244

12451245
static const struct xfrm_type esp6_type = {
1246-
.description = "ESP6",
12471246
.owner = THIS_MODULE,
12481247
.proto = IPPROTO_ESP,
12491248
.flags = XFRM_TYPE_REPLAY_PROT,
12501249
.init_state = esp6_init_state,
12511250
.destructor = esp6_destroy,
12521251
.input = esp6_input,
12531252
.output = esp6_output,
1254-
.hdr_offset = xfrm6_find_1stfragopt,
12551253
};
12561254

12571255
static struct xfrm6_protocol esp6_protocol = {

net/ipv6/esp6_offload.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ static const struct net_offload esp6_offload = {
377377
};
378378

379379
static const struct xfrm_type_offload esp6_type_offload = {
380-
.description = "ESP6 OFFLOAD",
381380
.owner = THIS_MODULE,
382381
.proto = IPPROTO_ESP,
383382
.input_tail = esp6_input_tail,

0 commit comments

Comments
 (0)