@@ -72,7 +72,7 @@ struct rxrpc_sock {
72
72
#define RXRPC_SECURITY_MAX RXRPC_SECURITY_ENCRYPT
73
73
struct sockaddr_rxrpc srx ; /* local address */
74
74
struct sockaddr_rxrpc connect_srx ; /* Default client address from connect() */
75
- sa_family_t proto ; /* protocol created with */
75
+ sa_family_t family ; /* protocol family created with */
76
76
};
77
77
78
78
#define rxrpc_sk (__sk ) container_of((__sk), struct rxrpc_sock, sk)
@@ -261,6 +261,34 @@ struct rxrpc_conn_bundle {
261
261
u8 security_ix ; /* security type */
262
262
};
263
263
264
+ /*
265
+ * Keys for matching a connection.
266
+ */
267
+ struct rxrpc_conn_proto {
268
+ unsigned long hash_key ;
269
+ struct rxrpc_local * local ; /* Representation of local endpoint */
270
+ u32 epoch ; /* epoch of this connection */
271
+ u32 cid ; /* connection ID */
272
+ u8 in_clientflag ; /* RXRPC_CLIENT_INITIATED if we are server */
273
+ u8 addr_size ; /* Size of the address */
274
+ sa_family_t family ; /* Transport protocol */
275
+ __be16 port ; /* Peer UDP/UDP6 port */
276
+ union { /* Peer address */
277
+ struct in_addr ipv4_addr ;
278
+ struct in6_addr ipv6_addr ;
279
+ u32 raw_addr [0 ];
280
+ };
281
+ };
282
+
283
+ struct rxrpc_conn_parameters {
284
+ struct rxrpc_local * local ; /* Representation of local endpoint */
285
+ struct rxrpc_peer * peer ; /* Remote endpoint */
286
+ struct key * key ; /* Security details */
287
+ bool exclusive ; /* T if conn is exclusive */
288
+ u16 service_id ; /* Service ID for this connection */
289
+ u32 security_level ; /* Security level selected */
290
+ };
291
+
264
292
/*
265
293
* RxRPC connection definition
266
294
* - matched by { transport, service_id, conn_id, direction, key }
@@ -269,6 +297,9 @@ struct rxrpc_conn_bundle {
269
297
struct rxrpc_connection {
270
298
struct rxrpc_transport * trans ; /* transport session */
271
299
struct rxrpc_conn_bundle * bundle ; /* connection bundle (client) */
300
+ struct rxrpc_conn_proto proto ;
301
+ struct rxrpc_conn_parameters params ;
302
+
272
303
struct work_struct processor ; /* connection event processor */
273
304
struct rb_node node ; /* node in transport's lookup tree */
274
305
struct list_head link ; /* link in master connection list */
@@ -277,7 +308,6 @@ struct rxrpc_connection {
277
308
struct sk_buff_head rx_queue ; /* received conn-level packets */
278
309
struct rxrpc_call * channels [RXRPC_MAXCALLS ]; /* channels (active calls) */
279
310
const struct rxrpc_security * security ; /* applied security module */
280
- struct key * key ; /* security for this connection (client) */
281
311
struct key * server_key ; /* security for this service */
282
312
struct crypto_skcipher * cipher ; /* encryption handle */
283
313
struct rxrpc_crypt csum_iv ; /* packet checksum base */
@@ -308,13 +338,8 @@ struct rxrpc_connection {
308
338
u8 size_align ; /* data size alignment (for security) */
309
339
u8 header_size ; /* rxrpc + security header size */
310
340
u8 security_size ; /* security header size */
311
- u32 security_level ; /* security level negotiated */
312
341
u32 security_nonce ; /* response re-use preventer */
313
- u32 epoch ; /* epoch of this connection */
314
- u32 cid ; /* connection ID */
315
- u16 service_id ; /* service ID for this connection */
316
342
u8 security_ix ; /* security type */
317
- u8 in_clientflag ; /* RXRPC_CLIENT_INITIATED if we are server */
318
343
u8 out_clientflag ; /* RXRPC_CLIENT_INITIATED if we are client */
319
344
};
320
345
@@ -448,7 +473,7 @@ struct rxrpc_call {
448
473
unsigned long hash_key ; /* Full hash key */
449
474
u8 in_clientflag ; /* Copy of conn->in_clientflag for hashing */
450
475
struct rxrpc_local * local ; /* Local endpoint. Used for hashing. */
451
- sa_family_t proto ; /* Frame protocol */
476
+ sa_family_t family ; /* Frame protocol */
452
477
u32 call_id ; /* call ID on connection */
453
478
u32 cid ; /* connection ID plus channel index */
454
479
u32 epoch ; /* epoch of this connection */
@@ -481,9 +506,9 @@ extern u32 rxrpc_epoch;
481
506
extern atomic_t rxrpc_debug_id ;
482
507
extern struct workqueue_struct * rxrpc_workqueue ;
483
508
484
- extern struct rxrpc_transport * rxrpc_name_to_transport (struct rxrpc_sock * ,
509
+ extern struct rxrpc_transport * rxrpc_name_to_transport (struct rxrpc_conn_parameters * ,
485
510
struct sockaddr * ,
486
- int , int , gfp_t );
511
+ int , gfp_t );
487
512
488
513
/*
489
514
* call_accept.c
@@ -512,6 +537,7 @@ struct rxrpc_call *rxrpc_find_call_hash(struct rxrpc_host_header *,
512
537
void * , sa_family_t , const void * );
513
538
struct rxrpc_call * rxrpc_find_call_by_user_ID (struct rxrpc_sock * , unsigned long );
514
539
struct rxrpc_call * rxrpc_new_client_call (struct rxrpc_sock * ,
540
+ struct rxrpc_conn_parameters * ,
515
541
struct rxrpc_transport * ,
516
542
struct rxrpc_conn_bundle * ,
517
543
unsigned long , gfp_t );
@@ -541,15 +567,26 @@ struct rxrpc_conn_bundle *rxrpc_get_bundle(struct rxrpc_sock *,
541
567
struct rxrpc_transport * ,
542
568
struct key * , u16 , gfp_t );
543
569
void rxrpc_put_bundle (struct rxrpc_transport * , struct rxrpc_conn_bundle * );
544
- int rxrpc_connect_call (struct rxrpc_sock * , struct rxrpc_transport * ,
545
- struct rxrpc_conn_bundle * , struct rxrpc_call * , gfp_t );
570
+ int rxrpc_connect_call (struct rxrpc_sock * , struct rxrpc_conn_parameters * ,
571
+ struct rxrpc_transport * , struct rxrpc_conn_bundle * ,
572
+ struct rxrpc_call * , gfp_t );
546
573
void rxrpc_put_connection (struct rxrpc_connection * );
547
574
void __exit rxrpc_destroy_all_connections (void );
548
575
struct rxrpc_connection * rxrpc_find_connection (struct rxrpc_transport * ,
549
576
struct rxrpc_host_header * );
550
577
extern struct rxrpc_connection *
551
578
rxrpc_incoming_connection (struct rxrpc_transport * , struct rxrpc_host_header * );
552
579
580
+ static inline bool rxrpc_conn_is_client (const struct rxrpc_connection * conn )
581
+ {
582
+ return conn -> out_clientflag ;
583
+ }
584
+
585
+ static inline bool rxrpc_conn_is_service (const struct rxrpc_connection * conn )
586
+ {
587
+ return conn -> proto .in_clientflag ;
588
+ }
589
+
553
590
/*
554
591
* input.c
555
592
*/
0 commit comments