Mercurial > hg > freeDiameter
comparison libfdcore/sctp.c @ 1107:96f2051215c8
Replaced calls to TRACE_sSA and sSA_DUMP_NODE* macros
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Sun, 12 May 2013 16:39:07 +0200 |
parents | 1d7b3ebda27f |
children | b72836fb814b |
comparison
equal
deleted
inserted
replaced
1106:8401adfb58f5 | 1107:96f2051215c8 |
---|---|
736 /* None of the addresses in the list came from configuration, we bind to default */ | 736 /* None of the addresses in the list came from configuration, we bind to default */ |
737 bind_default = 1; | 737 bind_default = 1; |
738 goto redo; | 738 goto redo; |
739 } | 739 } |
740 | 740 |
741 if (TRACE_BOOL(SCTP_LEVEL)) { | 741 #if 0 |
742 union { | 742 union { |
743 sSA *sa; | 743 sSA *sa; |
744 uint8_t *buf; | 744 uint8_t *buf; |
745 } ptr; | 745 } ptr; |
746 int i; | 746 int i; |
748 fd_log_debug("Calling sctp_bindx with the following address array:"); | 748 fd_log_debug("Calling sctp_bindx with the following address array:"); |
749 for (i = 0; i < count; i++) { | 749 for (i = 0; i < count; i++) { |
750 TRACE_sSA(FD_LOG_DEBUG, FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); | 750 TRACE_sSA(FD_LOG_DEBUG, FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); |
751 ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6) ; | 751 ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6) ; |
752 } | 752 } |
753 } | 753 #endif |
754 | 754 |
755 /* Bind to this array */ | 755 /* Bind to this array */ |
756 CHECK_SYS( sctp_bindx(*sock, sar, count, SCTP_BINDX_ADD_ADDR) ); | 756 CHECK_SYS( sctp_bindx(*sock, sar, count, SCTP_BINDX_ADD_ADDR) ); |
757 | 757 |
758 /* We don't need sar anymore */ | 758 /* We don't need sar anymore */ |
761 | 761 |
762 /* Now, the server is bound, set remaining sockopt */ | 762 /* Now, the server is bound, set remaining sockopt */ |
763 CHECK_FCT( fd_setsockopt_postbind(*sock, bind_default) ); | 763 CHECK_FCT( fd_setsockopt_postbind(*sock, bind_default) ); |
764 | 764 |
765 /* Debug: show all local listening addresses */ | 765 /* Debug: show all local listening addresses */ |
766 if (TRACE_BOOL(SCTP_LEVEL)) { | 766 #if 0 |
767 sSA *sar; | 767 sSA *sar; |
768 union { | 768 union { |
769 sSA *sa; | 769 sSA *sa; |
770 uint8_t *buf; | 770 uint8_t *buf; |
771 } ptr; | 771 } ptr; |
776 fd_log_debug("SCTP server bound on :"); | 776 fd_log_debug("SCTP server bound on :"); |
777 for (ptr.sa = sar; sz-- > 0; ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6)) { | 777 for (ptr.sa = sar; sz-- > 0; ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6)) { |
778 TRACE_sSA(FD_LOG_DEBUG, FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); | 778 TRACE_sSA(FD_LOG_DEBUG, FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); |
779 } | 779 } |
780 sctp_freeladdrs(sar); | 780 sctp_freeladdrs(sar); |
781 } | 781 #endif |
782 | 782 |
783 return 0; | 783 return 0; |
784 } | 784 } |
785 | 785 |
786 /* Allow clients connections on server sockets */ | 786 /* Allow clients connections on server sockets */ |
827 CHECK_FCT_DO( ret = add_addresses_from_list_mask(&sar.buf, &size, &count, family, htons(port), list, EP_FL_CONF, EP_FL_CONF ), goto out ); | 827 CHECK_FCT_DO( ret = add_addresses_from_list_mask(&sar.buf, &size, &count, family, htons(port), list, EP_FL_CONF, EP_FL_CONF ), goto out ); |
828 CHECK_FCT_DO( ret = add_addresses_from_list_mask(&sar.buf, &size, &count, family, htons(port), list, EP_FL_CONF | EP_FL_DISC, EP_FL_DISC ), goto out ); | 828 CHECK_FCT_DO( ret = add_addresses_from_list_mask(&sar.buf, &size, &count, family, htons(port), list, EP_FL_CONF | EP_FL_DISC, EP_FL_DISC ), goto out ); |
829 CHECK_FCT_DO( ret = add_addresses_from_list_mask(&sar.buf, &size, &count, family, htons(port), list, EP_FL_CONF | EP_FL_DISC, 0 ), goto out ); | 829 CHECK_FCT_DO( ret = add_addresses_from_list_mask(&sar.buf, &size, &count, family, htons(port), list, EP_FL_CONF | EP_FL_DISC, 0 ), goto out ); |
830 | 830 |
831 /* Try connecting */ | 831 /* Try connecting */ |
832 if (TRACE_BOOL(FULL)) { | 832 LOG_A("Attempting SCTP connection (%d addresses attempted) ", count); |
833 TRACE_DEBUG(FULL, "Attempting SCTP connection (%d addresses attempted) :", count); | 833 |
834 #if 0 | |
834 /* Dump the SAs */ | 835 /* Dump the SAs */ |
835 union { | 836 union { |
836 uint8_t *buf; | 837 uint8_t *buf; |
837 sSA *sa; | 838 sSA *sa; |
838 sSA4 *sin; | 839 sSA4 *sin; |
842 ptr.buf = sar.buf; | 843 ptr.buf = sar.buf; |
843 for (i=0; i< count; i++) { | 844 for (i=0; i< count; i++) { |
844 TRACE_sSA(FD_LOG_DEBUG, FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); | 845 TRACE_sSA(FD_LOG_DEBUG, FULL, " - ", ptr.sa, NI_NUMERICHOST | NI_NUMERICSERV, "" ); |
845 ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6); | 846 ptr.buf += (ptr.sa->sa_family == AF_INET) ? sizeof(sSA4) : sizeof(sSA6); |
846 } | 847 } |
847 } | 848 #endif |
848 | 849 |
849 #ifdef SCTP_CONNECTX_4_ARGS | 850 #ifdef SCTP_CONNECTX_4_ARGS |
850 ret = sctp_connectx(*sock, sar.sa, count, NULL); | 851 ret = sctp_connectx(*sock, sar.sa, count, NULL); |
851 #else /* SCTP_CONNECTX_4_ARGS */ | 852 #else /* SCTP_CONNECTX_4_ARGS */ |
852 ret = sctp_connectx(*sock, sar.sa, count); | 853 ret = sctp_connectx(*sock, sar.sa, count); |
905 if (sz != sizeof(status)) | 906 if (sz != sizeof(status)) |
906 { | 907 { |
907 TRACE_DEBUG(INFO, "Invalid size of socket option: %d / %zd", sz, sizeof(status)); | 908 TRACE_DEBUG(INFO, "Invalid size of socket option: %d / %zd", sz, sizeof(status)); |
908 return ENOTSUP; | 909 return ENOTSUP; |
909 } | 910 } |
910 if (TRACE_BOOL(SCTP_LEVEL)) { | 911 #if 0 |
911 char buf[1024]; | 912 char sa_buf[sSA_DUMP_STRLEN]; |
912 sSA_DUMP_NODE_SERV(buf, sizeof(buf), &status.sstat_primary.spinfo_address, NI_NUMERICHOST | NI_NUMERICSERV ); | 913 fd_sa_sdump_numeric(sa_buf, &status.sstat_primary.spinfo_address); |
913 fd_log_debug( "SCTP_STATUS : sstat_state : %i" , status.sstat_state); | 914 fd_log_debug( "SCTP_STATUS : sstat_state : %i" , status.sstat_state); |
914 fd_log_debug( " sstat_rwnd : %u" , status.sstat_rwnd); | 915 fd_log_debug( " sstat_rwnd : %u" , status.sstat_rwnd); |
915 fd_log_debug( " sstat_unackdata : %hu", status.sstat_unackdata); | 916 fd_log_debug( " sstat_unackdata : %hu", status.sstat_unackdata); |
916 fd_log_debug( " sstat_penddata : %hu", status.sstat_penddata); | 917 fd_log_debug( " sstat_penddata : %hu", status.sstat_penddata); |
917 fd_log_debug( " sstat_instrms : %hu", status.sstat_instrms); | 918 fd_log_debug( " sstat_instrms : %hu", status.sstat_instrms); |
918 fd_log_debug( " sstat_outstrms : %hu", status.sstat_outstrms); | 919 fd_log_debug( " sstat_outstrms : %hu", status.sstat_outstrms); |
919 fd_log_debug( " sstat_fragmentation_point : %u" , status.sstat_fragmentation_point); | 920 fd_log_debug( " sstat_fragmentation_point : %u" , status.sstat_fragmentation_point); |
920 fd_log_debug( " sstat_primary.spinfo_address : %s" , buf); | 921 fd_log_debug( " sstat_primary.spinfo_address : %s" , sa_buf); |
921 fd_log_debug( " sstat_primary.spinfo_state : %d" , status.sstat_primary.spinfo_state); | 922 fd_log_debug( " sstat_primary.spinfo_state : %d" , status.sstat_primary.spinfo_state); |
922 fd_log_debug( " sstat_primary.spinfo_cwnd : %u" , status.sstat_primary.spinfo_cwnd); | 923 fd_log_debug( " sstat_primary.spinfo_cwnd : %u" , status.sstat_primary.spinfo_cwnd); |
923 fd_log_debug( " sstat_primary.spinfo_srtt : %u" , status.sstat_primary.spinfo_srtt); | 924 fd_log_debug( " sstat_primary.spinfo_srtt : %u" , status.sstat_primary.spinfo_srtt); |
924 fd_log_debug( " sstat_primary.spinfo_rto : %u" , status.sstat_primary.spinfo_rto); | 925 fd_log_debug( " sstat_primary.spinfo_rto : %u" , status.sstat_primary.spinfo_rto); |
925 fd_log_debug( " sstat_primary.spinfo_mtu : %u" , status.sstat_primary.spinfo_mtu); | 926 fd_log_debug( " sstat_primary.spinfo_mtu : %u" , status.sstat_primary.spinfo_mtu); |
926 } | 927 #endif /* 0 */ |
927 | 928 |
928 *in = status.sstat_instrms; | 929 *in = status.sstat_instrms; |
929 *out = status.sstat_outstrms; | 930 *out = status.sstat_outstrms; |
930 | 931 |
931 if (primary) | 932 if (primary) |
1147 *event = FDEVP_CNX_EP_CHANGE; | 1148 *event = FDEVP_CNX_EP_CHANGE; |
1148 break; | 1149 break; |
1149 | 1150 |
1150 case SCTP_PEER_ADDR_CHANGE: | 1151 case SCTP_PEER_ADDR_CHANGE: |
1151 TRACE_DEBUG(FULL, "Received SCTP_PEER_ADDR_CHANGE notification"); | 1152 TRACE_DEBUG(FULL, "Received SCTP_PEER_ADDR_CHANGE notification"); |
1152 TRACE_sSA(FD_LOG_DEBUG, SCTP_LEVEL, " intf_change : ", &(notif->sn_paddr_change.spc_aaddr), NI_NUMERICHOST | NI_NUMERICSERV, "" ); | 1153 /* TRACE_sSA(FD_LOG_DEBUG, SCTP_LEVEL, " intf_change : ", &(notif->sn_paddr_change.spc_aaddr), NI_NUMERICHOST | NI_NUMERICSERV, "" ); */ |
1153 TRACE_DEBUG(SCTP_LEVEL, " state : %d", notif->sn_paddr_change.spc_state); | 1154 TRACE_DEBUG(SCTP_LEVEL, " state : %d", notif->sn_paddr_change.spc_state); |
1154 TRACE_DEBUG(SCTP_LEVEL, " error : %d", notif->sn_paddr_change.spc_error); | 1155 TRACE_DEBUG(SCTP_LEVEL, " error : %d", notif->sn_paddr_change.spc_error); |
1155 | 1156 |
1156 *event = FDEVP_CNX_EP_CHANGE; | 1157 *event = FDEVP_CNX_EP_CHANGE; |
1157 break; | 1158 break; |