@@ -4202,6 +4202,92 @@ static void sctp_shutdown(struct sock *sk, int how)
4202
4202
}
4203
4203
}
4204
4204
4205
+ int sctp_get_sctp_info (struct sock * sk , struct sctp_association * asoc ,
4206
+ struct sctp_info * info )
4207
+ {
4208
+ struct sctp_transport * prim ;
4209
+ struct list_head * pos ;
4210
+ int mask ;
4211
+
4212
+ memset (info , 0 , sizeof (* info ));
4213
+ if (!asoc ) {
4214
+ struct sctp_sock * sp = sctp_sk (sk );
4215
+
4216
+ info -> sctpi_s_autoclose = sp -> autoclose ;
4217
+ info -> sctpi_s_adaptation_ind = sp -> adaptation_ind ;
4218
+ info -> sctpi_s_pd_point = sp -> pd_point ;
4219
+ info -> sctpi_s_nodelay = sp -> nodelay ;
4220
+ info -> sctpi_s_disable_fragments = sp -> disable_fragments ;
4221
+ info -> sctpi_s_v4mapped = sp -> v4mapped ;
4222
+ info -> sctpi_s_frag_interleave = sp -> frag_interleave ;
4223
+
4224
+ return 0 ;
4225
+ }
4226
+
4227
+ info -> sctpi_tag = asoc -> c .my_vtag ;
4228
+ info -> sctpi_state = asoc -> state ;
4229
+ info -> sctpi_rwnd = asoc -> a_rwnd ;
4230
+ info -> sctpi_unackdata = asoc -> unack_data ;
4231
+ info -> sctpi_penddata = sctp_tsnmap_pending (& asoc -> peer .tsn_map );
4232
+ info -> sctpi_instrms = asoc -> c .sinit_max_instreams ;
4233
+ info -> sctpi_outstrms = asoc -> c .sinit_num_ostreams ;
4234
+ list_for_each (pos , & asoc -> base .inqueue .in_chunk_list )
4235
+ info -> sctpi_inqueue ++ ;
4236
+ list_for_each (pos , & asoc -> outqueue .out_chunk_list )
4237
+ info -> sctpi_outqueue ++ ;
4238
+ info -> sctpi_overall_error = asoc -> overall_error_count ;
4239
+ info -> sctpi_max_burst = asoc -> max_burst ;
4240
+ info -> sctpi_maxseg = asoc -> frag_point ;
4241
+ info -> sctpi_peer_rwnd = asoc -> peer .rwnd ;
4242
+ info -> sctpi_peer_tag = asoc -> c .peer_vtag ;
4243
+
4244
+ mask = asoc -> peer .ecn_capable << 1 ;
4245
+ mask = (mask | asoc -> peer .ipv4_address ) << 1 ;
4246
+ mask = (mask | asoc -> peer .ipv6_address ) << 1 ;
4247
+ mask = (mask | asoc -> peer .hostname_address ) << 1 ;
4248
+ mask = (mask | asoc -> peer .asconf_capable ) << 1 ;
4249
+ mask = (mask | asoc -> peer .prsctp_capable ) << 1 ;
4250
+ mask = (mask | asoc -> peer .auth_capable );
4251
+ info -> sctpi_peer_capable = mask ;
4252
+ mask = asoc -> peer .sack_needed << 1 ;
4253
+ mask = (mask | asoc -> peer .sack_generation ) << 1 ;
4254
+ mask = (mask | asoc -> peer .zero_window_announced );
4255
+ info -> sctpi_peer_sack = mask ;
4256
+
4257
+ info -> sctpi_isacks = asoc -> stats .isacks ;
4258
+ info -> sctpi_osacks = asoc -> stats .osacks ;
4259
+ info -> sctpi_opackets = asoc -> stats .opackets ;
4260
+ info -> sctpi_ipackets = asoc -> stats .ipackets ;
4261
+ info -> sctpi_rtxchunks = asoc -> stats .rtxchunks ;
4262
+ info -> sctpi_outofseqtsns = asoc -> stats .outofseqtsns ;
4263
+ info -> sctpi_idupchunks = asoc -> stats .idupchunks ;
4264
+ info -> sctpi_gapcnt = asoc -> stats .gapcnt ;
4265
+ info -> sctpi_ouodchunks = asoc -> stats .ouodchunks ;
4266
+ info -> sctpi_iuodchunks = asoc -> stats .iuodchunks ;
4267
+ info -> sctpi_oodchunks = asoc -> stats .oodchunks ;
4268
+ info -> sctpi_iodchunks = asoc -> stats .iodchunks ;
4269
+ info -> sctpi_octrlchunks = asoc -> stats .octrlchunks ;
4270
+ info -> sctpi_ictrlchunks = asoc -> stats .ictrlchunks ;
4271
+
4272
+ prim = asoc -> peer .primary_path ;
4273
+ memcpy (& info -> sctpi_p_address , & prim -> ipaddr ,
4274
+ sizeof (struct sockaddr_storage ));
4275
+ info -> sctpi_p_state = prim -> state ;
4276
+ info -> sctpi_p_cwnd = prim -> cwnd ;
4277
+ info -> sctpi_p_srtt = prim -> srtt ;
4278
+ info -> sctpi_p_rto = jiffies_to_msecs (prim -> rto );
4279
+ info -> sctpi_p_hbinterval = prim -> hbinterval ;
4280
+ info -> sctpi_p_pathmaxrxt = prim -> pathmaxrxt ;
4281
+ info -> sctpi_p_sackdelay = jiffies_to_msecs (prim -> sackdelay );
4282
+ info -> sctpi_p_ssthresh = prim -> ssthresh ;
4283
+ info -> sctpi_p_partial_bytes_acked = prim -> partial_bytes_acked ;
4284
+ info -> sctpi_p_flight_size = prim -> flight_size ;
4285
+ info -> sctpi_p_error = prim -> error_count ;
4286
+
4287
+ return 0 ;
4288
+ }
4289
+ EXPORT_SYMBOL_GPL (sctp_get_sctp_info );
4290
+
4205
4291
/* 7.2.1 Association Status (SCTP_STATUS)
4206
4292
4207
4293
* Applications can retrieve current status information about an
0 commit comments