sctputil.c (168124) | sctputil.c (168299) |
---|---|
1/*- 2 * Copyright (c) 2001-2007, 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. --- 17 unchanged lines hidden (view full) --- 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/* $KAME: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2007, 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. --- 17 unchanged lines hidden (view full) --- 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/* $KAME: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 168124 2007-03-31 11:47:30Z rrs $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 168299 2007-04-03 11:15:32Z rrs $"); |
35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_pcb.h> 38#include <netinet/sctputil.h> 39#include <netinet/sctp_var.h> 40#include <netinet/sctp_sysctl.h> 41#ifdef INET6 42#include <netinet6/sctp6_var.h> 43#endif 44#include <netinet/sctp_header.h> 45#include <netinet/sctp_output.h> 46#include <netinet/sctp_uio.h> 47#include <netinet/sctp_timer.h> 48#include <netinet/sctp_crc32.h> 49#include <netinet/sctp_indata.h>/* for sctp_deliver_data() */ 50#include <netinet/sctp_auth.h> 51#include <netinet/sctp_asconf.h> | 35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_pcb.h> 38#include <netinet/sctputil.h> 39#include <netinet/sctp_var.h> 40#include <netinet/sctp_sysctl.h> 41#ifdef INET6 42#include <netinet6/sctp6_var.h> 43#endif 44#include <netinet/sctp_header.h> 45#include <netinet/sctp_output.h> 46#include <netinet/sctp_uio.h> 47#include <netinet/sctp_timer.h> 48#include <netinet/sctp_crc32.h> 49#include <netinet/sctp_indata.h>/* for sctp_deliver_data() */ 50#include <netinet/sctp_auth.h> 51#include <netinet/sctp_asconf.h> |
52#include <netinet/sctp_bsd_addr.h> | |
53 54#define NUMBER_OF_MTU_SIZES 18 55 56 57#ifdef SCTP_STAT_LOGGING 58int global_sctp_cwnd_log_at = 0; 59int global_sctp_cwnd_log_rolled = 0; 60struct sctp_cwnd_log sctp_clog[SCTP_STAT_LOG_SIZE]; --- 3642 unchanged lines hidden (view full) --- 3703sctp_print_address(struct sockaddr *sa) 3704{ 3705 3706 if (sa->sa_family == AF_INET6) { 3707 struct sockaddr_in6 *sin6; 3708 char ip6buf[INET6_ADDRSTRLEN]; 3709 3710 sin6 = (struct sockaddr_in6 *)sa; | 52 53#define NUMBER_OF_MTU_SIZES 18 54 55 56#ifdef SCTP_STAT_LOGGING 57int global_sctp_cwnd_log_at = 0; 58int global_sctp_cwnd_log_rolled = 0; 59struct sctp_cwnd_log sctp_clog[SCTP_STAT_LOG_SIZE]; --- 3642 unchanged lines hidden (view full) --- 3702sctp_print_address(struct sockaddr *sa) 3703{ 3704 3705 if (sa->sa_family == AF_INET6) { 3706 struct sockaddr_in6 *sin6; 3707 char ip6buf[INET6_ADDRSTRLEN]; 3708 3709 sin6 = (struct sockaddr_in6 *)sa; |
3711 printf("IPv6 address: %s:%d scope:%u\n", | 3710 printf("IPv6 address: %s:port:%d scope:%u\n", |
3712 ip6_sprintf(ip6buf, &sin6->sin6_addr), 3713 ntohs(sin6->sin6_port), 3714 sin6->sin6_scope_id); 3715 } else if (sa->sa_family == AF_INET) { 3716 struct sockaddr_in *sin; 3717 unsigned char *p; 3718 3719 sin = (struct sockaddr_in *)sa; --- 55 unchanged lines hidden (view full) --- 3775 /* 3776 * go through our old INP and pull off any control structures that 3777 * belong to stcb and move then to the new inp. 3778 */ 3779 struct socket *old_so, *new_so; 3780 struct sctp_queued_to_read *control, *nctl; 3781 struct sctp_readhead tmp_queue; 3782 struct mbuf *m; | 3711 ip6_sprintf(ip6buf, &sin6->sin6_addr), 3712 ntohs(sin6->sin6_port), 3713 sin6->sin6_scope_id); 3714 } else if (sa->sa_family == AF_INET) { 3715 struct sockaddr_in *sin; 3716 unsigned char *p; 3717 3718 sin = (struct sockaddr_in *)sa; --- 55 unchanged lines hidden (view full) --- 3774 /* 3775 * go through our old INP and pull off any control structures that 3776 * belong to stcb and move then to the new inp. 3777 */ 3778 struct socket *old_so, *new_so; 3779 struct sctp_queued_to_read *control, *nctl; 3780 struct sctp_readhead tmp_queue; 3781 struct mbuf *m; |
3783 int error; | 3782 int error = 0; |
3784 3785 old_so = old_inp->sctp_socket; 3786 new_so = new_inp->sctp_socket; 3787 TAILQ_INIT(&tmp_queue); 3788 3789 SOCKBUF_LOCK(&(old_so->so_rcv)); 3790 3791 error = sblock(&old_so->so_rcv, 0); --- 494 unchanged lines hidden (view full) --- 4286struct sctp_ifa * 4287sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock) 4288{ 4289 struct sctp_ifa *sctp_ifap; 4290 struct sctp_vrf *vrf; 4291 struct sctp_ifalist *hash_head; 4292 uint32_t hash_of_addr; 4293 | 3783 3784 old_so = old_inp->sctp_socket; 3785 new_so = new_inp->sctp_socket; 3786 TAILQ_INIT(&tmp_queue); 3787 3788 SOCKBUF_LOCK(&(old_so->so_rcv)); 3789 3790 error = sblock(&old_so->so_rcv, 0); --- 494 unchanged lines hidden (view full) --- 4285struct sctp_ifa * 4286sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock) 4287{ 4288 struct sctp_ifa *sctp_ifap; 4289 struct sctp_vrf *vrf; 4290 struct sctp_ifalist *hash_head; 4291 uint32_t hash_of_addr; 4292 |
4293 if (holds_lock == 0) 4294 SCTP_IPI_ADDR_LOCK(); 4295 |
|
4294 vrf = sctp_find_vrf(vrf_id); | 4296 vrf = sctp_find_vrf(vrf_id); |
4295 if (vrf == NULL) | 4297 if (vrf == NULL) { 4298 if (holds_lock == 0) 4299 SCTP_IPI_ADDR_UNLOCK(); |
4296 return (NULL); | 4300 return (NULL); |
4297 | 4301 } |
4298 hash_of_addr = sctp_get_ifa_hash_val(addr); | 4302 hash_of_addr = sctp_get_ifa_hash_val(addr); |
4299 if (holds_lock == 0) 4300 SCTP_IPI_ADDR_LOCK(); | |
4301 4302 hash_head = &vrf->vrf_addr_hash[(hash_of_addr & vrf->vrf_hashmark)]; | 4303 4304 hash_head = &vrf->vrf_addr_hash[(hash_of_addr & vrf->vrf_hashmark)]; |
4305 if (hash_head == NULL) { 4306 printf("hash_of_addr:%x mask:%x table:%x - ", 4307 (u_int)hash_of_addr, (u_int)vrf->vrf_hashmark, 4308 (u_int)(hash_of_addr & vrf->vrf_hashmark)); 4309 sctp_print_address(addr); 4310 printf("No such bucket for address\n"); 4311 if (holds_lock == 0) 4312 SCTP_IPI_ADDR_UNLOCK(); 4313 4314 return (NULL); 4315 } |
|
4303 LIST_FOREACH(sctp_ifap, hash_head, next_bucket) { | 4316 LIST_FOREACH(sctp_ifap, hash_head, next_bucket) { |
4317 if (sctp_ifap == NULL) { 4318 panic("Huh LIST_FOREACH corrupt"); 4319 } |
|
4304 if (addr->sa_family != sctp_ifap->address.sa.sa_family) 4305 continue; 4306 if (addr->sa_family == AF_INET) { 4307 if (((struct sockaddr_in *)addr)->sin_addr.s_addr == 4308 sctp_ifap->address.sin.sin_addr.s_addr) { 4309 /* found him. */ 4310 if (holds_lock == 0) 4311 SCTP_IPI_ADDR_UNLOCK(); --- 1306 unchanged lines hidden --- | 4320 if (addr->sa_family != sctp_ifap->address.sa.sa_family) 4321 continue; 4322 if (addr->sa_family == AF_INET) { 4323 if (((struct sockaddr_in *)addr)->sin_addr.s_addr == 4324 sctp_ifap->address.sin.sin_addr.s_addr) { 4325 /* found him. */ 4326 if (holds_lock == 0) 4327 SCTP_IPI_ADDR_UNLOCK(); --- 1306 unchanged lines hidden --- |