diff options
Diffstat (limited to 'include/net/sctp/structs.h')
-rw-r--r-- | include/net/sctp/structs.h | 100 |
1 files changed, 89 insertions, 11 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index ee4559b11302..ef892e00c833 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -64,6 +64,7 @@ | |||
64 | #include <linux/skbuff.h> /* We need sk_buff_head. */ | 64 | #include <linux/skbuff.h> /* We need sk_buff_head. */ |
65 | #include <linux/workqueue.h> /* We need tq_struct. */ | 65 | #include <linux/workqueue.h> /* We need tq_struct. */ |
66 | #include <linux/sctp.h> /* We need sctp* header structs. */ | 66 | #include <linux/sctp.h> /* We need sctp* header structs. */ |
67 | #include <net/sctp/auth.h> /* We need auth specific structs */ | ||
67 | 68 | ||
68 | /* A convenience structure for handling sockaddr structures. | 69 | /* A convenience structure for handling sockaddr structures. |
69 | * We should wean ourselves off this. | 70 | * We should wean ourselves off this. |
@@ -196,8 +197,6 @@ extern struct sctp_globals { | |||
196 | 197 | ||
197 | /* This is the sctp port control hash. */ | 198 | /* This is the sctp port control hash. */ |
198 | int port_hashsize; | 199 | int port_hashsize; |
199 | int port_rover; | ||
200 | spinlock_t port_alloc_lock; /* Protects port_rover. */ | ||
201 | struct sctp_bind_hashbucket *port_hashtable; | 200 | struct sctp_bind_hashbucket *port_hashtable; |
202 | 201 | ||
203 | /* This is the global local address list. | 202 | /* This is the global local address list. |
@@ -207,12 +206,18 @@ extern struct sctp_globals { | |||
207 | * It is a list of sctp_sockaddr_entry. | 206 | * It is a list of sctp_sockaddr_entry. |
208 | */ | 207 | */ |
209 | struct list_head local_addr_list; | 208 | struct list_head local_addr_list; |
209 | |||
210 | /* Lock that protects the local_addr_list writers */ | ||
211 | spinlock_t addr_list_lock; | ||
210 | 212 | ||
211 | /* Flag to indicate if addip is enabled. */ | 213 | /* Flag to indicate if addip is enabled. */ |
212 | int addip_enable; | 214 | int addip_enable; |
213 | 215 | ||
214 | /* Flag to indicate if PR-SCTP is enabled. */ | 216 | /* Flag to indicate if PR-SCTP is enabled. */ |
215 | int prsctp_enable; | 217 | int prsctp_enable; |
218 | |||
219 | /* Flag to idicate if SCTP-AUTH is enabled */ | ||
220 | int auth_enable; | ||
216 | } sctp_globals; | 221 | } sctp_globals; |
217 | 222 | ||
218 | #define sctp_rto_initial (sctp_globals.rto_initial) | 223 | #define sctp_rto_initial (sctp_globals.rto_initial) |
@@ -242,8 +247,10 @@ extern struct sctp_globals { | |||
242 | #define sctp_port_alloc_lock (sctp_globals.port_alloc_lock) | 247 | #define sctp_port_alloc_lock (sctp_globals.port_alloc_lock) |
243 | #define sctp_port_hashtable (sctp_globals.port_hashtable) | 248 | #define sctp_port_hashtable (sctp_globals.port_hashtable) |
244 | #define sctp_local_addr_list (sctp_globals.local_addr_list) | 249 | #define sctp_local_addr_list (sctp_globals.local_addr_list) |
250 | #define sctp_local_addr_lock (sctp_globals.addr_list_lock) | ||
245 | #define sctp_addip_enable (sctp_globals.addip_enable) | 251 | #define sctp_addip_enable (sctp_globals.addip_enable) |
246 | #define sctp_prsctp_enable (sctp_globals.prsctp_enable) | 252 | #define sctp_prsctp_enable (sctp_globals.prsctp_enable) |
253 | #define sctp_auth_enable (sctp_globals.auth_enable) | ||
247 | 254 | ||
248 | /* SCTP Socket type: UDP or TCP style. */ | 255 | /* SCTP Socket type: UDP or TCP style. */ |
249 | typedef enum { | 256 | typedef enum { |
@@ -393,6 +400,9 @@ struct sctp_cookie { | |||
393 | 400 | ||
394 | __u32 adaptation_ind; | 401 | __u32 adaptation_ind; |
395 | 402 | ||
403 | __u8 auth_random[sizeof(sctp_paramhdr_t) + SCTP_AUTH_RANDOM_LENGTH]; | ||
404 | __u8 auth_hmacs[SCTP_AUTH_NUM_HMACS + 2]; | ||
405 | __u8 auth_chunks[sizeof(sctp_paramhdr_t) + SCTP_AUTH_MAX_CHUNKS]; | ||
396 | 406 | ||
397 | /* This is a shim for my peer's INIT packet, followed by | 407 | /* This is a shim for my peer's INIT packet, followed by |
398 | * a copy of the raw address list of the association. | 408 | * a copy of the raw address list of the association. |
@@ -417,6 +427,7 @@ struct sctp_signed_cookie { | |||
417 | * internally. | 427 | * internally. |
418 | */ | 428 | */ |
419 | union sctp_addr_param { | 429 | union sctp_addr_param { |
430 | struct sctp_paramhdr p; | ||
420 | struct sctp_ipv4addr_param v4; | 431 | struct sctp_ipv4addr_param v4; |
421 | struct sctp_ipv6addr_param v6; | 432 | struct sctp_ipv6addr_param v6; |
422 | }; | 433 | }; |
@@ -435,6 +446,10 @@ union sctp_params { | |||
435 | struct sctp_ipv6addr_param *v6; | 446 | struct sctp_ipv6addr_param *v6; |
436 | union sctp_addr_param *addr; | 447 | union sctp_addr_param *addr; |
437 | struct sctp_adaptation_ind_param *aind; | 448 | struct sctp_adaptation_ind_param *aind; |
449 | struct sctp_supported_ext_param *ext; | ||
450 | struct sctp_random_param *random; | ||
451 | struct sctp_chunks_param *chunks; | ||
452 | struct sctp_hmac_algo_param *hmac_algo; | ||
438 | }; | 453 | }; |
439 | 454 | ||
440 | /* RFC 2960. Section 3.3.5 Heartbeat. | 455 | /* RFC 2960. Section 3.3.5 Heartbeat. |
@@ -673,6 +688,7 @@ struct sctp_chunk { | |||
673 | struct sctp_errhdr *err_hdr; | 688 | struct sctp_errhdr *err_hdr; |
674 | struct sctp_addiphdr *addip_hdr; | 689 | struct sctp_addiphdr *addip_hdr; |
675 | struct sctp_fwdtsn_hdr *fwdtsn_hdr; | 690 | struct sctp_fwdtsn_hdr *fwdtsn_hdr; |
691 | struct sctp_authhdr *auth_hdr; | ||
676 | } subh; | 692 | } subh; |
677 | 693 | ||
678 | __u8 *chunk_end; | 694 | __u8 *chunk_end; |
@@ -706,6 +722,13 @@ struct sctp_chunk { | |||
706 | */ | 722 | */ |
707 | struct sctp_transport *transport; | 723 | struct sctp_transport *transport; |
708 | 724 | ||
725 | /* SCTP-AUTH: For the special case inbound processing of COOKIE-ECHO | ||
726 | * we need save a pointer to the AUTH chunk, since the SCTP-AUTH | ||
727 | * spec violates the principle premis that all chunks are processed | ||
728 | * in order. | ||
729 | */ | ||
730 | struct sk_buff *auth_chunk; | ||
731 | |||
709 | __u8 rtt_in_progress; /* Is this chunk used for RTT calculation? */ | 732 | __u8 rtt_in_progress; /* Is this chunk used for RTT calculation? */ |
710 | __u8 resent; /* Has this chunk ever been retransmitted. */ | 733 | __u8 resent; /* Has this chunk ever been retransmitted. */ |
711 | __u8 has_tsn; /* Does this chunk have a TSN yet? */ | 734 | __u8 has_tsn; /* Does this chunk have a TSN yet? */ |
@@ -718,6 +741,7 @@ struct sctp_chunk { | |||
718 | __s8 fast_retransmit; /* Is this chunk fast retransmitted? */ | 741 | __s8 fast_retransmit; /* Is this chunk fast retransmitted? */ |
719 | __u8 tsn_missing_report; /* Data chunk missing counter. */ | 742 | __u8 tsn_missing_report; /* Data chunk missing counter. */ |
720 | __u8 data_accepted; /* At least 1 chunk in this packet accepted */ | 743 | __u8 data_accepted; /* At least 1 chunk in this packet accepted */ |
744 | __u8 auth; /* IN: was auth'ed | OUT: needs auth */ | ||
721 | }; | 745 | }; |
722 | 746 | ||
723 | void sctp_chunk_hold(struct sctp_chunk *); | 747 | void sctp_chunk_hold(struct sctp_chunk *); |
@@ -736,8 +760,10 @@ const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); | |||
736 | /* This is a structure for holding either an IPv6 or an IPv4 address. */ | 760 | /* This is a structure for holding either an IPv6 or an IPv4 address. */ |
737 | struct sctp_sockaddr_entry { | 761 | struct sctp_sockaddr_entry { |
738 | struct list_head list; | 762 | struct list_head list; |
763 | struct rcu_head rcu; | ||
739 | union sctp_addr a; | 764 | union sctp_addr a; |
740 | __u8 use_as_src; | 765 | __u8 use_as_src; |
766 | __u8 valid; | ||
741 | }; | 767 | }; |
742 | 768 | ||
743 | typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); | 769 | typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); |
@@ -765,16 +791,25 @@ struct sctp_packet { | |||
765 | */ | 791 | */ |
766 | struct sctp_transport *transport; | 792 | struct sctp_transport *transport; |
767 | 793 | ||
794 | /* pointer to the auth chunk for this packet */ | ||
795 | struct sctp_chunk *auth; | ||
796 | |||
768 | /* This packet contains a COOKIE-ECHO chunk. */ | 797 | /* This packet contains a COOKIE-ECHO chunk. */ |
769 | char has_cookie_echo; | 798 | __u8 has_cookie_echo; |
799 | |||
800 | /* This packet contains a SACK chunk. */ | ||
801 | __u8 has_sack; | ||
770 | 802 | ||
771 | /* This packet containsa SACK chunk. */ | 803 | /* This packet contains an AUTH chunk */ |
772 | char has_sack; | 804 | __u8 has_auth; |
805 | |||
806 | /* This packet contains at least 1 DATA chunk */ | ||
807 | __u8 has_data; | ||
773 | 808 | ||
774 | /* SCTP cannot fragment this packet. So let ip fragment it. */ | 809 | /* SCTP cannot fragment this packet. So let ip fragment it. */ |
775 | char ipfragok; | 810 | __u8 ipfragok; |
776 | 811 | ||
777 | int malloced; | 812 | __u8 malloced; |
778 | }; | 813 | }; |
779 | 814 | ||
780 | struct sctp_packet *sctp_packet_init(struct sctp_packet *, | 815 | struct sctp_packet *sctp_packet_init(struct sctp_packet *, |
@@ -1037,6 +1072,7 @@ void sctp_inq_init(struct sctp_inq *); | |||
1037 | void sctp_inq_free(struct sctp_inq *); | 1072 | void sctp_inq_free(struct sctp_inq *); |
1038 | void sctp_inq_push(struct sctp_inq *, struct sctp_chunk *packet); | 1073 | void sctp_inq_push(struct sctp_inq *, struct sctp_chunk *packet); |
1039 | struct sctp_chunk *sctp_inq_pop(struct sctp_inq *); | 1074 | struct sctp_chunk *sctp_inq_pop(struct sctp_inq *); |
1075 | struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *); | ||
1040 | void sctp_inq_set_th_handler(struct sctp_inq *, work_func_t); | 1076 | void sctp_inq_set_th_handler(struct sctp_inq *, work_func_t); |
1041 | 1077 | ||
1042 | /* This is the structure we use to hold outbound chunks. You push | 1078 | /* This is the structure we use to hold outbound chunks. You push |
@@ -1148,7 +1184,9 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest, | |||
1148 | int flags); | 1184 | int flags); |
1149 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, | 1185 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, |
1150 | __u8 use_as_src, gfp_t gfp); | 1186 | __u8 use_as_src, gfp_t gfp); |
1151 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); | 1187 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *, |
1188 | void fastcall (*rcu_call)(struct rcu_head *, | ||
1189 | void (*func)(struct rcu_head *))); | ||
1152 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, | 1190 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, |
1153 | struct sctp_sock *); | 1191 | struct sctp_sock *); |
1154 | union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, | 1192 | union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, |
@@ -1219,9 +1257,6 @@ struct sctp_ep_common { | |||
1219 | * bind_addr.address_list is our set of local IP addresses. | 1257 | * bind_addr.address_list is our set of local IP addresses. |
1220 | */ | 1258 | */ |
1221 | struct sctp_bind_addr bind_addr; | 1259 | struct sctp_bind_addr bind_addr; |
1222 | |||
1223 | /* Protection during address list comparisons. */ | ||
1224 | rwlock_t addr_lock; | ||
1225 | }; | 1260 | }; |
1226 | 1261 | ||
1227 | 1262 | ||
@@ -1284,6 +1319,21 @@ struct sctp_endpoint { | |||
1284 | 1319 | ||
1285 | /* rcvbuf acct. policy. */ | 1320 | /* rcvbuf acct. policy. */ |
1286 | __u32 rcvbuf_policy; | 1321 | __u32 rcvbuf_policy; |
1322 | |||
1323 | /* SCTP AUTH: array of the HMACs that will be allocated | ||
1324 | * we need this per association so that we don't serialize | ||
1325 | */ | ||
1326 | struct crypto_hash **auth_hmacs; | ||
1327 | |||
1328 | /* SCTP-AUTH: hmacs for the endpoint encoded into parameter */ | ||
1329 | struct sctp_hmac_algo_param *auth_hmacs_list; | ||
1330 | |||
1331 | /* SCTP-AUTH: chunks to authenticate encoded into parameter */ | ||
1332 | struct sctp_chunks_param *auth_chunk_list; | ||
1333 | |||
1334 | /* SCTP-AUTH: endpoint shared keys */ | ||
1335 | struct list_head endpoint_shared_keys; | ||
1336 | __u16 active_key_id; | ||
1287 | }; | 1337 | }; |
1288 | 1338 | ||
1289 | /* Recover the outter endpoint structure. */ | 1339 | /* Recover the outter endpoint structure. */ |
@@ -1490,6 +1540,8 @@ struct sctp_association { | |||
1490 | __u8 hostname_address;/* Peer understands DNS addresses? */ | 1540 | __u8 hostname_address;/* Peer understands DNS addresses? */ |
1491 | __u8 asconf_capable; /* Does peer support ADDIP? */ | 1541 | __u8 asconf_capable; /* Does peer support ADDIP? */ |
1492 | __u8 prsctp_capable; /* Can peer do PR-SCTP? */ | 1542 | __u8 prsctp_capable; /* Can peer do PR-SCTP? */ |
1543 | __u8 auth_capable; /* Is peer doing SCTP-AUTH? */ | ||
1544 | __u8 addip_capable; /* Can peer do ADD-IP */ | ||
1493 | 1545 | ||
1494 | __u32 adaptation_ind; /* Adaptation Code point. */ | 1546 | __u32 adaptation_ind; /* Adaptation Code point. */ |
1495 | 1547 | ||
@@ -1507,6 +1559,14 @@ struct sctp_association { | |||
1507 | * Initial TSN Value minus 1 | 1559 | * Initial TSN Value minus 1 |
1508 | */ | 1560 | */ |
1509 | __u32 addip_serial; | 1561 | __u32 addip_serial; |
1562 | |||
1563 | /* SCTP-AUTH: We need to know pears random number, hmac list | ||
1564 | * and authenticated chunk list. All that is part of the | ||
1565 | * cookie and these are just pointers to those locations | ||
1566 | */ | ||
1567 | sctp_random_param_t *peer_random; | ||
1568 | sctp_chunks_param_t *peer_chunks; | ||
1569 | sctp_hmac_algo_param_t *peer_hmacs; | ||
1510 | } peer; | 1570 | } peer; |
1511 | 1571 | ||
1512 | /* State : A state variable indicating what state the | 1572 | /* State : A state variable indicating what state the |
@@ -1790,6 +1850,24 @@ struct sctp_association { | |||
1790 | */ | 1850 | */ |
1791 | __u32 addip_serial; | 1851 | __u32 addip_serial; |
1792 | 1852 | ||
1853 | /* SCTP AUTH: list of the endpoint shared keys. These | ||
1854 | * keys are provided out of band by the user applicaton | ||
1855 | * and can't change during the lifetime of the association | ||
1856 | */ | ||
1857 | struct list_head endpoint_shared_keys; | ||
1858 | |||
1859 | /* SCTP AUTH: | ||
1860 | * The current generated assocaition shared key (secret) | ||
1861 | */ | ||
1862 | struct sctp_auth_bytes *asoc_shared_key; | ||
1863 | |||
1864 | /* SCTP AUTH: hmac id of the first peer requested algorithm | ||
1865 | * that we support. | ||
1866 | */ | ||
1867 | __u16 default_hmac_id; | ||
1868 | |||
1869 | __u16 active_key_id; | ||
1870 | |||
1793 | /* Need to send an ECNE Chunk? */ | 1871 | /* Need to send an ECNE Chunk? */ |
1794 | char need_ecne; | 1872 | char need_ecne; |
1795 | 1873 | ||