sctp_sysctl.c (169655) | sctp_sysctl.c (170056) |
---|---|
1/*- 2 * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 15 unchanged lines hidden (view full) --- 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 15 unchanged lines hidden (view full) --- 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sys/netinet/sctp_sysctl.c 169655 2007-05-17 12:16:24Z rrs $"); | 32__FBSDID("$FreeBSD: head/sys/netinet/sctp_sysctl.c 170056 2007-05-28 11:17:24Z rrs $"); |
33 34#include <netinet/sctp_os.h> 35#include <netinet/sctp_constants.h> 36#include <netinet/sctp_sysctl.h> 37#include <netinet/sctp_pcb.h> 38#include <netinet/sctputil.h> | 33 34#include <netinet/sctp_os.h> 35#include <netinet/sctp_constants.h> 36#include <netinet/sctp_sysctl.h> 37#include <netinet/sctp_pcb.h> 38#include <netinet/sctputil.h> |
39 | 39#include <netinet/sctp_output.h> |
40/* 41 * sysctl tunable variables 42 */ 43uint32_t sctp_sendspace = (128 * 1024); 44uint32_t sctp_recvspace = 128 * (1024 + 45#ifdef INET6 46 sizeof(struct sockaddr_in6) 47#else --- 59 unchanged lines hidden (view full) --- 107struct sctpstat sctpstat; 108 109#ifdef SCTP_DEBUG 110uint32_t sctp_debug_on = 0; 111 112#endif 113 114 | 40/* 41 * sysctl tunable variables 42 */ 43uint32_t sctp_sendspace = (128 * 1024); 44uint32_t sctp_recvspace = 128 * (1024 + 45#ifdef INET6 46 sizeof(struct sockaddr_in6) 47#else --- 59 unchanged lines hidden (view full) --- 107struct sctpstat sctpstat; 108 109#ifdef SCTP_DEBUG 110uint32_t sctp_debug_on = 0; 111 112#endif 113 114 |
115 116/* It returns an upper limit. No filtering is done here */ 117static unsigned int 118number_of_addresses(struct sctp_inpcb *inp) 119{ 120 int cnt; 121 struct sctp_vrf *vrf; 122 struct sctp_ifn *sctp_ifn; 123 struct sctp_ifa *sctp_ifa; 124 struct sctp_laddr *laddr; 125 126 cnt = 0; 127 /* neither Mac OS X nor FreeBSD support mulitple routing functions */ 128 if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) { 129 return (0); 130 } 131 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { 132 LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { 133 LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) { 134 if ((sctp_ifa->address.sa.sa_family == AF_INET) || 135 (sctp_ifa->address.sa.sa_family == AF_INET6)) { 136 cnt++; 137 } 138 } 139 } 140 } else { 141 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { 142 if ((laddr->ifa->address.sa.sa_family == AF_INET) || 143 (laddr->ifa->address.sa.sa_family == AF_INET6)) { 144 cnt++; 145 } 146 } 147 } 148 return (cnt); 149} 150 151static int 152copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sysctl_req *req) 153{ 154 struct sctp_ifn *sctp_ifn; 155 struct sctp_ifa *sctp_ifa; 156 int loopback_scope, ipv4_local_scope, local_scope, site_scope; 157 int ipv4_addr_legal, ipv6_addr_legal; 158 struct sctp_vrf *vrf; 159 struct xsctp_laddr xladdr; 160 struct sctp_laddr *laddr; 161 int error; 162 163 /* Turn on all the appropriate scope */ 164 if (stcb) { 165 /* use association specific values */ 166 loopback_scope = stcb->asoc.loopback_scope; 167 ipv4_local_scope = stcb->asoc.ipv4_local_scope; 168 local_scope = stcb->asoc.local_scope; 169 site_scope = stcb->asoc.site_scope; 170 } else { 171 /* use generic values for endpoints */ 172 loopback_scope = 1; 173 ipv4_local_scope = 1; 174 local_scope = 1; 175 site_scope = 1; 176 } 177 178 /* use only address families of interest */ 179 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { 180 ipv6_addr_legal = 1; 181 if (SCTP_IPV6_V6ONLY(inp)) { 182 ipv4_addr_legal = 0; 183 } else { 184 ipv4_addr_legal = 1; 185 } 186 } else { 187 ipv4_addr_legal = 1; 188 ipv6_addr_legal = 0; 189 } 190 191 error = 0; 192 193 /* neither Mac OS X nor FreeBSD support mulitple routing functions */ 194 if ((vrf = sctp_find_vrf(inp->def_vrf_id)) == NULL) { 195 return (-1); 196 } 197 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { 198 LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { 199 if ((loopback_scope == 0) && SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) 200 /* Skip loopback if loopback_scope not set */ 201 continue; 202 LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) { 203 if (stcb) { 204 /* 205 * ignore if blacklisted at 206 * association level 207 */ 208 if (sctp_is_addr_restricted(stcb, sctp_ifa)) 209 continue; 210 } 211 if ((sctp_ifa->address.sa.sa_family == AF_INET) && (ipv4_addr_legal)) { 212 struct sockaddr_in *sin; 213 214 sin = (struct sockaddr_in *)&sctp_ifa->address.sa; 215 if (sin->sin_addr.s_addr == 0) 216 continue; 217 if ((ipv4_local_scope == 0) && (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr))) 218 continue; 219 } else if ((sctp_ifa->address.sa.sa_family == AF_INET6) && (ipv6_addr_legal)) { 220 struct sockaddr_in6 *sin6; 221 222 sin6 = (struct sockaddr_in6 *)&sctp_ifa->address.sa; 223 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) 224 continue; 225 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { 226 if (local_scope == 0) 227 continue; 228 if (sin6->sin6_scope_id == 0) { 229 /* 230 * bad link local 231 * address 232 */ 233 if (sa6_recoverscope(sin6) != 0) 234 continue; 235 } 236 } 237 if ((site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) 238 continue; 239 } else 240 continue; 241 memset((void *)&xladdr, 0, sizeof(union sctp_sockstore)); 242 memcpy((void *)&xladdr.address, (const void *)&sctp_ifa->address, sizeof(union sctp_sockstore)); 243 (void)SCTP_GETTIME_TIMEVAL(&xladdr.start_time); 244 SCTP_INP_RUNLOCK(inp); 245 SCTP_INP_INFO_RUNLOCK(); 246 error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr)); 247 if (error) 248 return (error); 249 else { 250 SCTP_INP_INFO_RLOCK(); 251 SCTP_INP_RLOCK(inp); 252 } 253 } 254 } 255 } else { 256 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { 257 /* ignore if blacklisted at association level */ 258 if (stcb && sctp_is_addr_restricted(stcb, laddr->ifa)) 259 continue; 260 memset((void *)&xladdr, 0, sizeof(union sctp_sockstore)); 261 memcpy((void *)&xladdr.address, (const void *)&laddr->ifa->address, sizeof(union sctp_sockstore)); 262 xladdr.start_time = laddr->start_time; 263 SCTP_INP_RUNLOCK(inp); 264 SCTP_INP_INFO_RUNLOCK(); 265 error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr)); 266 if (error) 267 return (error); 268 else { 269 SCTP_INP_INFO_RLOCK(); 270 SCTP_INP_RLOCK(inp); 271 } 272 } 273 } 274 memset((void *)&xladdr, 0, sizeof(union sctp_sockstore)); 275 xladdr.last = 1; 276 error = SYSCTL_OUT(req, &xladdr, sizeof(struct xsctp_laddr)); 277 if (error) 278 return (error); 279 else 280 return (0); 281} 282 |
|
115/* 116 * sysctl functions 117 */ 118static int 119sctp_assoclist(SYSCTL_HANDLER_ARGS) 120{ 121 unsigned int number_of_endpoints; 122 unsigned int number_of_local_addresses; 123 unsigned int number_of_associations; 124 unsigned int number_of_remote_addresses; 125 unsigned int n; 126 int error; 127 struct sctp_inpcb *inp; 128 struct sctp_tcb *stcb; 129 struct sctp_nets *net; | 283/* 284 * sysctl functions 285 */ 286static int 287sctp_assoclist(SYSCTL_HANDLER_ARGS) 288{ 289 unsigned int number_of_endpoints; 290 unsigned int number_of_local_addresses; 291 unsigned int number_of_associations; 292 unsigned int number_of_remote_addresses; 293 unsigned int n; 294 int error; 295 struct sctp_inpcb *inp; 296 struct sctp_tcb *stcb; 297 struct sctp_nets *net; |
130 struct sctp_laddr *laddr; | |
131 struct xsctp_inpcb xinpcb; 132 struct xsctp_tcb xstcb; | 298 struct xsctp_inpcb xinpcb; 299 struct xsctp_tcb xstcb; |
133 134/* struct xsctp_laddr xladdr; */ | |
135 struct xsctp_raddr xraddr; 136 137 number_of_endpoints = 0; 138 number_of_local_addresses = 0; 139 number_of_associations = 0; 140 number_of_remote_addresses = 0; 141 142 SCTP_INP_INFO_RLOCK(); 143 if (req->oldptr == USER_ADDR_NULL) { 144 LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) { 145 SCTP_INP_RLOCK(inp); 146 number_of_endpoints++; | 300 struct xsctp_raddr xraddr; 301 302 number_of_endpoints = 0; 303 number_of_local_addresses = 0; 304 number_of_associations = 0; 305 number_of_remote_addresses = 0; 306 307 SCTP_INP_INFO_RLOCK(); 308 if (req->oldptr == USER_ADDR_NULL) { 309 LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) { 310 SCTP_INP_RLOCK(inp); 311 number_of_endpoints++; |
147 /* FIXME MT */ 148 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { 149 number_of_local_addresses++; 150 } | 312 number_of_local_addresses += number_of_addresses(inp); |
151 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { 152 number_of_associations++; | 313 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { 314 number_of_associations++; |
315 number_of_local_addresses += number_of_addresses(inp); |
|
153 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { 154 number_of_remote_addresses++; 155 } 156 } 157 SCTP_INP_RUNLOCK(inp); 158 } 159 SCTP_INP_INFO_RUNLOCK(); 160 n = (number_of_endpoints + 1) * sizeof(struct xsctp_inpcb) + | 316 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { 317 number_of_remote_addresses++; 318 } 319 } 320 SCTP_INP_RUNLOCK(inp); 321 } 322 SCTP_INP_INFO_RUNLOCK(); 323 n = (number_of_endpoints + 1) * sizeof(struct xsctp_inpcb) + |
161 number_of_local_addresses * sizeof(struct xsctp_laddr) + 162 number_of_associations * sizeof(struct xsctp_tcb) + 163 number_of_remote_addresses * sizeof(struct xsctp_raddr); 164#ifdef SCTP_DEBUG 165 printf("inps = %u, stcbs = %u, laddrs = %u, raddrs = %u\n", 166 number_of_endpoints, number_of_associations, 167 number_of_local_addresses, number_of_remote_addresses); 168#endif | 324 (number_of_local_addresses + number_of_endpoints + number_of_associations) * sizeof(struct xsctp_laddr) + 325 (number_of_associations + number_of_endpoints) * sizeof(struct xsctp_tcb) + 326 (number_of_remote_addresses + number_of_associations) * sizeof(struct xsctp_raddr); 327 |
169 /* request some more memory than needed */ 170 req->oldidx = (n + n / 8); 171 return 0; 172 } 173 if (req->newptr != USER_ADDR_NULL) { 174 SCTP_INP_INFO_RUNLOCK(); 175 return EPERM; 176 } 177 LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) { 178 SCTP_INP_RLOCK(inp); | 328 /* request some more memory than needed */ 329 req->oldidx = (n + n / 8); 330 return 0; 331 } 332 if (req->newptr != USER_ADDR_NULL) { 333 SCTP_INP_INFO_RUNLOCK(); 334 return EPERM; 335 } 336 LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) { 337 SCTP_INP_RLOCK(inp); |
179 number_of_local_addresses = 0; 180 number_of_associations = 0; 181 /* 182 * LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) 183 * { number_of_local_addresses++; } 184 */ 185 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { 186 number_of_associations++; 187 } | |
188 xinpcb.last = 0; 189 xinpcb.local_port = ntohs(inp->sctp_lport); | 338 xinpcb.last = 0; 339 xinpcb.local_port = ntohs(inp->sctp_lport); |
190 xinpcb.number_local_addresses = number_of_local_addresses; 191 xinpcb.number_associations = number_of_associations; | |
192 xinpcb.flags = inp->sctp_flags; 193 xinpcb.features = inp->sctp_features; 194 xinpcb.total_sends = inp->total_sends; 195 xinpcb.total_recvs = inp->total_recvs; 196 xinpcb.total_nospaces = inp->total_nospaces; 197 xinpcb.fragmentation_point = inp->sctp_frag_point; | 340 xinpcb.flags = inp->sctp_flags; 341 xinpcb.features = inp->sctp_features; 342 xinpcb.total_sends = inp->total_sends; 343 xinpcb.total_recvs = inp->total_recvs; 344 xinpcb.total_nospaces = inp->total_nospaces; 345 xinpcb.fragmentation_point = inp->sctp_frag_point; |
198 if (inp->sctp_socket != NULL) { 199 sotoxsocket(inp->sctp_socket, &xinpcb.xsocket); 200 } else { 201 bzero(&xinpcb.xsocket, sizeof xinpcb.xsocket); 202 xinpcb.xsocket.xso_protocol = IPPROTO_SCTP; 203 } | 346 xinpcb.qlen = inp->sctp_socket->so_qlen; 347 xinpcb.maxqlen = inp->sctp_socket->so_qlimit; |
204 SCTP_INP_INCR_REF(inp); 205 SCTP_INP_RUNLOCK(inp); 206 SCTP_INP_INFO_RUNLOCK(); 207 error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb)); 208 if (error) { | 348 SCTP_INP_INCR_REF(inp); 349 SCTP_INP_RUNLOCK(inp); 350 SCTP_INP_INFO_RUNLOCK(); 351 error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb)); 352 if (error) { |
353 SCTP_INP_DECR_REF(inp); |
|
209 return error; 210 } 211 SCTP_INP_INFO_RLOCK(); 212 SCTP_INP_RLOCK(inp); | 354 return error; 355 } 356 SCTP_INP_INFO_RLOCK(); 357 SCTP_INP_RLOCK(inp); |
213 /* FIXME MT */ 214 /* 215 * LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) 216 * { error = SYSCTL_OUT(req, &xladdr, sizeof(struct 217 * xsctp_laddr)); if (error) { #if 218 * defined(SCTP_PER_SOCKET_LOCKING) 219 * SCTP_SOCKET_UNLOCK(SCTP_INP_SO(inp), 1); 220 * SCTP_UNLOCK_SHARED(sctppcbinfo.ipi_ep_mtx); #endif 221 * SCTP_INP_RUNLOCK(inp); SCTP_INP_INFO_RUNLOCK(); return 222 * error; } } 223 */ | 358 error = copy_out_local_addresses(inp, NULL, req); 359 if (error) { 360 SCTP_INP_DECR_REF(inp); 361 return error; 362 } |
224 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { 225 SCTP_TCB_LOCK(stcb); 226 atomic_add_int(&stcb->asoc.refcnt, 1); 227 SCTP_TCB_UNLOCK(stcb); | 363 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { 364 SCTP_TCB_LOCK(stcb); 365 atomic_add_int(&stcb->asoc.refcnt, 1); 366 SCTP_TCB_UNLOCK(stcb); |
228 number_of_local_addresses = 0; 229 number_of_remote_addresses = 0; 230 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { 231 number_of_remote_addresses++; 232 } 233 xstcb.LocalPort = ntohs(inp->sctp_lport); 234 xstcb.RemPort = ntohs(stcb->rport); | 367 xstcb.last = 0; 368 xstcb.local_port = ntohs(inp->sctp_lport); 369 xstcb.remote_port = ntohs(stcb->rport); |
235 if (stcb->asoc.primary_destination != NULL) | 370 if (stcb->asoc.primary_destination != NULL) |
236 xstcb.RemPrimAddr = stcb->asoc.primary_destination->ro._l_addr; 237 xstcb.HeartBeatInterval = stcb->asoc.heart_beat_delay; 238 xstcb.State = SCTP_GET_STATE(&stcb->asoc); /* FIXME */ 239 xstcb.InStreams = stcb->asoc.streamincnt; 240 xstcb.OutStreams = stcb->asoc.streamoutcnt; 241 xstcb.MaxRetr = stcb->asoc.overall_error_count; 242 xstcb.PrimProcess = 0; /* not really supported yet */ 243 xstcb.T1expireds = stcb->asoc.timoinit + stcb->asoc.timocookie; 244 xstcb.T2expireds = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack; 245 xstcb.RtxChunks = stcb->asoc.marked_retrans; 246 xstcb.StartTime = stcb->asoc.start_time; 247 xstcb.DiscontinuityTime = stcb->asoc.discontinuity_time; | 371 xstcb.primary_addr = stcb->asoc.primary_destination->ro._l_addr; 372 xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay; 373 xstcb.state = SCTP_GET_STATE(&stcb->asoc); /* FIXME */ 374 xstcb.in_streams = stcb->asoc.streamincnt; 375 xstcb.out_streams = stcb->asoc.streamoutcnt; 376 xstcb.max_nr_retrans = stcb->asoc.overall_error_count; 377 xstcb.primary_process = 0; /* not really supported 378 * yet */ 379 xstcb.T1_expireries = stcb->asoc.timoinit + stcb->asoc.timocookie; 380 xstcb.T2_expireries = stcb->asoc.timoshutdown + stcb->asoc.timoshutdownack; 381 xstcb.retransmitted_tsns = stcb->asoc.marked_retrans; 382 xstcb.start_time = stcb->asoc.start_time; 383 xstcb.discontinuity_time = stcb->asoc.discontinuity_time; |
248 | 384 |
249 xstcb.number_local_addresses = number_of_local_addresses; 250 xstcb.number_remote_addresses = number_of_remote_addresses; | |
251 xstcb.total_sends = stcb->total_sends; 252 xstcb.total_recvs = stcb->total_recvs; 253 xstcb.local_tag = stcb->asoc.my_vtag; 254 xstcb.remote_tag = stcb->asoc.peer_vtag; 255 xstcb.initial_tsn = stcb->asoc.init_seq_number; 256 xstcb.highest_tsn = stcb->asoc.sending_seq - 1; 257 xstcb.cumulative_tsn = stcb->asoc.last_acked_seq; 258 xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn; 259 xstcb.mtu = stcb->asoc.smallest_mtu; 260 SCTP_INP_RUNLOCK(inp); 261 SCTP_INP_INFO_RUNLOCK(); 262 error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb)); 263 if (error) { | 385 xstcb.total_sends = stcb->total_sends; 386 xstcb.total_recvs = stcb->total_recvs; 387 xstcb.local_tag = stcb->asoc.my_vtag; 388 xstcb.remote_tag = stcb->asoc.peer_vtag; 389 xstcb.initial_tsn = stcb->asoc.init_seq_number; 390 xstcb.highest_tsn = stcb->asoc.sending_seq - 1; 391 xstcb.cumulative_tsn = stcb->asoc.last_acked_seq; 392 xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn; 393 xstcb.mtu = stcb->asoc.smallest_mtu; 394 SCTP_INP_RUNLOCK(inp); 395 SCTP_INP_INFO_RUNLOCK(); 396 error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb)); 397 if (error) { |
398 SCTP_INP_DECR_REF(inp); |
|
264 atomic_add_int(&stcb->asoc.refcnt, -1); 265 return error; 266 } | 399 atomic_add_int(&stcb->asoc.refcnt, -1); 400 return error; 401 } |
402 SCTP_INP_INFO_RLOCK(); 403 SCTP_INP_RLOCK(inp); 404 error = copy_out_local_addresses(inp, stcb, req); 405 if (error) { 406 SCTP_INP_DECR_REF(inp); 407 atomic_add_int(&stcb->asoc.refcnt, -1); 408 return error; 409 } |
|
267 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { | 410 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { |
268 xraddr.RemAddr = net->ro._l_addr; 269 xraddr.RemAddrActive = ((net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE); 270 xraddr.RemAddrConfirmed = ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0); 271 xraddr.RemAddrHBActive = ((net->dest_state & SCTP_ADDR_NOHB) == 0); 272 xraddr.RemAddrRTO = net->RTO; 273 xraddr.RemAddrMaxPathRtx = net->failure_threshold; 274 xraddr.RemAddrRtx = net->marked_retrans; 275 xraddr.RemAddrErrorCounter = net->error_count; 276 xraddr.RemAddrCwnd = net->cwnd; 277 xraddr.RemAddrFlightSize = net->flight_size; 278 xraddr.RemAddrStartTime = net->start_time; 279 xraddr.RemAddrMTU = net->mtu; | 411 xraddr.last = 0; 412 xraddr.address = net->ro._l_addr; 413 xraddr.active = ((net->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE); 414 xraddr.confirmed = ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0); 415 xraddr.heartbeat_enabled = ((net->dest_state & SCTP_ADDR_NOHB) == 0); 416 xraddr.rto = net->RTO; 417 xraddr.max_path_rtx = net->failure_threshold; 418 xraddr.rtx = net->marked_retrans; 419 xraddr.error_counter = net->error_count; 420 xraddr.cwnd = net->cwnd; 421 xraddr.flight_size = net->flight_size; 422 xraddr.mtu = net->mtu; 423 xraddr.start_time = net->start_time; 424 SCTP_INP_RUNLOCK(inp); 425 SCTP_INP_INFO_RUNLOCK(); |
280 error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr)); 281 if (error) { | 426 error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr)); 427 if (error) { |
428 SCTP_INP_DECR_REF(inp); |
|
282 atomic_add_int(&stcb->asoc.refcnt, -1); 283 return error; 284 } | 429 atomic_add_int(&stcb->asoc.refcnt, -1); 430 return error; 431 } |
432 SCTP_INP_INFO_RLOCK(); 433 SCTP_INP_RLOCK(inp); |
|
285 } 286 atomic_add_int(&stcb->asoc.refcnt, -1); | 434 } 435 atomic_add_int(&stcb->asoc.refcnt, -1); |
436 memset((void *)&xraddr, 0, sizeof(struct xsctp_raddr)); 437 xraddr.last = 1; 438 SCTP_INP_RUNLOCK(inp); 439 SCTP_INP_INFO_RUNLOCK(); 440 error = SYSCTL_OUT(req, &xraddr, sizeof(struct xsctp_raddr)); 441 if (error) { 442 SCTP_INP_DECR_REF(inp); 443 return error; 444 } |
|
287 SCTP_INP_INFO_RLOCK(); 288 SCTP_INP_RLOCK(inp); 289 } | 445 SCTP_INP_INFO_RLOCK(); 446 SCTP_INP_RLOCK(inp); 447 } |
290 SCTP_INP_DECR_REF(inp); | |
291 SCTP_INP_RUNLOCK(inp); | 448 SCTP_INP_RUNLOCK(inp); |
449 SCTP_INP_INFO_RUNLOCK(); 450 memset((void *)&xstcb, 0, sizeof(struct xsctp_tcb)); 451 xstcb.last = 1; 452 error = SYSCTL_OUT(req, &xstcb, sizeof(struct xsctp_tcb)); 453 if (error) { 454 return error; 455 } 456 SCTP_INP_INFO_RLOCK(); 457 SCTP_INP_DECR_REF(inp); |
|
292 } 293 SCTP_INP_INFO_RUNLOCK(); 294 | 458 } 459 SCTP_INP_INFO_RUNLOCK(); 460 |
461 memset((void *)&xinpcb, 0, sizeof(struct xsctp_inpcb)); |
|
295 xinpcb.last = 1; | 462 xinpcb.last = 1; |
296 xinpcb.local_port = 0; 297 xinpcb.number_local_addresses = 0; 298 xinpcb.number_associations = 0; 299 xinpcb.flags = 0; 300 xinpcb.features = 0; | |
301 error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb)); 302 return error; 303} 304 305 306/* 307 * sysctl definitions 308 */ --- 209 unchanged lines hidden --- | 463 error = SYSCTL_OUT(req, &xinpcb, sizeof(struct xsctp_inpcb)); 464 return error; 465} 466 467 468/* 469 * sysctl definitions 470 */ --- 209 unchanged lines hidden --- |