svn commit: r214876 - head/sys/netinet
Author: tuexen Date: Sat Nov 6 13:30:54 2010 New Revision: 214876 URL: http://svn.freebsd.org/changeset/base/214876 Log: * Fix an accounting bug regarding SACK/NR-SACK chunks. * Fix the generation of the SACK/NR-SACK gap lists. MFC after: 3 days. Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sat Nov 6 13:03:33 2010 (r214875) +++ head/sys/netinet/sctp_output.c Sat Nov 6 13:30:54 2010 (r214876) @@ -9927,7 +9927,7 @@ sctp_send_sack(struct sctp_tcb *stcb) caddr_t limit; uint32_t *dup; int limit_reached = 0; - unsigned int i, sel_start, siz, j, starting_index; + unsigned int i, sel_start, siz, j; unsigned int num_gap_blocks = 0, num_nr_gap_blocks = 0, space; int num_dups = 0; int space_req; @@ -9954,7 +9954,7 @@ sctp_send_sack(struct sctp_tcb *stcb) if (chk-rec.chunk_id.id == type) { /* Hmm, found a sack already on queue, remove it */ TAILQ_REMOVE(asoc-control_send_queue, chk, sctp_next); - asoc-ctrl_queue_cnt++; + asoc-ctrl_queue_cnt--; a_chk = chk; if (a_chk-data) { sctp_m_freem(a_chk-data); @@ -9993,15 +9993,13 @@ sctp_send_sack(struct sctp_tcb *stcb) a_chk-whoTo = NULL; if ((asoc-numduptsns) || - (asoc-last_data_chunk_from-dest_state SCTP_ADDR_NOT_REACHABLE) - ) { + (asoc-last_data_chunk_from-dest_state SCTP_ADDR_NOT_REACHABLE)) { /*- * Ok, we have some duplicates or the destination for the * sack is unreachable, lets see if we can select an * alternate than asoc-last_data_chunk_from */ - if ((!(asoc-last_data_chunk_from-dest_state - SCTP_ADDR_NOT_REACHABLE)) + if ((!(asoc-last_data_chunk_from-dest_state SCTP_ADDR_NOT_REACHABLE)) (asoc-used_alt_onsack asoc-numnets)) { /* We used an alt last time, don't this time */ a_chk-whoTo = NULL; @@ -10120,53 +10118,25 @@ sctp_send_sack(struct sctp_tcb *stcb) } } - if (compare_with_wrap(asoc-mapping_array_base_tsn, asoc-cumulative_tsn, MAX_TSN)) { - offset = 1; - /*- -* The base TSN is intialized to be the first TSN the peer -* will send us. If the cum-ack is behind this then when they -* send us the next in sequence it will mark the base_tsn bit. -* Thus we need to use the very first selector and the offset -* is 1. Our table is built for this case. -*/ - starting_index = 0; + if (((type == SCTP_SELECTIVE_ACK) + (((asoc-mapping_array[0] | asoc-nr_mapping_array[0]) 0x01) == 0x00)) || + ((type == SCTP_NR_SELECTIVE_ACK) + ((asoc-mapping_array[0] 0x01) == 0x00))) { sel_start = 0; } else { - /*- -* we skip the first selector when the cum-ack is at or above the -* mapping array base. This is because the bits at the base or above -* are turned on and our first selector in the table assumes they are -* off. We thus will use the second selector (first is 0). We use -* the reverse of our macro to fix the offset, in bits, that our -* table is at. Note that this method assumes that the cum-tsn is -* within the first bit, i.e. its value is 0-7 which means the -* result to our offset will be either a 0 - -7. If the cumack -* is NOT in the first byte (0) (which it should be since we did -* a mapping array slide above) then we need to calculate the starting -* index i.e. which byte of the mapping array we should start at. We -* do this by dividing by 8 and pushing the remainder (mod) into offset. -* then we multiply the offset to be negative, since we need a negative -* offset into the selector table. -*/ - SCTP_CALC_TSN_TO_GAP(offset, asoc-cumulative_tsn, asoc-mapping_array_base_tsn); - if (offset 7) { - starting_index = offset / 8; - offset = offset % 8; - printf(Strange starting index is %d offset:%d (not 0/x)\n, - starting_index, offset); - } else { - starting_index = 0; - } - /* We need a negative offset in our table */ -
svn commit: r214877 - head/sys/netinet
Author: tuexen Date: Sat Nov 6 13:43:18 2010 New Revision: 214877 URL: http://svn.freebsd.org/changeset/base/214877 Log: Do not resend DATA chunks without delay when dropped by the peer and the CRC was correct. MFC after: 3 days. Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sat Nov 6 13:30:54 2010 (r214876) +++ head/sys/netinet/sctp_input.c Sat Nov 6 13:43:18 2010 (r214877) @@ -3115,6 +3115,10 @@ process_chunk_drop(struct sctp_tcb *stcb if ((tp1) (tp1-sent SCTP_DATAGRAM_ACKED)) { uint8_t *ddp; + if (((flg SCTP_BADCRC) == 0) + ((flg SCTP_FROM_MIDDLE_BOX) == 0)) { + return (0); + } if ((stcb-asoc.peers_rwnd == 0) ((flg SCTP_FROM_MIDDLE_BOX) == 0)) { SCTP_STAT_INCR(sctps_pdrpdiwnp); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r214918 - head/sys/netinet
Author: tuexen Date: Sun Nov 7 14:39:40 2010 New Revision: 214918 URL: http://svn.freebsd.org/changeset/base/214918 Log: Not only stop all timers when entering the SHUTDOWN_SENT state, but also when entering the SHUTDOWN_ACK_SEND state. MFC after: 3 days. Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Sun Nov 7 14:28:01 2010 (r214917) +++ head/sys/netinet/sctp_indata.c Sun Nov 7 14:39:40 2010 (r214918) @@ -4369,7 +4369,7 @@ again: SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); sctp_send_shutdown_ack(stcb, stcb-asoc.primary_destination); - + sctp_stop_timers_for_shutdown(stcb); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb-sctp_ep, stcb, asoc-primary_destination); } @@ -5081,7 +5081,7 @@ done_with_it: SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); sctp_send_shutdown_ack(stcb, stcb-asoc.primary_destination); - + sctp_stop_timers_for_shutdown(stcb); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb-sctp_ep, stcb, asoc-primary_destination); return; Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sun Nov 7 14:28:01 2010 (r214917) +++ head/sys/netinet/sctp_input.c Sun Nov 7 14:39:40 2010 (r214918) @@ -908,9 +908,7 @@ sctp_handle_shutdown(struct sctp_shutdow } SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb-sctp_ep, stcb, net, - SCTP_FROM_SCTP_INPUT + SCTP_LOC_7); - /* start SHUTDOWN timer */ + sctp_stop_timers_for_shutdown(stcb); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb-sctp_ep, stcb, net); } Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Sun Nov 7 14:28:01 2010(r214917) +++ head/sys/netinet/sctputil.c Sun Nov 7 14:39:40 2010(r214918) @@ -725,6 +725,31 @@ sctp_audit_log(uint8_t ev, uint8_t fd) #endif /* + * sctp_stop_timers_for_shutdown() should be called + * when entering the SHUTDOWN_SENT or SHUTDOWN_ACK_SENT + * state to make sure that all timers are stopped. + */ +void +sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb) +{ + struct sctp_association *asoc; + struct sctp_nets *net; + + asoc = stcb-asoc; + + (void)SCTP_OS_TIMER_STOP(asoc-hb_timer.timer); + (void)SCTP_OS_TIMER_STOP(asoc-dack_timer.timer); + (void)SCTP_OS_TIMER_STOP(asoc-strreset_timer.timer); + (void)SCTP_OS_TIMER_STOP(asoc-asconf_timer.timer); + (void)SCTP_OS_TIMER_STOP(asoc-autoclose_timer.timer); + (void)SCTP_OS_TIMER_STOP(asoc-delayed_event_timer.timer); + TAILQ_FOREACH(net, asoc-nets, sctp_next) { + (void)SCTP_OS_TIMER_STOP(net-fr_timer.timer); + (void)SCTP_OS_TIMER_STOP(net-pmtu_timer.timer); + } +} + +/* * a list of sizes based on typical mtu's, used only if next hop size not * returned. */ @@ -749,26 +774,6 @@ static int sctp_mtu_sizes[] = { 65535 }; -void -sctp_stop_timers_for_shutdown(struct sctp_tcb *stcb) -{ - struct sctp_association *asoc; - struct sctp_nets *net; - - asoc = stcb-asoc; - - (void)SCTP_OS_TIMER_STOP(asoc-hb_timer.timer); - (void)SCTP_OS_TIMER_STOP(asoc-dack_timer.timer); - (void)SCTP_OS_TIMER_STOP(asoc-strreset_timer.timer); - (void)SCTP_OS_TIMER_STOP(asoc-asconf_timer.timer); - (void)SCTP_OS_TIMER_STOP(asoc-autoclose_timer.timer); - (void)SCTP_OS_TIMER_STOP(asoc-delayed_event_timer.timer); - TAILQ_FOREACH(net, asoc-nets, sctp_next) { - (void)SCTP_OS_TIMER_STOP(net-fr_timer.timer); - (void)SCTP_OS_TIMER_STOP(net-pmtu_timer.timer); - } -} - int find_next_best_mtu(int totsz) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r214928 - head/sys/netinet
Author: tuexen Date: Sun Nov 7 17:44:04 2010 New Revision: 214928 URL: http://svn.freebsd.org/changeset/base/214928 Log: * Use exponential backoff for retransmission of SHUTDOWN and SHUTDOWN-ACK chunks. * While there, do some cleanups. MFC after: 3 days. Modified: head/sys/netinet/sctp_timer.c Modified: head/sys/netinet/sctp_timer.c == --- head/sys/netinet/sctp_timer.c Sun Nov 7 17:41:09 2010 (r214927) +++ head/sys/netinet/sctp_timer.c Sun Nov 7 17:44:04 2010 (r214928) @@ -291,6 +291,10 @@ sctp_threshold_management(struct sctp_in return (0); } +/* + * sctp_find_alternate_net() returns a non-NULL pointer as long + * the argument net is non-NULL. + */ struct sctp_nets * sctp_find_alternate_net(struct sctp_tcb *stcb, struct sctp_nets *net, @@ -440,8 +444,7 @@ sctp_find_alternate_net(struct sctp_tcb else if (mode == 1) { TAILQ_FOREACH(mnet, stcb-asoc.nets, sctp_next) { if (((mnet-dest_state SCTP_ADDR_REACHABLE) != SCTP_ADDR_REACHABLE) || - (mnet-dest_state SCTP_ADDR_UNCONFIRMED) - ) { + (mnet-dest_state SCTP_ADDR_UNCONFIRMED)) { /* * will skip ones that are not-reachable or * unconfirmed @@ -505,12 +508,10 @@ sctp_find_alternate_net(struct sctp_tcb } alt-src_addr_selected = 0; } - if ( - ((alt-dest_state SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE) - (alt-ro.ro_rt != NULL) /* sa_ignore NO_NULL_CHK */ - (!(alt-dest_state SCTP_ADDR_UNCONFIRMED)) - ) { + if (((alt-dest_state SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE) + (alt-ro.ro_rt != NULL) + (!(alt-dest_state SCTP_ADDR_UNCONFIRMED))) { /* Found a reachable address */ break; } @@ -549,8 +550,6 @@ sctp_find_alternate_net(struct sctp_tcb return (alt); } - - static void sctp_backoff_on_timeout(struct sctp_tcb *stcb, struct sctp_nets *net, @@ -1021,8 +1020,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, * used, then pick dest with largest ssthresh for any * retransmission. */ - alt = net; - alt = sctp_find_alternate_net(stcb, alt, 1); + alt = sctp_find_alternate_net(stcb, net, 1); /* * CUCv2: If a different dest is picked for the * retransmission, then new (rtx-)pseudo_cumack needs to be @@ -1213,7 +1211,7 @@ sctp_t1init_timer(struct sctp_inpcb *inp struct sctp_nets *alt; alt = sctp_find_alternate_net(stcb, stcb-asoc.primary_destination, 0); - if ((alt != NULL) (alt != stcb-asoc.primary_destination)) { + if (alt != stcb-asoc.primary_destination) { sctp_move_chunks_from_net(stcb, stcb-asoc.primary_destination); stcb-asoc.primary_destination = alt; } @@ -1480,6 +1478,7 @@ sctp_delete_prim_timer(struct sctp_inpcb * For the shutdown and shutdown-ack, we do not keep one around on the * control queue. This means we must generate a new one and call the general * chunk output routine, AFTER having done threshold management. + * It is assumed that net is non-NULL. */ int sctp_shutdown_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, @@ -1492,18 +1491,13 @@ sctp_shutdown_timer(struct sctp_inpcb *i /* Assoc is over */ return (1); } + sctp_backoff_on_timeout(stcb, net, 1, 0, 0); /* second select an alternative */ alt = sctp_find_alternate_net(stcb, net, 0); /* third generate a shutdown into the queue for out net */ - if (alt) { - sctp_send_shutdown(stcb, alt); - } else { - /* -* if alt is NULL, there is no dest to send to?? -*/ - return (0); - } + sctp_send_shutdown(stcb, alt); + /* fourth restart timer */ sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, inp, stcb, alt); return (0); @@ -1520,6 +1514,7 @@ sctp_shutdownack_timer(struct sctp_inpcb /* Assoc is over */ return (1); } + sctp_backoff_on_timeout(stcb, net, 1, 0, 0); /* second select an alternative */ alt = sctp_find_alternate_net(stcb, net, 0); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to
svn commit: r214939 - head/sys/netinet
Author: tuexen Date: Sun Nov 7 18:50:35 2010 New Revision: 214939 URL: http://svn.freebsd.org/changeset/base/214939 Log: Do not have the MTU table twice in the code. Therefore move the function from the timer code to util, rename it appropriately and also fix a bug in sctp_get_prev_mtu(), where calling it with a value existing in the MTU table did not return a smaller one. MFC after: 3 days. Modified: head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp_timer.c == --- head/sys/netinet/sctp_timer.c Sun Nov 7 18:42:37 2010 (r214938) +++ head/sys/netinet/sctp_timer.c Sun Nov 7 18:50:35 2010 (r214939) @@ -1670,46 +1670,6 @@ sctp_heartbeat_timer(struct sctp_inpcb * return (0); } -#define SCTP_NUMBER_OF_MTU_SIZES 18 -static uint32_t mtu_sizes[] = { - 68, - 296, - 508, - 512, - 544, - 576, - 1006, - 1492, - 1500, - 1536, - 2002, - 2048, - 4352, - 4464, - 8166, - 17914, - 32000, - 65535 -}; - - -static uint32_t -sctp_getnext_mtu(struct sctp_inpcb *inp, uint32_t cur_mtu) -{ - /* select another MTU that is just bigger than this one */ - int i; - - for (i = 0; i SCTP_NUMBER_OF_MTU_SIZES; i++) { - if (cur_mtu mtu_sizes[i]) { - /* no max_mtu is bigger than this one */ - return (mtu_sizes[i]); - } - } - /* here return the highest allowable */ - return (cur_mtu); -} - - void sctp_pathmtu_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, @@ -1717,7 +1677,7 @@ sctp_pathmtu_timer(struct sctp_inpcb *in { uint32_t next_mtu, mtu; - next_mtu = sctp_getnext_mtu(inp, net-mtu); + next_mtu = sctp_get_next_mtu(inp, net-mtu); if ((next_mtu net-mtu) (net-port == 0)) { if ((net-src_addr_selected == 0) || Modified: head/sys/netinet/sctp_usrreq.c == --- head/sys/netinet/sctp_usrreq.c Sun Nov 7 18:42:37 2010 (r214938) +++ head/sys/netinet/sctp_usrreq.c Sun Nov 7 18:50:35 2010 (r214939) @@ -194,7 +194,7 @@ sctp_notify_mbuf(struct sctp_inpcb *inp, * mtu is. Rats we will have to guess (in a educated fashion * of course) */ - nxtsz = find_next_best_mtu(totsz); + nxtsz = sctp_get_prev_mtu(totsz); } /* Stop any PMTU timer */ if (SCTP_OS_TIMER_PENDING(net-pmtu_timer.timer)) { Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Sun Nov 7 18:42:37 2010(r214938) +++ head/sys/netinet/sctputil.c Sun Nov 7 18:50:35 2010(r214939) @@ -50,8 +50,6 @@ __FBSDID($FreeBSD$); #include netinet/sctp_cc_functions.h #include netinet/sctp_bsd_addr.h -#define NUMBER_OF_MTU_SIZES 18 - #ifndef KTR_SCTP #define KTR_SCTP KTR_SUBSYS @@ -753,7 +751,7 @@ sctp_stop_timers_for_shutdown(struct sct * a list of sizes based on typical mtu's, used only if next hop size not * returned. */ -static int sctp_mtu_sizes[] = { +static uint32_t sctp_mtu_sizes[] = { 68, 296, 508, @@ -774,25 +772,42 @@ static int sctp_mtu_sizes[] = { 65535 }; -int -find_next_best_mtu(int totsz) +/* + * Return the largest MTU smaller than val. If there is no + * entry, just return val. + */ +uint32_t +sctp_get_prev_mtu(uint32_t val) { - int i, perfer; + uint32_t i; - /* -* if we are in here we must find the next best fit based on the -* size of the dg that failed to be sent. -*/ - perfer = 0; - for (i = 0; i NUMBER_OF_MTU_SIZES; i++) { - if (totsz sctp_mtu_sizes[i]) { - perfer = i - 1; - if (perfer 0) - perfer = 0; + if (val = sctp_mtu_sizes[0]) { + return (val); + } + for (i = 1; i (sizeof(sctp_mtu_sizes) / sizeof(uint32_t)); i++) { + if (val = sctp_mtu_sizes[i]) { break; } } - return (sctp_mtu_sizes[perfer]); + return (sctp_mtu_sizes[i - 1]); +} + +/* + * Return the smallest MTU larger than val. If there is no + * entry, just return val. + */ +uint32_t +sctp_get_next_mtu(struct sctp_inpcb *inp, uint32_t val) +{ + /* select another MTU that is just bigger than this one */ + uint32_t i; + + for (i = 0; i (sizeof(sctp_mtu_sizes) / sizeof(uint32_t)); i++) { + if (val sctp_mtu_sizes[i]) { + return (sctp_mtu_sizes[i]); +
svn commit: r215035 - head/sys/netinet
Author: tuexen Date: Tue Nov 9 12:00:39 2010 New Revision: 215035 URL: http://svn.freebsd.org/changeset/base/215035 Log: Fix a bug which resulted in kevent() reporting an event twice on 1-to-1 style sockets when an ABORT was received. MFC after: 3 days. Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Tue Nov 9 10:59:09 2010(r215034) +++ head/sys/netinet/sctputil.c Tue Nov 9 12:00:39 2010(r215035) @@ -2826,6 +2826,7 @@ sctp_notify_assoc_change(uint32_t event, } } #endif + socantrcvmore(stcb-sctp_socket); sorwakeup(stcb-sctp_socket); sowwakeup(stcb-sctp_socket); #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r215039 - head/sys/netinet
Author: tuexen Date: Tue Nov 9 16:18:32 2010 New Revision: 215039 URL: http://svn.freebsd.org/changeset/base/215039 Log: Improve the scalability by using the local and remote port when putting inps in the tcpephash. MFC after: 3 days. Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Tue Nov 9 15:14:10 2010(r215038) +++ head/sys/netinet/sctp_pcb.c Tue Nov 9 16:18:32 2010(r215039) @@ -567,8 +567,8 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, vo } else { if (sctp_ifap-ifn_p) { /* -* The last IFN gets the address, remove -* the old one +* The last IFN gets the address, remove the +* old one */ SCTPDBG(SCTP_DEBUG_PCB4, Moving ifa %p from %s (0x%x) to %s (0x%x)\n, sctp_ifap, sctp_ifap-ifn_p-ifn_name, @@ -849,7 +849,7 @@ sctp_tcb_special_locate(struct sctp_inpc } else { return NULL; } - ephead = SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR((lport), SCTP_BASE_INFO(hashtcpmark))]; + ephead = SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR((lport | rport), SCTP_BASE_INFO(hashtcpmark))]; /* * Ok now for each of the guys in this bucket we must look and see: * - Does the remote port match. - Does there single association's @@ -1771,6 +1771,7 @@ sctp_pcb_findep(struct sockaddr *nam, in struct sockaddr_in *sin; struct sockaddr_in6 *sin6; int lport; + unsigned int i; if (nam-sa_family == AF_INET) { sin = (struct sockaddr_in *)nam; @@ -1797,17 +1798,22 @@ sctp_pcb_findep(struct sockaddr *nam, in /* * If the TCP model exists it could be that the main listening -* endpoint is gone but there exists a connected socket for this guy -* yet. If so we can return the first one that we find. This may NOT -* be the correct one so the caller should be wary on the return -* INP. Currently the only caller that sets this flag is in bindx -* where we are verifying that a user CAN bind the address. He -* either has bound it already, or someone else has, or its open to -* bind, so this is good enough. +* endpoint is gone but there still exists a connected socket for +* this guy. If so we can return the first one that we find. This +* may NOT be the correct one so the caller should be wary on the +* returned INP. Currently the only caller that sets find_tcp_pool +* is in bindx where we are verifying that a user CAN bind the +* address. He either has bound it already, or someone else has, or +* its open to bind, so this is good enough. */ if (inp == NULL find_tcp_pool) { - head = SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR(lport, SCTP_BASE_INFO(hashtcpmark))]; - inp = sctp_endpoint_probe(nam, head, lport, vrf_id); + for (i = 0; i SCTP_BASE_INFO(hashtcpmark) + 1; i++) { + head = SCTP_BASE_INFO(sctp_tcpephash)[i]; + inp = sctp_endpoint_probe(nam, head, lport, vrf_id); + if (inp) { + break; + } + } } if (inp) { SCTP_INP_INCR_REF(inp); @@ -2603,8 +2609,7 @@ sctp_move_pcb_and_assoc(struct sctp_inpc LIST_REMOVE(stcb, sctp_tcbasocidhash); } /* Now insert the new_inp into the TCP connected hash */ - head = SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR((lport), - SCTP_BASE_INFO(hashtcpmark))]; + head = SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR((lport | rport), SCTP_BASE_INFO(hashtcpmark))]; LIST_INSERT_HEAD(head, new_inp, sctp_hash); /* Its safe to access */ @@ -3089,12 +3094,10 @@ continue_anyway: /* find the bucket */ if (port_reuse_active) { /* Put it into tcp 1-2-1 hash */ - head = SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR((lport), - SCTP_BASE_INFO(hashtcpmark))]; + head = SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR(lport, SCTP_BASE_INFO(hashtcpmark))]; inp-sctp_flags |= SCTP_PCB_FLAGS_IN_TCPPOOL; } else { - head = SCTP_BASE_INFO(sctp_ephash)[SCTP_PCBHASH_ALLADDR(lport, - SCTP_BASE_INFO(hashmark))]; + head = SCTP_BASE_INFO(sctp_ephash)[SCTP_PCBHASH_ALLADDR(lport, SCTP_BASE_INFO(hashmark))]; } /* put it in the bucket */
svn commit: r215134 - head/sys/netinet
Author: tuexen Date: Thu Nov 11 18:41:03 2010 New Revision: 215134 URL: http://svn.freebsd.org/changeset/base/215134 Log: Fix the SACK/NR-SACK generation code. MFC after: 3 days. Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Thu Nov 11 18:35:28 2010 (r215133) +++ head/sys/netinet/sctp_output.c Thu Nov 11 18:41:03 2010 (r215134) @@ -10118,19 +10118,18 @@ sctp_send_sack(struct sctp_tcb *stcb) } } - if (((type == SCTP_SELECTIVE_ACK) - (((asoc-mapping_array[0] | asoc-nr_mapping_array[0]) 0x01) == 0x00)) || - ((type == SCTP_NR_SELECTIVE_ACK) - ((asoc-mapping_array[0] 0x01) == 0x00))) { - sel_start = 0; - } else { - sel_start = 1; - } if (compare_with_wrap(asoc-mapping_array_base_tsn, asoc-cumulative_tsn, MAX_TSN)) { offset = 1; } else { offset = asoc-mapping_array_base_tsn - asoc-cumulative_tsn; } + if ((offset == 1) || + ((type == SCTP_NR_SELECTIVE_ACK) + ((asoc-mapping_array[0] (1 (1 - offset))) == 0))) { + sel_start = 0; + } else { + sel_start = 1; + } if (((type == SCTP_SELECTIVE_ACK) compare_with_wrap(highest_tsn, asoc-cumulative_tsn, MAX_TSN)) || ((type == SCTP_NR_SELECTIVE_ACK) @@ -10200,7 +10199,7 @@ sctp_send_sack(struct sctp_tcb *stcb) siz = (((MAX_TSN - asoc-mapping_array_base_tsn) + 1) + asoc-highest_tsn_inside_nr_map + 7) / 8; } - if ((asoc-nr_mapping_array[0] 0x01) == 0x00) { + if ((asoc-nr_mapping_array[0] (1 (1 - offset))) == 0) { sel_start = 0; } else { sel_start = 1; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r215198 - head/sys/netinet
Author: tuexen Date: Fri Nov 12 20:45:21 2010 New Revision: 215198 URL: http://svn.freebsd.org/changeset/base/215198 Log: Fix more issues with the SACK/NR-SACK generation code. MFC after: 3 days. Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Fri Nov 12 20:26:34 2010 (r215197) +++ head/sys/netinet/sctp_output.c Fri Nov 12 20:45:21 2010 (r215198) @@ -9927,13 +9927,14 @@ sctp_send_sack(struct sctp_tcb *stcb) caddr_t limit; uint32_t *dup; int limit_reached = 0; - unsigned int i, sel_start, siz, j; + unsigned int i, siz, j; unsigned int num_gap_blocks = 0, num_nr_gap_blocks = 0, space; int num_dups = 0; int space_req; uint32_t highest_tsn; uint8_t flags; uint8_t type; + uint8_t tsn_map; if ((stcb-asoc.sctp_nr_sack_on_off == 1) (stcb-asoc.peer_supports_nr_sack == 1)) { @@ -10123,24 +10124,24 @@ sctp_send_sack(struct sctp_tcb *stcb) } else { offset = asoc-mapping_array_base_tsn - asoc-cumulative_tsn; } - if ((offset == 1) || - ((type == SCTP_NR_SELECTIVE_ACK) - ((asoc-mapping_array[0] (1 (1 - offset))) == 0))) { - sel_start = 0; - } else { - sel_start = 1; - } if (((type == SCTP_SELECTIVE_ACK) compare_with_wrap(highest_tsn, asoc-cumulative_tsn, MAX_TSN)) || ((type == SCTP_NR_SELECTIVE_ACK) compare_with_wrap(asoc-highest_tsn_inside_map, asoc-cumulative_tsn, MAX_TSN))) { /* we have a gap .. maybe */ for (i = 0; i siz; i++) { + tsn_map = asoc-mapping_array[i]; if (type == SCTP_SELECTIVE_ACK) { - selector = sack_array[asoc-mapping_array[i] | asoc-nr_mapping_array[i]]; - } else { - selector = sack_array[asoc-mapping_array[i]]; + tsn_map |= asoc-nr_mapping_array[i]; + } + if (i == 0) { + /* +* Clear all bits corresponding to TSNs +* smaller or equal to the cumulative TSN. +*/ + tsn_map = (~0 (1 - offset)); } + selector = sack_array[tsn_map]; if (mergeable selector-right_edge) { /* * Backup, left and right edges were ok to @@ -10152,7 +10153,7 @@ sctp_send_sack(struct sctp_tcb *stcb) if (selector-num_entries == 0) mergeable = 0; else { - for (j = sel_start; j selector-num_entries; j++) { + for (j = 0; j selector-num_entries; j++) { if (mergeable selector-right_edge) { /* * do a merge by NOT setting @@ -10184,7 +10185,6 @@ sctp_send_sack(struct sctp_tcb *stcb) /* Reached the limit stop */ break; } - sel_start = 0; offset += 8; } } @@ -10199,11 +10199,6 @@ sctp_send_sack(struct sctp_tcb *stcb) siz = (((MAX_TSN - asoc-mapping_array_base_tsn) + 1) + asoc-highest_tsn_inside_nr_map + 7) / 8; } - if ((asoc-nr_mapping_array[0] (1 (1 - offset))) == 0) { - sel_start = 0; - } else { - sel_start = 1; - } if (compare_with_wrap(asoc-mapping_array_base_tsn, asoc-cumulative_tsn, MAX_TSN)) { offset = 1; } else { @@ -10212,7 +10207,16 @@ sctp_send_sack(struct sctp_tcb *stcb) if (compare_with_wrap(asoc-highest_tsn_inside_nr_map, asoc-cumulative_tsn, MAX_TSN)) { /* we have a gap .. maybe */ for (i = 0; i siz; i++) { - selector = sack_array[asoc-nr_mapping_array[i]]; + tsn_map = asoc-nr_mapping_array[i]; + if (i == 0) { + /* +* Clear all bits corresponding to +* TSNs smaller or equal to the +* cumulative TSN. +*/ +
svn commit: r215199 - head/sys/netinet
Author: tuexen Date: Fri Nov 12 20:46:33 2010 New Revision: 215199 URL: http://svn.freebsd.org/changeset/base/215199 Log: Don't print an empty line when printing mapping arrays. MFC after: 3 days. Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Fri Nov 12 20:45:21 2010(r215198) +++ head/sys/netinet/sctputil.c Fri Nov 12 20:46:33 2010(r215199) @@ -1212,8 +1212,6 @@ sctp_print_mapping_array(struct sctp_ass printf(Renegable mapping array (last %d entries are zero):\n, asoc-mapping_array_size - limit); for (i = 0; i limit; i++) { printf(%2.2x%c, asoc-mapping_array[i], ((i + 1) % 16) ? ' ' : '\n'); - if (((i + 1) % 16) == 0) - printf(\n); } if (limit % 16) printf(\n); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r215241 - head/sys/netinet
Author: tuexen Date: Sat Nov 13 12:52:44 2010 New Revision: 215241 URL: http://svn.freebsd.org/changeset/base/215241 Log: Fix a locking issue reported by brucec@ affecting 1-to-1 style sockets which have not yet been accepted. MFC after: 3 days. Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Sat Nov 13 11:54:04 2010(r215240) +++ head/sys/netinet/sctp_pcb.c Sat Nov 13 12:52:44 2010(r215241) @@ -3464,6 +3464,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, cnt = 0; for ((asoc = LIST_FIRST(inp-sctp_asoc_list)); asoc != NULL; asoc = nasoc) { + SCTP_TCB_LOCK(asoc); nasoc = LIST_NEXT(asoc, sctp_tcblist); if (asoc-asoc.state SCTP_STATE_ABOUT_TO_BE_FREED) { if (asoc-asoc.state SCTP_STATE_IN_ACCEPT_QUEUE) { @@ -3471,10 +3472,10 @@ sctp_inpcb_free(struct sctp_inpcb *inp, sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, asoc, NULL); } cnt++; + SCTP_TCB_UNLOCK(asoc); continue; } /* Free associations that are NOT killing us */ - SCTP_TCB_LOCK(asoc); if ((SCTP_GET_STATE(asoc-asoc) != SCTP_STATE_COOKIE_WAIT) ((asoc-asoc.state SCTP_STATE_ABOUT_TO_BE_FREED) == 0)) { struct mbuf *op_err; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r215249 - head/etc
Author: tuexen Date: Sat Nov 13 17:52:04 2010 New Revision: 215249 URL: http://svn.freebsd.org/changeset/base/215249 Log: Add for existing protocol entries the missing SCTP port allocations and add protocol entries for protocols which have SCTP port allocations. These entries are according to http://www.iana.org/assignments/port-numbers as of today. Also add SCTP port allocation entires for the echo, daytime, and chargen service. Discussed with rwatson@ MFC after: 3 days. Modified: head/etc/services Modified: head/etc/services == --- head/etc/services Sat Nov 13 16:49:07 2010(r215248) +++ head/etc/services Sat Nov 13 17:52:04 2010(r215249) @@ -33,24 +33,31 @@ echo 4/ddp#AppleTalk Echo Protoco rje 5/tcp#Remote Job Entry rje 5/udp#Remote Job Entry zip 6/ddp#Zone Information Protocol +echo 7/sctp echo 7/tcp echo 7/udp +discard 9/sctp sink null discard 9/tcpsink null discard 9/udpsink null systat 11/tcpusers#Active Users systat 11/udpusers#Active Users +daytime 13/sctp daytime 13/tcp daytime 13/udp qotd17/tcpquote#Quote of the Day qotd17/udpquote#Quote of the Day msp 18/tcp#Message Send Protocol msp 18/udp#Message Send Protocol +chargen 19/sctp ttytst source#Character Generator chargen 19/tcpttytst source#Character Generator chargen 19/udpttytst source#Character Generator +ftp-data20/sctp #File Transfer [Default Data] ftp-data20/tcp#File Transfer [Default Data] ftp-data20/udp#File Transfer [Default Data] +ftp 21/sctp #File Transfer [Control] ftp 21/tcp#File Transfer [Control] ftp 21/udp#File Transfer [Control] +ssh 22/sctp #Secure Shell Login ssh 22/tcp#Secure Shell Login ssh 22/udp#Secure Shell Login telnet 23/tcp @@ -151,6 +158,7 @@ vettcp 78/tcp vettcp 78/udp finger 79/tcp finger 79/udp +http80/sctp www www-http #World Wide Web HTTP http80/tcpwww www-http #World Wide Web HTTP http80/udpwww www-http #World Wide Web HTTP hosts2-ns 81/tcp#HOSTS2 Name Server @@ -350,6 +358,7 @@ xdmcp 177/tcp#X Display Manager Con xdmcp 177/udp#X Display Manager Control Protocol NextStep 178/tcpnextstep NeXTStep#NextStep Window Server NextStep 178/udpnextstep NeXTStep#NextStep Window Server +bgp179/sctp #Border Gateway Protocol bgp179/tcp#Border Gateway Protocol bgp179/udp#Border Gateway Protocol ris180/tcp#Intergraph @@ -738,6 +747,7 @@ decvms-sysmgt 441/tcp decvms-sysmgt 441/udp cvc_hostd 442/tcp cvc_hostd 442/udp +https 443/sctp https 443/tcp https 443/udp snpp 444/tcp#Simple Network Paging Protocol @@ -1519,7 +1529,9 @@ nfsd-keepalive1110/udp #Client status supfiledbg 1127/tcp # for SUP nfa1155/tcp #Network File Access nfa1155/udp #Network File Access -phone 1167/udp #conference calling +cisco-ipsla1167/sctp #Cisco IP SLAs Control Protocol +cisco-ipsla1167/tcp #Cisco IP SLAs Control Protocol +cisco-ipsla1167/udp #Cisco IP SLAs Control Protocol skkserv1178/tcp #SKK (kanji input) openvpn1194/tcp #OpenVPN openvpn1194/udp #OpenVPN @@ -2119,6 +2131,7 @@ sdfunc2046/udp #dls 2047/udp dls-monitor2048/tcp dls-monitor2048/udp +nfsd 2049/sctp nfs # NFS server daemon nfsd 2049/tcp nfs # NFS server daemon nfsd 2049/udp nfs # NFS server daemon #PROBLEMS!= @@ -2146,6 +2159,8 @@ hpssd 2207/tcp #HP Status and Service hpssd 2207/udp #HP Status and Services hpiod 2208/tcp #HP I/O Backend hpiod 2208/udp #HP I/O Backend +rcip-itu 2225/sctp #Resource Connection Initiation Protocol +rcip-itu 2225/tcp #Resource Connection Initiation Protocol ivs-video 2232/tcp #IVS Video default ivs-video 2232/udp #IVS Video default ivsd 2241/tcp #IVS Daemon @@ -2179,6 +2194,17 @@ dict 2628/udp #RFC 2229 listen 2766/tcp #System V listener port www-dev2784/tcp #world wide
svn commit: r215301 - head/sys/netinet
Author: tuexen Date: Sun Nov 14 14:37:20 2010 New Revision: 215301 URL: http://svn.freebsd.org/changeset/base/215301 Log: Simplify sctp_delayed_cksum() a bit. MFC after: 3 days. Modified: head/sys/netinet/sctp_crc32.c Modified: head/sys/netinet/sctp_crc32.c == --- head/sys/netinet/sctp_crc32.c Sun Nov 14 14:25:04 2010 (r215300) +++ head/sys/netinet/sctp_crc32.c Sun Nov 14 14:37:20 2010 (r215301) @@ -124,18 +124,16 @@ sctp_delayed_cksum(struct mbuf *m, uint3 #if defined(SCTP_WITH_NO_CSUM) panic(sctp_delayed_cksum() called when using no SCTP CRC.); #else - struct ip *ip; uint32_t checksum; - ip = mtod(m, struct ip *); checksum = sctp_calculate_cksum(m, offset); SCTP_STAT_DECR(sctps_sendhwcrc); SCTP_STAT_INCR(sctps_sendswcrc); offset += offsetof(struct sctphdr, checksum); if (offset + sizeof(uint32_t) (uint32_t) (m-m_len)) { - printf(delayed m_pullup, m-len: %d off: %d p: %d\n, - (uint32_t) m-m_len, offset, ip-ip_p); + printf(sctp_delayed_cksum(): m-len: %d, off: %d.\n, + (uint32_t) m-m_len, offset); /* * XXX this shouldn't happen, but if it does, the correct * behavior may be to insert the checksum in the appropriate ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r215305 - head/sys/netinet
Author: tuexen Date: Sun Nov 14 16:44:18 2010 New Revision: 215305 URL: http://svn.freebsd.org/changeset/base/215305 Log: Take out special code for disable CRC computations on the loopback interface for IPv6. It will be handled by the loopback interface. Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sun Nov 14 16:10:15 2010 (r215304) +++ head/sys/netinet/sctp_output.c Sun Nov 14 16:44:18 2010 (r215305) @@ -4069,15 +4069,9 @@ sctp_lowlevel_chunk_output(struct sctp_i #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) - (stcb) - (stcb-asoc.loopback_scope))) { - m-m_pkthdr.csum_flags = CSUM_SCTP; - m-m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } + m-m_pkthdr.csum_flags = CSUM_SCTP; + m-m_pkthdr.csum_data = 0; + SCTP_STAT_INCR(sctps_sendhwcrc); #endif } /* send it out. table id is taken from stcb */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r215410 - head/sys/netinet
Author: tuexen Date: Tue Nov 16 22:16:38 2010 New Revision: 215410 URL: http://svn.freebsd.org/changeset/base/215410 Log: Add an SCTP socket option to retrieve the number of timeouts of an association. MFC after: 3 days. Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp.h == --- head/sys/netinet/sctp.h Tue Nov 16 20:39:52 2010(r215409) +++ head/sys/netinet/sctp.h Tue Nov 16 22:16:38 2010(r215410) @@ -123,6 +123,7 @@ struct sctp_paramhdr { #define SCTP_LOCAL_AUTH_CHUNKS 0x0103 #define SCTP_GET_ASSOC_NUMBER 0x0104 /* ro */ #define SCTP_GET_ASSOC_ID_LIST 0x0105 /* ro */ +#define SCTP_TIMEOUTS 0x0106 /* * user socket options: BSD implementation specific Modified: head/sys/netinet/sctp_uio.h == --- head/sys/netinet/sctp_uio.h Tue Nov 16 20:39:52 2010(r215409) +++ head/sys/netinet/sctp_uio.h Tue Nov 16 22:16:38 2010(r215410) @@ -563,6 +563,17 @@ struct sctp_sack_info { uint32_t sack_freq; }; +struct sctp_timeouts { + sctp_assoc_t stimo_assoc_id; + uint32_t stimo_init; + uint32_t stimo_data; + uint32_t stimo_sack; + uint32_t stimo_shutdown; + uint32_t stimo_heartbeat; + uint32_t stimo_cookie; + uint32_t stimo_shutdownack; +}; + struct sctp_cwnd_args { struct sctp_nets *net; /* network to *//* FIXME: LP64 issue */ uint32_t cwnd_new_value;/* cwnd in k */ Modified: head/sys/netinet/sctp_usrreq.c == --- head/sys/netinet/sctp_usrreq.c Tue Nov 16 20:39:52 2010 (r215409) +++ head/sys/netinet/sctp_usrreq.c Tue Nov 16 22:16:38 2010 (r215410) @@ -2441,6 +2441,29 @@ flags_out: *optsize = sizeof(*srto); } break; + case SCTP_TIMEOUTS: + { + struct sctp_timeouts *stimo; + + SCTP_CHECK_AND_CAST(stimo, optval, struct sctp_timeouts, *optsize); + SCTP_FIND_STCB(inp, stcb, stimo-stimo_assoc_id); + + if (stcb) { + stimo-stimo_init = stcb-asoc.timoinit; + stimo-stimo_data = stcb-asoc.timodata; + stimo-stimo_sack = stcb-asoc.timosack; + stimo-stimo_shutdown = stcb-asoc.timoshutdown; + stimo-stimo_heartbeat = stcb-asoc.timoheartbeat; + stimo-stimo_cookie = stcb-asoc.timocookie; + stimo-stimo_shutdownack = stcb-asoc.timoshutdownack; + SCTP_TCB_UNLOCK(stcb); + } else { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error); + error = EINVAL; + } + *optsize = sizeof(*stimo); + } + break; case SCTP_ASSOCINFO: { struct sctp_assocparams *sasoc; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216188 - head/sys/netinet
Author: tuexen Date: Sat Dec 4 19:29:49 2010 New Revision: 216188 URL: http://svn.freebsd.org/changeset/base/216188 Log: Fix a bug where also the number of non-renegable gap reports was considered to be potentially renegable. MFC after: 1 day. Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_structs.h Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Sat Dec 4 18:52:05 2010 (r216187) +++ head/sys/netinet/sctp_indata.c Sat Dec 4 19:29:49 2010 (r216188) @@ -3081,14 +3081,17 @@ sctp_handle_segments(struct mbuf *m, int int num_frs = 0; int chunk_freed; int non_revocable; - uint16_t frag_strt, frag_end; - uint32_t last_frag_high; + uint16_t frag_strt, frag_end, prev_frag_end; - tp1 = NULL; - last_frag_high = 0; + tp1 = TAILQ_FIRST(asoc-sent_queue); + prev_frag_end = 0; chunk_freed = 0; for (i = 0; i (num_seg + num_nr_seg); i++) { + if (i == num_seg) { + prev_frag_end = 0; + tp1 = TAILQ_FIRST(asoc-sent_queue); + } frag = (struct sctp_gap_ack_block *)sctp_m_getptr(m, *offset, sizeof(struct sctp_gap_ack_block), (uint8_t *) block); *offset += sizeof(block); @@ -3097,58 +3100,29 @@ sctp_handle_segments(struct mbuf *m, int } frag_strt = ntohs(frag-start); frag_end = ntohs(frag-end); - /* some sanity checks on the fragment offsets */ + if (frag_strt frag_end) { - /* this one is malformed, skip */ + /* This gap report is malformed, skip it. */ continue; } - if (compare_with_wrap((frag_end + last_tsn), *biggest_tsn_acked, - MAX_TSN)) - *biggest_tsn_acked = frag_end + last_tsn; - - /* mark acked dgs and find out the highestTSN being acked */ - if (tp1 == NULL) { + if (frag_strt = prev_frag_end) { + /* This gap report is not in order, so restart. */ tp1 = TAILQ_FIRST(asoc-sent_queue); - /* save the locations of the last frags */ - last_frag_high = frag_end + last_tsn; - } else { - /* -* now lets see if we need to reset the queue due to -* a out-of-order SACK fragment -*/ - if (compare_with_wrap(frag_strt + last_tsn, - last_frag_high, MAX_TSN)) { - /* -* if the new frag starts after the last TSN -* frag covered, we are ok and this one is -* beyond the last one -*/ - ; - } else { - /* -* ok, they have reset us, so we need to -* reset the queue this will cause extra -* hunting but hey, they chose the -* performance hit when they failed to order -* their gaps -*/ - tp1 = TAILQ_FIRST(asoc-sent_queue); - } - last_frag_high = frag_end + last_tsn; + } + if (compare_with_wrap((last_tsn + frag_end), *biggest_tsn_acked, MAX_TSN)) { + *biggest_tsn_acked = last_tsn + frag_end; } if (i num_seg) { non_revocable = 0; } else { non_revocable = 1; } - if (i == num_seg) { - tp1 = NULL; - } if (sctp_process_segment_range(stcb, tp1, last_tsn, frag_strt, frag_end, non_revocable, num_frs, biggest_newly_acked_tsn, this_sack_lowest_newack, ecn_seg_sums)) { chunk_freed = 1; } + prev_frag_end = frag_end; } if (SCTP_BASE_SYSCTL(sctp_logging_level) SCTP_FR_LOGGING_ENABLE) { if (num_frs) @@ -4817,7 +4791,7 @@ sctp_handle_sack(struct mbuf *m, int off } } // - /* drop the acked chunks from the sendqueue */ + /* drop the acked chunks from the sentqueue */ //
svn commit: r216397 - head/sys/netinet
Author: tuexen Date: Sun Dec 12 20:50:44 2010 New Revision: 216397 URL: http://svn.freebsd.org/changeset/base/216397 Log: Bugfix: Do correct accounting using the MIB counters when an association is aborted via sctp_abort_association(). MFC after: 3 days. Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Sun Dec 12 20:48:08 2010(r216396) +++ head/sys/netinet/sctputil.c Sun Dec 12 20:50:44 2010(r216397) @@ -3847,6 +3847,11 @@ sctp_abort_association(struct sctp_inpcb SCTP_TCB_LOCK(stcb); atomic_subtract_int(stcb-asoc.refcnt, 1); #endif + SCTP_STAT_INCR_COUNTER32(sctps_aborted); + if ((SCTP_GET_STATE(stcb-asoc) == SCTP_STATE_OPEN) || + (SCTP_GET_STATE(stcb-asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { + SCTP_STAT_DECR_GAUGE32(sctps_currestab); + } (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTPUTIL + SCTP_LOC_4); #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216480 - head/sys/netinet
Author: tuexen Date: Thu Dec 16 09:49:16 2010 New Revision: 216480 URL: http://svn.freebsd.org/changeset/base/216480 Log: Add a missing cast. Reported by blade_ly at yahoo.com.cn. MFC after: 1 day. Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Thu Dec 16 07:30:47 2010 (r216479) +++ head/sys/netinet/sctp_indata.c Thu Dec 16 09:49:16 2010 (r216480) @@ -1754,7 +1754,7 @@ sctp_process_a_data_chunk(struct sctp_tc asoc-fragmented_delivery_inprogress == 0 TAILQ_EMPTY(asoc-resetHead) ((ordered == 0) || - ((asoc-strmin[strmno].last_sequence_delivered + 1) == strmseq + ((uint16_t) (asoc-strmin[strmno].last_sequence_delivered + 1) == strmseq TAILQ_EMPTY(asoc-strmin[strmno].inqueue { /* Candidate for express delivery */ /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216495 - head/sys/netinet
Author: tuexen Date: Thu Dec 16 21:01:02 2010 New Revision: 216495 URL: http://svn.freebsd.org/changeset/base/216495 Log: Bugfix: Take also the nr-mapping array into account when detecting gaps. Reviewed by: rrs@ MFC after: 3 days. Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Thu Dec 16 19:48:03 2010 (r216494) +++ head/sys/netinet/sctp_indata.c Thu Dec 16 21:01:02 2010 (r216495) @@ -2585,8 +2585,9 @@ sctp_process_data(struct mbuf **mm, int int num_chunks = 0; /* number of control chunks processed */ int stop_proc = 0; int chk_length, break_flag, last_chunk; - int abort_flag = 0, was_a_gap = 0; + int abort_flag = 0, was_a_gap; struct mbuf *m; + uint32_t highest_tsn; /* set the rwnd */ sctp_set_rwnd(stcb, stcb-asoc); @@ -2594,11 +2595,12 @@ sctp_process_data(struct mbuf **mm, int m = *mm; SCTP_TCB_LOCK_ASSERT(stcb); asoc = stcb-asoc; - if (compare_with_wrap(stcb-asoc.highest_tsn_inside_map, - stcb-asoc.cumulative_tsn, MAX_TSN)) { - /* there was a gap before this data was processed */ - was_a_gap = 1; + if (compare_with_wrap(asoc-highest_tsn_inside_nr_map, asoc-highest_tsn_inside_map, MAX_TSN)) { + highest_tsn = asoc-highest_tsn_inside_nr_map; + } else { + highest_tsn = asoc-highest_tsn_inside_map; } + was_a_gap = compare_with_wrap(highest_tsn, stcb-asoc.cumulative_tsn, MAX_TSN); /* * setup where we got the last DATA packet from for any SACK that * may need to go out. Don't bump the net. This is done ONLY when a Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Thu Dec 16 19:48:03 2010 (r216494) +++ head/sys/netinet/sctp_input.c Thu Dec 16 21:01:02 2010 (r216495) @@ -5650,13 +5650,15 @@ sctp_common_input_processing(struct mbuf */ } if ((data_processed == 0) (fwd_tsn_seen)) { - int was_a_gap = 0; + int was_a_gap; + uint32_t highest_tsn; - if (compare_with_wrap(stcb-asoc.highest_tsn_inside_map, - stcb-asoc.cumulative_tsn, MAX_TSN)) { - /* there was a gap before this data was processed */ - was_a_gap = 1; + if (compare_with_wrap(stcb-asoc.highest_tsn_inside_nr_map, stcb-asoc.highest_tsn_inside_map, MAX_TSN)) { + highest_tsn = stcb-asoc.highest_tsn_inside_nr_map; + } else { + highest_tsn = stcb-asoc.highest_tsn_inside_map; } + was_a_gap = compare_with_wrap(highest_tsn, stcb-asoc.cumulative_tsn, MAX_TSN); stcb-asoc.send_sack = 1; sctp_sack_check(stcb, was_a_gap, abort_flag); if (abort_flag) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216669 - in head/sys: netinet netinet6
Author: tuexen Date: Wed Dec 22 17:59:38 2010 New Revision: 216669 URL: http://svn.freebsd.org/changeset/base/216669 Log: Improve plausibility check in sctp_handle_sack(). Allow cmt_on_off to support values 0 (no CMT), 1 (CMT), and 2 (CMT/RP). MFC after: 3 months. Modified: head/sys/netinet/sctp_cc_functions.c head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_usrreq.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_cc_functions.c == --- head/sys/netinet/sctp_cc_functions.cWed Dec 22 17:12:58 2010 (r216668) +++ head/sys/netinet/sctp_cc_functions.cWed Dec 22 17:59:38 2010 (r216669) @@ -80,12 +80,12 @@ sctp_cwnd_update_after_fr(struct sctp_tc struct sctp_nets *net; /*- -* CMT fast recovery code. Need to debug. ((sctp_cmt_on_off == 1) +* CMT fast recovery code. Need to debug. ((sctp_cmt_on_off 0) * (net-fast_retran_loss_recovery == 0))) */ TAILQ_FOREACH(net, asoc-nets, sctp_next) { if ((asoc-fast_retran_loss_recovery == 0) || - (asoc-sctp_cmt_on_off == 1)) { + (asoc-sctp_cmt_on_off 0)) { /* out of a RFC2582 Fast recovery window? */ if (net-net_ack 0) { /* @@ -250,7 +250,7 @@ sctp_cwnd_update_after_sack(struct sctp_ * * Should we stop any running T3 timer here? */ - if ((asoc-sctp_cmt_on_off == 1) + if ((asoc-sctp_cmt_on_off 0) (asoc-sctp_cmt_pf 0) ((net-dest_state SCTP_ADDR_PF) == SCTP_ADDR_PF)) { net-dest_state = ~SCTP_ADDR_PF; @@ -274,10 +274,9 @@ sctp_cwnd_update_after_sack(struct sctp_ * CMT fast recovery code */ /* -* if (sctp_cmt_on_off == 1 -* net-fast_retran_loss_recovery -* net-will_exit_fast_recovery == 0) { @@@ Do something } -* else if (sctp_cmt_on_off == 0 +* if (sctp_cmt_on_off 0 net-fast_retran_loss_recovery +* net-will_exit_fast_recovery == 0) { @@@ Do something +* } else if (sctp_cmt_on_off == 0 * asoc-fast_retran_loss_recovery will_exit == 0) { */ #endif @@ -296,7 +295,7 @@ sctp_cwnd_update_after_sack(struct sctp_ * moved. */ if (accum_moved || - ((asoc-sctp_cmt_on_off == 1) net-new_pseudo_cumack)) { + ((asoc-sctp_cmt_on_off 0) net-new_pseudo_cumack)) { /* If the cumulative ack moved we can proceed */ if (net-cwnd = net-ssthresh) { /* We are in slow start */ @@ -759,12 +758,12 @@ sctp_hs_cwnd_update_after_fr(struct sctp struct sctp_nets *net; /* -* CMT fast recovery code. Need to debug. ((sctp_cmt_on_off == 1) +* CMT fast recovery code. Need to debug. ((sctp_cmt_on_off 0) * (net-fast_retran_loss_recovery == 0))) */ TAILQ_FOREACH(net, asoc-nets, sctp_next) { if ((asoc-fast_retran_loss_recovery == 0) || - (asoc-sctp_cmt_on_off == 1)) { + (asoc-sctp_cmt_on_off 0)) { /* out of a RFC2582 Fast recovery window? */ if (net-net_ack 0) { /* @@ -917,7 +916,7 @@ sctp_hs_cwnd_update_after_sack(struct sc * * Should we stop any running T3 timer here? */ - if ((asoc-sctp_cmt_on_off == 1) + if ((asoc-sctp_cmt_on_off 0) (asoc-sctp_cmt_pf 0) ((net-dest_state SCTP_ADDR_PF) == SCTP_ADDR_PF)) { net-dest_state = ~SCTP_ADDR_PF; @@ -937,10 +936,9 @@ sctp_hs_cwnd_update_after_sack(struct sc * CMT fast recovery code */ /* -* if (sctp_cmt_on_off == 1 -* net-fast_retran_loss_recovery -* net-will_exit_fast_recovery == 0) { @@@ Do something } -* else if (sctp_cmt_on_off == 0 +* if (sctp_cmt_on_off 0 net-fast_retran_loss_recovery +* net-will_exit_fast_recovery == 0) { @@@ Do something +* } else if (sctp_cmt_on_off == 0 * asoc-fast_retran_loss_recovery will_exit == 0) { */
svn commit: r216672 - head/sys/netinet
Author: tuexen Date: Wed Dec 22 19:04:14 2010 New Revision: 216672 URL: http://svn.freebsd.org/changeset/base/216672 Log: Provide a possibility to configure the inital congestion window to the value defined in RFC 4960. MFC after: 3 months. Modified: head/sys/netinet/sctp_cc_functions.c head/sys/netinet/sctp_sysctl.h Modified: head/sys/netinet/sctp_cc_functions.c == --- head/sys/netinet/sctp_cc_functions.cWed Dec 22 19:01:48 2010 (r216671) +++ head/sys/netinet/sctp_cc_functions.cWed Dec 22 19:04:14 2010 (r216672) @@ -53,15 +53,19 @@ sctp_set_initial_cc_param(struct sctp_tc uint32_t cwnd_in_mtu; assoc = stcb-asoc; - /* -* We take the minimum of the burst limit and the initial congestion -* window. The initial congestion window is at least two times the -* MTU. -*/ cwnd_in_mtu = SCTP_BASE_SYSCTL(sctp_initial_cwnd); - if ((assoc-max_burst 0) (cwnd_in_mtu assoc-max_burst)) - cwnd_in_mtu = assoc-max_burst; - net-cwnd = (net-mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; + if (cwnd_in_mtu == 0) { + /* Using 0 means that the value of RFC 4960 is used. */ + net-cwnd = min((net-mtu * 4), max((2 * net-mtu), SCTP_INITIAL_CWND)); + } else { + /* +* We take the minimum of the burst limit and the initial +* congestion window. +*/ + if ((assoc-max_burst 0) (cwnd_in_mtu assoc-max_burst)) + cwnd_in_mtu = assoc-max_burst; + net-cwnd = (net-mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; + } net-ssthresh = assoc-peers_rwnd; SDT_PROBE(sctp, cwnd, net, init, Modified: head/sys/netinet/sctp_sysctl.h == --- head/sys/netinet/sctp_sysctl.h Wed Dec 22 19:01:48 2010 (r216671) +++ head/sys/netinet/sctp_sysctl.h Wed Dec 22 19:04:14 2010 (r216672) @@ -500,7 +500,7 @@ struct sctp_sysctl { /* Initial congestion window in MTU */ #define SCTPCTL_INITIAL_CWND_DESC Initial congestion window in MTUs -#define SCTPCTL_INITIAL_CWND_MIN 1 +#define SCTPCTL_INITIAL_CWND_MIN 0 #define SCTPCTL_INITIAL_CWND_MAX 0x #define SCTPCTL_INITIAL_CWND_DEFAULT 3 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216821 - head/sys/netinet
Author: tuexen Date: Thu Dec 30 16:23:13 2010 New Revision: 216821 URL: http://svn.freebsd.org/changeset/base/216821 Log: Fix three bugs related to the sequence number wrap-around affecting the processing of ECNE and ASCONF chunks. Reviewed by: rrs MFC after: 3 days. Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Thu Dec 30 15:58:23 2010 (r216820) +++ head/sys/netinet/sctp_asconf.c Thu Dec 30 16:23:13 2010 (r216821) @@ -632,7 +632,7 @@ sctp_handle_asconf(struct mbuf *m, unsig asoc = stcb-asoc; serial_num = ntohl(cp-serial_number); - if (compare_with_wrap(asoc-asconf_seq_in, serial_num, MAX_SEQ) || + if (compare_with_wrap(asoc-asconf_seq_in, serial_num, MAX_TSN) || serial_num == asoc-asconf_seq_in) { /* got a duplicate ASCONF */ SCTPDBG(SCTP_DEBUG_ASCONF1, Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Thu Dec 30 15:58:23 2010 (r216820) +++ head/sys/netinet/sctp_input.c Thu Dec 30 16:23:13 2010 (r216821) @@ -2944,7 +2944,7 @@ sctp_handle_ecn_echo(struct sctp_ecne_ch net = lchk-whoTo; break; } - if (compare_with_wrap(lchk-rec.data.TSN_seq, tsn, MAX_SEQ)) + if (compare_with_wrap(lchk-rec.data.TSN_seq, tsn, MAX_TSN)) break; lchk = TAILQ_NEXT(lchk, sctp_next); } Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Thu Dec 30 15:58:23 2010 (r216820) +++ head/sys/netinet/sctp_output.c Thu Dec 30 16:23:13 2010 (r216821) @@ -6477,7 +6477,7 @@ sctp_toss_old_asconf(struct sctp_tcb *st if (chk-rec.chunk_id.id == SCTP_ASCONF) { if (chk-data) { acp = mtod(chk-data, struct sctp_asconf_chunk *); - if (compare_with_wrap(ntohl(acp-serial_number), stcb-asoc.asconf_seq_out_acked, MAX_SEQ)) { + if (compare_with_wrap(ntohl(acp-serial_number), stcb-asoc.asconf_seq_out_acked, MAX_TSN)) { /* Not Acked yet */ break; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r216822 - head/sys/netinet
Author: tuexen Date: Thu Dec 30 16:56:20 2010 New Revision: 216822 URL: http://svn.freebsd.org/changeset/base/216822 Log: Code cleanup: Use LIST_FOREACH, LIST_FOREACH_SAFE, TAILQ_FOREACH, TAILQ_FOREACH_SAFE where appropriate. No functional change. MFC after: 3 months. Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_bsd_addr.c head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Thu Dec 30 16:23:13 2010 (r216821) +++ head/sys/netinet/sctp_asconf.c Thu Dec 30 16:56:20 2010 (r216822) @@ -656,19 +656,16 @@ sctp_handle_asconf(struct mbuf *m, unsig /* delete old cache */ SCTPDBG(SCTP_DEBUG_ASCONF1, handle_asconf: Now processing firstASCONF. Try to delte old cache\n); - ack = TAILQ_FIRST(stcb-asoc.asconf_ack_sent); - while (ack != NULL) { - ack_next = TAILQ_NEXT(ack, next); + TAILQ_FOREACH_SAFE(ack, asoc-asconf_ack_sent, next, ack_next) { if (ack-serial_number == serial_num) break; SCTPDBG(SCTP_DEBUG_ASCONF1, handle_asconf: delete old(%u) first(%u)\n, ack-serial_number, serial_num); - TAILQ_REMOVE(stcb-asoc.asconf_ack_sent, ack, next); + TAILQ_REMOVE(asoc-asconf_ack_sent, ack, next); if (ack-data != NULL) { sctp_m_freem(ack-data); } SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_asconf_ack), ack); - ack = ack_next; } } m_ack = sctp_get_mbuf_for_msg(sizeof(struct sctp_asconf_ack_chunk), 0, @@ -1264,9 +1261,7 @@ sctp_asconf_queue_mgmt(struct sctp_tcb * struct sockaddr *sa; /* make sure the request isn't already in the queue */ - for (aa = TAILQ_FIRST(stcb-asoc.asconf_queue); aa != NULL; - aa = aa_next) { - aa_next = TAILQ_NEXT(aa, next); + TAILQ_FOREACH_SAFE(aa, stcb-asoc.asconf_queue, next, aa_next) { /* address match? */ if (sctp_asconf_addr_match(aa, ifa-address.sa) == 0) continue; @@ -1480,9 +1475,7 @@ sctp_asconf_queue_sa_delete(struct sctp_ return (-1); } /* make sure the request isn't already in the queue */ - for (aa = TAILQ_FIRST(stcb-asoc.asconf_queue); aa != NULL; - aa = aa_next) { - aa_next = TAILQ_NEXT(aa, next); + TAILQ_FOREACH_SAFE(aa, stcb-asoc.asconf_queue, next, aa_next) { /* address match? */ if (sctp_asconf_addr_match(aa, sa) == 0) continue; @@ -1836,9 +1829,7 @@ sctp_handle_asconf_ack(struct mbuf *m, i */ if (last_error_id == 0) last_error_id--;/* set to max value */ - for (aa = TAILQ_FIRST(stcb-asoc.asconf_queue); aa != NULL; - aa = aa_next) { - aa_next = TAILQ_NEXT(aa, next); + TAILQ_FOREACH_SAFE(aa, stcb-asoc.asconf_queue, next, aa_next) { if (aa-sent == 1) { /* * implicitly successful or failed if correlation_id @@ -2098,14 +2089,11 @@ sctp_asconf_iterator_ep_end(struct sctp_ } } } else if (l-action == SCTP_DEL_IP_ADDRESS) { - laddr = LIST_FIRST(inp-sctp_addr_list); - while (laddr) { - nladdr = LIST_NEXT(laddr, sctp_nxt_addr); + LIST_FOREACH_SAFE(laddr, inp-sctp_addr_list, sctp_nxt_addr, nladdr) { /* remove only after all guys are done */ if (laddr-ifa == ifa) { sctp_del_local_addr_ep(inp, ifa); } - laddr = nladdr; } } } @@ -2285,12 +2273,10 @@ sctp_asconf_iterator_end(void *ptr, uint { struct sctp_asconf_iterator *asc; struct sctp_ifa *ifa; - struct sctp_laddr *l, *l_next; + struct sctp_laddr *l, *nl; asc = (struct sctp_asconf_iterator *)ptr; - l = LIST_FIRST(asc-list_of_work); - while (l != NULL) { - l_next = LIST_NEXT(l, sctp_nxt_addr); + LIST_FOREACH_SAFE(l, asc-list_of_work, sctp_nxt_addr, nl) { ifa = l-ifa; if (l-action == SCTP_ADD_IP_ADDRESS) {
svn commit: r216825 - head/sys/netinet
Author: tuexen Date: Thu Dec 30 21:32:35 2010 New Revision: 216825 URL: http://svn.freebsd.org/changeset/base/216825 Log: Define and use SCTP_SSN_GE, SCTP_SSN_GT, SCTP_TSN_GE, SCTP_TSN_GT macros and use them instead of the generic compare_with_wrap. Retire compare_with_wrap. MFC after: 3 months. Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_timer.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Thu Dec 30 18:29:22 2010 (r216824) +++ head/sys/netinet/sctp_asconf.c Thu Dec 30 21:32:35 2010 (r216825) @@ -632,8 +632,7 @@ sctp_handle_asconf(struct mbuf *m, unsig asoc = stcb-asoc; serial_num = ntohl(cp-serial_number); - if (compare_with_wrap(asoc-asconf_seq_in, serial_num, MAX_TSN) || - serial_num == asoc-asconf_seq_in) { + if (SCTP_TSN_GE(asoc-asconf_seq_in, serial_num)) { /* got a duplicate ASCONF */ SCTPDBG(SCTP_DEBUG_ASCONF1, handle_asconf: got duplicate serial number = %xh\n, Modified: head/sys/netinet/sctp_constants.h == --- head/sys/netinet/sctp_constants.h Thu Dec 30 18:29:22 2010 (r216824) +++ head/sys/netinet/sctp_constants.h Thu Dec 30 21:32:35 2010 (r216825) @@ -322,7 +322,6 @@ __FBSDID($FreeBSD$); #define SCTP_VERSION_NUMBER0x3 #define MAX_TSN0x -#define MAX_SEQ0x /* how many executions every N tick's */ #define SCTP_ITERATOR_MAX_AT_ONCE 20 @@ -906,10 +905,13 @@ __FBSDID($FreeBSD$); #define SCTP_MAX_DATA_BUNDLING 256 /* modular comparison */ -/* True if a b (mod = M) */ -#define compare_with_wrap(a, b, M) (((a b) ((a - b) ((M 1) + 1))) || \ - ((b a) ((b - a) ((M 1) + 1 - +/* See RFC 1982 for details. */ +#define SCTP_SSN_GT(a, b) (((a b) ((b - a) (115))) || \ + ((a b) ((a - b) (115 +#define SCTP_SSN_GE(a, b) (SCTP_SSN_GT(a, b) || (a == b)) +#define SCTP_TSN_GT(a, b) (((a b) ((b - a) (131))) || \ + ((a b) ((a - b) (131 +#define SCTP_TSN_GE(a, b) (SCTP_TSN_GT(a, b) || (a == b)) /* Mapping array manipulation routines */ #define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap 3)] (gap 0x07)) 0x01) Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Thu Dec 30 18:29:22 2010 (r216824) +++ head/sys/netinet/sctp_indata.c Thu Dec 30 21:32:35 2010 (r216825) @@ -298,7 +298,7 @@ sctp_mark_non_revokable(struct sctp_asso return; } cumackp1 = asoc-cumulative_tsn + 1; - if (compare_with_wrap(cumackp1, tsn, MAX_TSN)) { + if (SCTP_TSN_GT(cumackp1, tsn)) { /* * this tsn is behind the cum ack and thus we don't need to * worry about it being moved from one to the other. @@ -315,13 +315,12 @@ sctp_mark_non_revokable(struct sctp_asso } SCTP_SET_TSN_PRESENT(asoc-nr_mapping_array, gap); SCTP_UNSET_TSN_PRESENT(asoc-mapping_array, gap); - if (compare_with_wrap(tsn, asoc-highest_tsn_inside_nr_map, MAX_TSN)) { + if (SCTP_TSN_GT(tsn, asoc-highest_tsn_inside_nr_map)) { asoc-highest_tsn_inside_nr_map = tsn; } if (tsn == asoc-highest_tsn_inside_map) { /* We must back down to see what the new highest is */ - for (i = tsn - 1; (compare_with_wrap(i, asoc-mapping_array_base_tsn, MAX_TSN) || - (i == asoc-mapping_array_base_tsn)); i--) { + for (i = tsn - 1; SCTP_TSN_GE(i, asoc-mapping_array_base_tsn); i--) { SCTP_CALC_TSN_TO_GAP(gap, i, asoc-mapping_array_base_tsn); if (SCTP_IS_TSN_PRESENT(asoc-mapping_array, gap)) { asoc-highest_tsn_inside_map = i; @@ -558,9 +557,7 @@ sctp_queue_data_to_stream(struct sctp_tc (uint32_t) control-sinfo_stream, (uint32_t) strm-last_sequence_delivered, (uint32_t) nxt_todel); - if (compare_with_wrap(strm-last_sequence_delivered, - control-sinfo_ssn, MAX_SEQ) || - (strm-last_sequence_delivered == control-sinfo_ssn)) { + if (SCTP_SSN_GE(strm-last_sequence_delivered, control-sinfo_ssn)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, Duplicate S-SEQ:%d delivered:%d from peer, Abort association\n, control-sinfo_ssn, strm-last_sequence_delivered); @@ -646,9
svn commit: r240007 - head/sys/netinet
Author: tuexen Date: Sun Sep 2 12:37:30 2012 New Revision: 240007 URL: http://svn.freebsd.org/changeset/base/240007 Log: Fix a typo which results in RTT to be off by a factor of 10, if the RTT is larger than 1 second. MFC after:3 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Sun Sep 2 11:44:30 2012(r240006) +++ head/sys/netinet/sctputil.c Sun Sep 2 12:37:30 2012(r240007) @@ -2384,7 +2384,7 @@ sctp_calculate_rto(struct sctp_tcb *stcb } timevalsub(now, old); /* store the current RTT in us */ - net-rtt = (uint64_t) 1000 *(uint64_t) now.tv_sec + + net-rtt = (uint64_t) 100 *(uint64_t) now.tv_sec + (uint64_t) now.tv_usec; /* computer rtt in ms */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240115 - head/sys/netinet
Author: tuexen Date: Tue Sep 4 22:45:00 2012 New Revision: 240115 URL: http://svn.freebsd.org/changeset/base/240115 Log: Use the consistenly the size of a variable. This helps to keep the code simpler for the userland implementation. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Tue Sep 4 22:40:49 2012 (r240114) +++ head/sys/netinet/sctp_output.c Tue Sep 4 22:45:00 2012 (r240115) @@ -3371,7 +3371,7 @@ sctp_find_cmsg(int c_type, void *data, s return (found); } m_copydata(control, at, sizeof(cmh), (caddr_t)cmh); - if (cmh.cmsg_len CMSG_ALIGN(sizeof(struct cmsghdr))) { + if (cmh.cmsg_len CMSG_ALIGN(sizeof(cmh))) { /* We dont't have a complete CMSG header. */ return (found); } @@ -3386,11 +3386,11 @@ sctp_find_cmsg(int c_type, void *data, s (cmh.cmsg_type == SCTP_PRINFO) || (cmh.cmsg_type == SCTP_AUTHINFO) { if (c_type == cmh.cmsg_type) { - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) cpsize) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) cpsize) { return (found); } /* It is exactly what we want. Copy it out. */ - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), cpsize, (caddr_t)data); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), cpsize, (caddr_t)data); return (1); } else { struct sctp_sndrcvinfo *sndrcvinfo; @@ -3404,10 +3404,10 @@ sctp_find_cmsg(int c_type, void *data, s } switch (cmh.cmsg_type) { case SCTP_SNDINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) sizeof(struct sctp_sndinfo)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) sizeof(struct sctp_sndinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct sctp_sndinfo), (caddr_t)sndinfo); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_sndinfo), (caddr_t)sndinfo); sndrcvinfo-sinfo_stream = sndinfo.snd_sid; sndrcvinfo-sinfo_flags = sndinfo.snd_flags; sndrcvinfo-sinfo_ppid = sndinfo.snd_ppid; @@ -3415,18 +3415,18 @@ sctp_find_cmsg(int c_type, void *data, s sndrcvinfo-sinfo_assoc_id = sndinfo.snd_assoc_id; break; case SCTP_PRINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) sizeof(struct sctp_prinfo)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) sizeof(struct sctp_prinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct sctp_prinfo), (caddr_t)prinfo); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_prinfo), (caddr_t)prinfo); sndrcvinfo-sinfo_timetolive = prinfo.pr_value; sndrcvinfo-sinfo_flags |= prinfo.pr_policy; break; case SCTP_AUTHINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) sizeof(struct sctp_authinfo)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) sizeof(struct sctp_authinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct sctp_authinfo), (caddr_t)authinfo); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_authinfo), (caddr_t)authinfo);
svn commit: r240148 - head/sys/netinet
Author: tuexen Date: Wed Sep 5 18:52:01 2012 New Revision: 240148 URL: http://svn.freebsd.org/changeset/base/240148 Log: Using %p in a format string requires a void *. MFC after: 10 days Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_cc_functions.c head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Wed Sep 5 18:49:00 2012 (r240147) +++ head/sys/netinet/sctp_asconf.c Wed Sep 5 18:52:01 2012 (r240148) @@ -2278,7 +2278,7 @@ sctp_set_primary_ip_address_sa(struct sc /* set primary queuing succeeded */ SCTPDBG(SCTP_DEBUG_ASCONF1, set_primary_ip_address_sa: queued on tcb=%p, , - stcb); + (void *)stcb); SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, sa); if (SCTP_GET_STATE(stcb-asoc) == SCTP_STATE_OPEN) { #ifdef SCTP_TIMER_BASED_ASCONF @@ -2291,7 +2291,7 @@ sctp_set_primary_ip_address_sa(struct sc } } else { SCTPDBG(SCTP_DEBUG_ASCONF1, set_primary_ip_address_sa: failed to add to queue on tcb=%p, , - stcb); + (void *)stcb); SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, sa); return (-1); } @@ -2314,7 +2314,7 @@ sctp_set_primary_ip_address(struct sctp_ SCTP_SET_PRIM_ADDR)) { /* set primary queuing succeeded */ SCTPDBG(SCTP_DEBUG_ASCONF1, set_primary_ip_address: queued on stcb=%p, , - stcb); + (void *)stcb); SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, ifa-address.sa); if (SCTP_GET_STATE(stcb-asoc) == SCTP_STATE_OPEN) { #ifdef SCTP_TIMER_BASED_ASCONF Modified: head/sys/netinet/sctp_auth.c == --- head/sys/netinet/sctp_auth.cWed Sep 5 18:49:00 2012 (r240147) +++ head/sys/netinet/sctp_auth.cWed Sep 5 18:52:01 2012 (r240148) @@ -591,7 +591,7 @@ sctp_auth_key_acquire(struct sctp_tcb *s atomic_add_int(skey-refcount, 1); SCTPDBG(SCTP_DEBUG_AUTH2, %s: stcb %p key %u refcount acquire to %d\n, - __FUNCTION__, stcb, key_id, skey-refcount); + __FUNCTION__, (void *)stcb, key_id, skey-refcount); } } @@ -612,7 +612,7 @@ sctp_auth_key_release(struct sctp_tcb *s sctp_free_sharedkey(skey); SCTPDBG(SCTP_DEBUG_AUTH2, %s: stcb %p key %u refcount release to %d\n, - __FUNCTION__, stcb, key_id, skey-refcount); + __FUNCTION__, (void *)stcb, key_id, skey-refcount); /* see if a notification should be generated */ if ((skey-refcount = 1) (skey-deactivated)) { @@ -621,7 +621,7 @@ sctp_auth_key_release(struct sctp_tcb *s key_id, 0, so_locked); SCTPDBG(SCTP_DEBUG_AUTH2, %s: stcb %p key %u no longer used, %d\n, - __FUNCTION__, stcb, key_id, skey-refcount); + __FUNCTION__, (void *)stcb, key_id, skey-refcount); } } } Modified: head/sys/netinet/sctp_cc_functions.c == --- head/sys/netinet/sctp_cc_functions.cWed Sep 5 18:49:00 2012 (r240147) +++ head/sys/netinet/sctp_cc_functions.cWed Sep 5 18:52:01 2012 (r240148) @@ -984,7 +984,7 @@ sctp_cwnd_update_exit_pf_common(struct s stcb-asoc.my_vtag, ((stcb-sctp_ep-sctp_lport 16) | (stcb-rport)), net, old_cwnd, net-cwnd); SCTPDBG(SCTP_DEBUG_INDATA1, Destination %p moved from PF to reachable with cwnd %d.\n, - net, net-cwnd); + (void *)net, net-cwnd); } Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Wed Sep 5 18:49:00 2012 (r240147) +++ head/sys/netinet/sctp_indata.c Wed Sep 5 18:52:01 2012 (r240148) @@ -4420,7 +4420,7 @@ sctp_handle_sack(struct mbuf *m, int off cum_ack, send_s); if (tp1) { SCTP_PRINTF(Got send_s from tsn:%x + 1 of tp1:%p\n, - tp1-rec.data.TSN_seq, tp1); +
svn commit: r240158 - head/sys/netinet
Author: tuexen Date: Thu Sep 6 07:03:56 2012 New Revision: 240158 URL: http://svn.freebsd.org/changeset/base/240158 Log: Get rid of a gcc'ism. MFC after: 10 days Modified: head/sys/netinet/sctp_cc_functions.c Modified: head/sys/netinet/sctp_cc_functions.c == --- head/sys/netinet/sctp_cc_functions.cThu Sep 6 06:17:39 2012 (r240157) +++ head/sys/netinet/sctp_cc_functions.cThu Sep 6 07:03:56 2012 (r240158) @@ -1917,10 +1917,9 @@ measure_achieved_throughput(struct sctp_ return; } net-cc_mod.htcp_ca.bytecount += net-net_ack; - - if (net-cc_mod.htcp_ca.bytecount = net-cwnd - ((net-cc_mod.htcp_ca.alpha 7 ? : 1) * net-mtu) -now - net-cc_mod.htcp_ca.lasttime = net-cc_mod.htcp_ca.minRTT -net-cc_mod.htcp_ca.minRTT 0) { + if ((net-cc_mod.htcp_ca.bytecount = net-cwnd - (((net-cc_mod.htcp_ca.alpha 7) ? (net-cc_mod.htcp_ca.alpha 7) : 1) * net-mtu)) + (now - net-cc_mod.htcp_ca.lasttime = net-cc_mod.htcp_ca.minRTT) + (net-cc_mod.htcp_ca.minRTT 0)) { uint32_t cur_Bi = net-cc_mod.htcp_ca.bytecount / net-mtu * hz / (now - net-cc_mod.htcp_ca.lasttime); if (htcp_ccount(net-cc_mod.htcp_ca) = 3) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240198 - head/sys/netinet
Author: tuexen Date: Fri Sep 7 13:36:42 2012 New Revision: 240198 URL: http://svn.freebsd.org/changeset/base/240198 Log: Don't include a structure containing a flexible array in another structure. MFC after:10 days Modified: head/sys/netinet/sctp_header.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_input.h head/sys/netinet/sctp_structs.h Modified: head/sys/netinet/sctp_header.h == --- head/sys/netinet/sctp_header.h Fri Sep 7 13:17:18 2012 (r240197) +++ head/sys/netinet/sctp_header.h Fri Sep 7 13:36:42 2012 (r240198) @@ -510,16 +510,6 @@ struct sctp_stream_reset_add_strm { * streams then the request will need to be an overlay structure. */ -struct sctp_stream_reset_out_req { - struct sctp_chunkhdr ch; - struct sctp_stream_reset_out_request sr_req; -} SCTP_PACKED; - -struct sctp_stream_reset_in_req { - struct sctp_chunkhdr ch; - struct sctp_stream_reset_in_request sr_req; -}SCTP_PACKED; - struct sctp_stream_reset_tsn_req { struct sctp_chunkhdr ch; struct sctp_stream_reset_tsn_request sr_req; Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Fri Sep 7 13:17:18 2012 (r240197) +++ head/sys/netinet/sctp_indata.c Fri Sep 7 13:36:42 2012 (r240198) @@ -2113,7 +2113,7 @@ finish_express_del: */ struct sctp_queued_to_read *ctl, *nctl; - sctp_reset_in_stream(stcb, liste-number_entries, liste-req.list_of_streams); + sctp_reset_in_stream(stcb, liste-number_entries, liste-list_of_streams); TAILQ_REMOVE(asoc-resetHead, liste, next_resp); SCTP_FREE(liste, SCTP_M_STRESET); /* sa_ignore FREED_MEMORY */ Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Fri Sep 7 13:17:18 2012 (r240197) +++ head/sys/netinet/sctp_input.c Fri Sep 7 13:36:42 2012 (r240198) @@ -3455,9 +3455,9 @@ process_chunk_drop(struct sctp_tcb *stcb } void -sctp_reset_in_stream(struct sctp_tcb *stcb, int number_entries, uint16_t * list) +sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list) { - int i; + uint32_t i; uint16_t temp; /* @@ -3511,7 +3511,7 @@ struct sctp_stream_reset_out_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk) { struct sctp_association *asoc; - struct sctp_stream_reset_out_req *req; + struct sctp_chunkhdr *ch; struct sctp_stream_reset_out_request *r; struct sctp_tmit_chunk *chk; int len, clen; @@ -3534,8 +3534,8 @@ sctp_find_stream_reset(struct sctp_tcb * *bchk = chk; } clen = chk-send_size; - req = mtod(chk-data, struct sctp_stream_reset_out_req *); - r = req-sr_req; + ch = mtod(chk-data, struct sctp_chunkhdr *); + r = (struct sctp_stream_reset_out_request *)(ch + 1); if (ntohl(r-request_seq) == seq) { /* found it */ return (r); @@ -3888,8 +3888,7 @@ sctp_handle_str_reset_request_out(struct } liste-tsn = tsn; liste-number_entries = number_entries; - memcpy(liste-req, req, - (sizeof(struct sctp_stream_reset_out_request) + (number_entries * sizeof(uint16_t; + memcpy(liste-list_of_streams, req-list_of_streams, number_entries * sizeof(uint16_t)); TAILQ_INSERT_TAIL(asoc-resetHead, liste, next_resp); asoc-last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; } @@ -4059,7 +4058,7 @@ __attribute__((noinline)) #endif static int sctp_handle_stream_reset(struct sctp_tcb *stcb, struct mbuf *m, int offset, -struct sctp_stream_reset_out_req *sr_req) +struct sctp_chunkhdr *ch_req) { int chk_length, param_len, ptype; struct sctp_paramhdr pstore; @@ -4074,7 +4073,7 @@ __attribute__((noinline)) int num_param = 0; /* now it may be a reset or a reset-response */ - chk_length = ntohs(sr_req-ch.chunk_length); + chk_length = ntohs(ch_req-chunk_length); /* setup for adding the response */ sctp_alloc_a_chunk(stcb, chk); @@ -5413,7 +5412,7 @@ process_control_chunks: */ stcb-asoc.peer_supports_strreset = 1; } - if (sctp_handle_stream_reset(stcb, m,
svn commit: r240250 - head/sys/netinet
Author: tuexen Date: Sat Sep 8 20:54:54 2012 New Revision: 240250 URL: http://svn.freebsd.org/changeset/base/240250 Log: Whitespace cleanup. MFC after: 10 days Modified: head/sys/netinet/sctp_asconf.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Sat Sep 8 20:00:31 2012 (r240249) +++ head/sys/netinet/sctp_asconf.c Sat Sep 8 20:54:54 2012 (r240250) @@ -1862,7 +1862,6 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb * { int status; - if ((inp-sctp_flags SCTP_PCB_FLAGS_BOUNDALL) == 0 || sctp_is_feature_off(inp, SCTP_PCB_FLAGS_DO_ASCONF)) { /* subset bound, no ASCONF allowed case, so ignore */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240263 - head/sys/netinet
Author: tuexen Date: Sun Sep 9 08:14:04 2012 New Revision: 240263 URL: http://svn.freebsd.org/changeset/base/240263 Log: Whitespace changes. MFC after: 10 days Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Sun Sep 9 07:52:13 2012(r240262) +++ head/sys/netinet/sctp_pcb.c Sun Sep 9 08:14:04 2012(r240263) @@ -2757,7 +2757,6 @@ sctp_inpcb_bind(struct socket *so, struc return (EINVAL); } lport = sin6-sin6_port; - /* * For LOOPBACK the prison_local_ip6() call * will transmute the ipv6 address to the @@ -2795,7 +2794,7 @@ sctp_inpcb_bind(struct socket *so, struc SCTP_INP_INCR_REF(inp); if (lport) { /* -* Did the caller specify a port? if so we must see if a ep +* Did the caller specify a port? if so we must see if an ep * already has this one bound. */ /* got to be root to get at low ports */ @@ -2876,8 +2875,7 @@ continue_anyway: if (bindall) { /* verify that no lport is not used by a singleton */ if ((port_reuse_active == 0) - (inp_tmp = sctp_isport_inuse(inp, lport, vrf_id)) - ) { + (inp_tmp = sctp_isport_inuse(inp, lport, vrf_id))) { /* Sorry someone already has this one bound */ if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) { @@ -3043,9 +3041,9 @@ continue_anyway: * zero out the port to find the address! yuck! can't do * this earlier since need port for sctp_pcb_findep() */ - if (sctp_ifap != NULL) + if (sctp_ifap != NULL) { ifa = sctp_ifap; - else { + } else { /* * Note for BSD we hit here always other O/S's will * pass things in via the sctp_ifap argument ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240507 - head/sys/netinet
Author: tuexen Date: Fri Sep 14 18:32:20 2012 New Revision: 240507 URL: http://svn.freebsd.org/changeset/base/240507 Log: Small cleanups. No functional change. MFC after:10 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Fri Sep 14 17:50:42 2012(r240506) +++ head/sys/netinet/sctputil.c Fri Sep 14 18:32:20 2012(r240507) @@ -58,8 +58,7 @@ extern struct sctp_cc_functions sctp_cc_ extern struct sctp_ss_functions sctp_ss_functions[]; void -sctp_sblog(struct sockbuf *sb, -struct sctp_tcb *stcb, int from, int incr) +sctp_sblog(struct sockbuf *sb, struct sctp_tcb *stcb, int from, int incr) { struct sctp_cwnd_log sctp_clog; @@ -103,7 +102,6 @@ sctp_log_closing(struct sctp_inpcb *inp, sctp_clog.x.misc.log4); } - void rto_logging(struct sctp_nets *net, int from) { @@ -198,8 +196,7 @@ sctp_log_map(uint32_t map, uint32_t cum, } void -sctp_log_fr(uint32_t biggest_tsn, uint32_t biggest_new_tsn, uint32_t tsn, -int from) +sctp_log_fr(uint32_t biggest_tsn, uint32_t biggest_new_tsn, uint32_t tsn, int from) { struct sctp_cwnd_log sctp_clog; @@ -242,8 +239,7 @@ sctp_log_mb(struct mbuf *m, int from) } void -sctp_log_strm_del(struct sctp_queued_to_read *control, struct sctp_queued_to_read *poschk, -int from) +sctp_log_strm_del(struct sctp_queued_to_read *control, struct sctp_queued_to_read *poschk, int from) { struct sctp_cwnd_log sctp_clog; @@ -4215,7 +4211,6 @@ sctp_print_address(struct sockaddr *sa) #ifdef INET6 char ip6buf[INET6_ADDRSTRLEN]; - ip6buf[0] = 0; #endif switch (sa-sa_family) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240826 - head/sys/netinet
Author: tuexen Date: Sat Sep 22 14:39:20 2012 New Revision: 240826 URL: http://svn.freebsd.org/changeset/base/240826 Log: Small cleanups. No functional change. MFC after:10 days Modified: head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sat Sep 22 12:52:41 2012 (r240825) +++ head/sys/netinet/sctp_output.c Sat Sep 22 14:39:20 2012 (r240826) @@ -11394,11 +11394,11 @@ sctp_send_cwr(struct sctp_tcb *stcb, str struct sctp_cwr_chunk *cwr; struct sctp_tmit_chunk *chk; - asoc = stcb-asoc; SCTP_TCB_LOCK_ASSERT(stcb); if (net == NULL) { return; } + asoc = stcb-asoc; TAILQ_FOREACH(chk, asoc-control_send_queue, sctp_next) { if ((chk-rec.chunk_id.id == SCTP_ECN_CWR) (net == chk-whoTo)) { /* @@ -11453,13 +11453,11 @@ sctp_add_stream_reset_out(struct sctp_tm int number_entries, uint16_t * list, uint32_t seq, uint32_t resp_seq, uint32_t last_sent) { - int len, old_len, i; + uint16_t len, old_len, i; struct sctp_stream_reset_out_request *req_out; struct sctp_chunkhdr *ch; ch = mtod(chk-data, struct sctp_chunkhdr *); - - old_len = len = SCTP_SIZE32(ntohs(ch-chunk_length)); /* get to new offset for the param. */ @@ -11493,19 +11491,16 @@ sctp_add_stream_reset_out(struct sctp_tm return; } - -void +static void sctp_add_stream_reset_in(struct sctp_tmit_chunk *chk, int number_entries, uint16_t * list, uint32_t seq) { - int len, old_len, i; + uint16_t len, old_len, i; struct sctp_stream_reset_in_request *req_in; struct sctp_chunkhdr *ch; ch = mtod(chk-data, struct sctp_chunkhdr *); - - old_len = len = SCTP_SIZE32(ntohs(ch-chunk_length)); /* get to new offset for the param. */ @@ -11537,18 +11532,15 @@ sctp_add_stream_reset_in(struct sctp_tmi return; } - -void +static void sctp_add_stream_reset_tsn(struct sctp_tmit_chunk *chk, uint32_t seq) { - int len, old_len; + uint16_t len, old_len; struct sctp_stream_reset_tsn_request *req_tsn; struct sctp_chunkhdr *ch; ch = mtod(chk-data, struct sctp_chunkhdr *); - - old_len = len = SCTP_SIZE32(ntohs(ch-chunk_length)); /* get to new offset for the param. */ @@ -11572,13 +11564,11 @@ void sctp_add_stream_reset_result(struct sctp_tmit_chunk *chk, uint32_t resp_seq, uint32_t result) { - int len, old_len; + uint16_t len, old_len; struct sctp_stream_reset_response *resp; struct sctp_chunkhdr *ch; ch = mtod(chk-data, struct sctp_chunkhdr *); - - old_len = len = SCTP_SIZE32(ntohs(ch-chunk_length)); /* get to new offset for the param. */ @@ -11597,22 +11587,18 @@ sctp_add_stream_reset_result(struct sctp chk-send_size = SCTP_SIZE32(chk-book_size); SCTP_BUF_LEN(chk-data) = chk-send_size; return; - } - void sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *chk, uint32_t resp_seq, uint32_t result, uint32_t send_una, uint32_t recv_next) { - int len, old_len; + uint16_t len, old_len; struct sctp_stream_reset_response_tsn *resp; struct sctp_chunkhdr *ch; ch = mtod(chk-data, struct sctp_chunkhdr *); - - old_len = len = SCTP_SIZE32(ntohs(ch-chunk_length)); /* get to new offset for the param. */ @@ -11640,7 +11626,7 @@ sctp_add_an_out_stream(struct sctp_tmit_ uint32_t seq, uint16_t adding) { - int len, old_len; + uint16_t len, old_len; struct sctp_chunkhdr *ch; struct sctp_stream_reset_add_strm *addstr; @@ -11673,7 +11659,7 @@ sctp_add_an_in_stream(struct sctp_tmit_c uint32_t seq, uint16_t adding) { - int len, old_len; + uint16_t len, old_len; struct sctp_chunkhdr *ch; struct sctp_stream_reset_add_strm *addstr; @@ -11700,8 +11686,6 @@ sctp_add_an_in_stream(struct sctp_tmit_c return; } - - int sctp_send_str_reset_req(struct sctp_tcb *stcb, int number_entries, uint16_t * list, @@ -11710,8 +11694,7 @@ sctp_send_str_reset_req(struct sctp_tcb uint8_t send_tsn_req, uint8_t add_stream, uint16_t adding_o, -uint16_t adding_i, uint8_t peer_asked -) +uint16_t adding_i, uint8_t peer_asked) { struct sctp_association *asoc; Modified: head/sys/netinet/sctp_output.h == --- head/sys/netinet/sctp_output.h Sat Sep 22 12:52:41 2012 (r240825) +++ head/sys/netinet/sctp_output.h Sat Sep 22 14:39:20 2012 (r240826) @@ -173,37 +173,19 @@ void sctp_send_cwr(struct sctp_tcb *, st void
svn commit: r240842 - head/sys/netinet
Author: tuexen Date: Sat Sep 22 22:04:17 2012 New Revision: 240842 URL: http://svn.freebsd.org/changeset/base/240842 Log: Fix a bug related to handling Re-config chunks. It is not true that the association can be removed if the socket is gone. MFC after:3 days Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sat Sep 22 21:34:46 2012 (r240841) +++ head/sys/netinet/sctp_input.c Sat Sep 22 22:04:17 2012 (r240842) @@ -5387,23 +5387,6 @@ process_control_chunks: *offset = length; return (NULL); } - if (inp-sctp_flags SCTP_PCB_FLAGS_SOCKET_GONE) { - /* We are not interested anymore */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(inp); - atomic_add_int(stcb-asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(stcb-asoc.refcnt, 1); -#endif - (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_30); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif - *offset = length; - return (NULL); - } if (stcb-asoc.peer_supports_strreset == 0) { /* * hmm, peer should have announced this, but ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240848 - head/sys/netinet
Author: tuexen Date: Sun Sep 23 07:23:18 2012 New Revision: 240848 URL: http://svn.freebsd.org/changeset/base/240848 Log: Declare a static function as such. MFC after:3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sun Sep 23 06:16:08 2012 (r240847) +++ head/sys/netinet/sctp_output.c Sun Sep 23 07:23:18 2012 (r240848) @@ -6412,7 +6412,7 @@ error_out: } } -int +static int sctp_med_chunk_output(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_association *asoc, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240849 - head/sys/netinet
Author: tuexen Date: Sun Sep 23 07:43:10 2012 New Revision: 240849 URL: http://svn.freebsd.org/changeset/base/240849 Log: Whitespace change. MFC after:3 days Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Sun Sep 23 07:23:18 2012(r240848) +++ head/sys/netinet/sctp_pcb.c Sun Sep 23 07:43:10 2012(r240849) @@ -3323,8 +3323,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, continue; } else if (TAILQ_EMPTY(asoc-asoc.send_queue) TAILQ_EMPTY(asoc-asoc.sent_queue) - (asoc-asoc.stream_queue_cnt == 0) - ) { + (asoc-asoc.stream_queue_cnt == 0)) { if (asoc-asoc.locked_on_sending) { goto abort_anyway; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r241916 - in head/sys: netinet netinet6
On Oct 23, 2012, at 6:23 AM, Bruce Evans wrote: On Mon, 22 Oct 2012, Xin LI wrote: Log: Remove __P. This was a chance to remove style bugs in the prototypes. At least it didn't create so many new ones, unlike the original __P axing. It still enlarged about a hundred by changing from Gnu style continuation to Gnu style continuation indentation with an off-by-5 error. Hi Bruce, please note that the SCTP code in the FreeBSD sources is generated via an export script from a codebase which runs on multiple platforms. The script tries to follow FreeBSDs guidelines, but is far from being perfect. Best regards Michael Modified: head/sys/netinet/sctp_uio.h == --- head/sys/netinet/sctp_uio.h Mon Oct 22 21:26:36 2012 (r241915) +++ head/sys/netinet/sctp_uio.h Mon Oct 22 21:49:56 2012 (r241916) @@ -1267,44 +1267,44 @@ sctp_sorecvmsg(struct socket *so, #if !(defined(_KERNEL)) !(defined(__Userspace__)) __BEGIN_DECLS -int sctp_peeloff __P((int, sctp_assoc_t)); -int sctp_bindx __P((int, struct sockaddr *, int, int)); -int sctp_connectx __P((int, const struct sockaddr *, int, sctp_assoc_t *)); -int sctp_getaddrlen __P((sa_family_t)); -int sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **)); -void sctp_freepaddrs __P((struct sockaddr *)); -int sctp_getladdrs __P((int, sctp_assoc_t, struct sockaddr **)); -void sctp_freeladdrs __P((struct sockaddr *)); -int sctp_opt_info __P((int, sctp_assoc_t, int, void *, socklen_t *)); +int sctp_peeloff(int, sctp_assoc_t); +int sctp_bindx(int, struct sockaddr *, int, int); +int sctp_connectx(int, const struct sockaddr *, int, sctp_assoc_t *); +int sctp_getaddrlen(sa_family_t); +int sctp_getpaddrs(int, sctp_assoc_t, struct sockaddr **); +void sctp_freepaddrs(struct sockaddr *); +int sctp_getladdrs(int, sctp_assoc_t, struct sockaddr **); +void sctp_freeladdrs(struct sockaddr *); +int sctp_opt_info(int, sctp_assoc_t, int, void *, socklen_t *); sctp is fairly consistent in having style bugs on every line. It never indented fucntion names in prototypes. /* deprecated */ ssize_t sctp_sendmsg -__P((int, const void *, size_t, const struct sockaddr *, -socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t)); +(int, const void *, size_t, const struct sockaddr *, +socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); Putting the __P(( unindented on a new line was weird. It is weirder now with the __P( part. /* deprecated */ -ssize_t sctp_send __P((int, const void *, size_t, - const struct sctp_sndrcvinfo *, int)); +ssize_t sctp_send(int, const void *, size_t, + const struct sctp_sndrcvinfo *, int); Continuation lines were weirdly indented in at least this part of sctp. This one uses 14 spaces, underneath a line with 1 tab. 1 tab followed by 4 spaces would be normal. Since the 14 spaces didn't line up with anything, removing __P( leaves the continuation line not lined up with anything slightly differently. ... /* deprecated */ -ssize_t sctp_recvmsg __P((int, void *, size_t, struct sockaddr *, socklen_t *, - struct sctp_sndrcvinfo *, int *)); +ssize_t sctp_recvmsg(int, void *, size_t, struct sockaddr *, socklen_t *, + struct sctp_sndrcvinfo *, int *); Here there are 17 spaces instead of 14. Modified: head/sys/netinet6/icmp6.c == --- head/sys/netinet6/icmp6.cMon Oct 22 21:26:36 2012 (r241915) +++ head/sys/netinet6/icmp6.cMon Oct 22 21:49:56 2012 (r241916) @@ -133,15 +133,15 @@ VNET_DECLARE(int, icmp6_nodeinfo); static void icmp6_errcount(struct icmp6errstat *, int, int); static int icmp6_rip6_input(struct mbuf **, int); static int icmp6_ratelimit(const struct in6_addr *, const int, const int); -static const char *icmp6_redirect_diag __P((struct in6_addr *, -struct in6_addr *, struct in6_addr *)); +static const char *icmp6_redirect_diag(struct in6_addr *, +struct in6_addr *, struct in6_addr *); Function names not indented. Continuation lines indented abnormally with 1 tab so that it doesn't line up with anything. static struct mbuf *ni6_input(struct mbuf *, int); static struct mbuf *ni6_nametodns(const char *, int, int); static int ni6_dnsmatch(const char *, int, const char *, int); -static int ni6_addrs __P((struct icmp6_nodeinfo *, struct mbuf *, - struct ifnet **, struct in6_addr *)); -static int ni6_store_addrs __P((struct icmp6_nodeinfo *, struct icmp6_nodeinfo *, -struct ifnet *, int)); Here the continuation lines were indented abnormally but using Gnu style (indent -lp) so that they lined up with the parantheses using a mixture of tabs and spaces. +static int ni6_addrs(struct icmp6_nodeinfo *,
Re: svn commit: r241916 - in head/sys: netinet netinet6
On Oct 23, 2012, at 8:28 PM, Bruce Evans wrote: On Tue, 23 Oct 2012, Michael Tuexen wrote: On Oct 23, 2012, at 6:23 AM, Bruce Evans wrote: On Mon, 22 Oct 2012, Xin LI wrote: Log: Remove __P. This was a chance to remove style bugs in the prototypes. At least it didn't create so many new ones, unlike the original __P axing. It still enlarged about a hundred by changing from Gnu style continuation to Gnu style continuation indentation with an off-by-5 error. please note that the SCTP code in the FreeBSD sources is generated via an export script from a codebase which runs on multiple platforms. The script tries to follow FreeBSDs guidelines, but is far from being perfect. The export script might not like manual editing of its output. Portability might require __P(()), and then removing it cleaning requires a complicated script. Maybe I wasn't clear... * The removal of __P() needs also be done upstream. I'll handle this, not problem. I don't think we need __P on any platform. * My comment was regarding your list of formatting issues of the code. Changing the formatting would require changing the export script. If someone just changes the FreeBSD sources and these changes are not included upstream, they are lost by the next commit of rrs@ or mine. My point was: Getting rid of __P is fine and we can handle that upstream (as any other non whitespace/formatting changes needed), but changing the formatting is NOT that easy. I'm sorry about that and just wanted to let you know that there is a reason why the style 9 stuff is not followed exactly within the SCTP code. I hope this makes the situation clearer. Best regards Michael Bruce ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242325 - head/sys/netinet
Author: tuexen Date: Mon Oct 29 20:42:48 2012 New Revision: 242325 URL: http://svn.freebsd.org/changeset/base/242325 Log: Use ntohs() and htons() in correct order. However, this doesn't change functionality. Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Mon Oct 29 18:06:09 2012(r242324) +++ head/sys/netinet/sctputil.c Mon Oct 29 20:42:48 2012(r242325) @@ -6821,7 +6821,7 @@ sctp_recv_udp_tunneled_packet(struct mbu switch (iph-ip_v) { #ifdef INET case IPVERSION: - iph-ip_len = ntohs(htons(iph-ip_len) - sizeof(struct udphdr)); + iph-ip_len = htons(ntohs(iph-ip_len) - sizeof(struct udphdr)); sctp_input_with_port(m, off, port); break; #endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242326 - head/sys/netinet
Author: tuexen Date: Mon Oct 29 20:44:29 2012 New Revision: 242326 URL: http://svn.freebsd.org/changeset/base/242326 Log: Add braces (as used elsewhere in the SCTP code). Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Mon Oct 29 20:42:48 2012 (r242325) +++ head/sys/netinet/sctp_output.c Mon Oct 29 20:44:29 2012 (r242326) @@ -3981,9 +3981,9 @@ sctp_lowlevel_chunk_output(struct sctp_i } if ((nofragment_flag) (port == 0)) { ip-ip_off = htons(IP_DF); - } else + } else { ip-ip_off = htons(0); - + } /* FreeBSD has a function for ip_id's */ ip-ip_id = ip_newid(); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r242327 - in head/sys: netinet netinet6
Author: tuexen Date: Mon Oct 29 20:47:32 2012 New Revision: 242327 URL: http://svn.freebsd.org/changeset/base/242327 Log: Whitespace changes due to upstream integration of SCTP changes in the FreeBSD code base. Modified: head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_var.h head/sys/netinet6/sctp6_var.h Modified: head/sys/netinet/sctp_uio.h == --- head/sys/netinet/sctp_uio.h Mon Oct 29 20:44:29 2012(r242326) +++ head/sys/netinet/sctp_uio.h Mon Oct 29 20:47:32 2012(r242327) @@ -1278,33 +1278,39 @@ void sctp_freeladdrs(struct sockaddr *); int sctp_opt_info(int, sctp_assoc_t, int, void *, socklen_t *); /* deprecated */ -ssize_t sctp_sendmsg -(int, const void *, size_t, const struct sockaddr *, +ssize_t +sctp_sendmsg(int, const void *, size_t, const struct sockaddr *, socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); /* deprecated */ - ssize_t sctp_send(int, const void *, size_t, - const struct sctp_sndrcvinfo *, int); +ssize_t +sctp_send(int, const void *, size_t, +const struct sctp_sndrcvinfo *, int); /* deprecated */ - ssize_t sctp_sendx(int, const void *, size_t, struct sockaddr *, - int, struct sctp_sndrcvinfo *, int); +ssize_t +sctp_sendx(int, const void *, size_t, struct sockaddr *, +int, struct sctp_sndrcvinfo *, int); /* deprecated */ - ssize_t sctp_sendmsgx(int sd, const void *, size_t, struct sockaddr *, - int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); +ssize_t +sctp_sendmsgx(int sd, const void *, size_t, struct sockaddr *, +int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); - sctp_assoc_t sctp_getassocid(int, struct sockaddr *); +sctp_assoc_t sctp_getassocid(int, struct sockaddr *); /* deprecated */ - ssize_t sctp_recvmsg(int, void *, size_t, struct sockaddr *, socklen_t *, - struct sctp_sndrcvinfo *, int *); - - ssize_t sctp_sendv(int, const struct iovec *, int, struct sockaddr *, - int, void *, socklen_t, unsigned int, int); - - ssize_t sctp_recvv(int, const struct iovec *, int, struct sockaddr *, - socklen_t *, void *, socklen_t *, unsigned int *, int *); +ssize_t +sctp_recvmsg(int, void *, size_t, struct sockaddr *, socklen_t *, +struct sctp_sndrcvinfo *, int *); + +ssize_t +sctp_sendv(int, const struct iovec *, int, struct sockaddr *, +int, void *, socklen_t, unsigned int, int); + +ssize_t +sctp_recvv(int, const struct iovec *, int, struct sockaddr *, +socklen_t *, void *, socklen_t *, unsigned int *, int *); __END_DECLS Modified: head/sys/netinet/sctp_var.h == --- head/sys/netinet/sctp_var.h Mon Oct 29 20:44:29 2012(r242326) +++ head/sys/netinet/sctp_var.h Mon Oct 29 20:47:32 2012(r242327) @@ -321,48 +321,34 @@ struct sctphdr; void sctp_close(struct socket *so); int sctp_disconnect(struct socket *so); - void sctp_ctlinput(int, struct sockaddr *, void *); int sctp_ctloutput(struct socket *, struct sockopt *); #ifdef INET void sctp_input_with_port(struct mbuf *, int, uint16_t); - -#endif -#ifdef INET void sctp_input(struct mbuf *, int); #endif void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t); void sctp_drain(void); void sctp_init(void); - void sctp_finish(void); - int sctp_flush(struct socket *, int); int sctp_shutdown(struct socket *); -void sctp_notify -(struct sctp_inpcb *, struct ip *ip, struct sctphdr *, +void +sctp_notify(struct sctp_inpcb *, struct ip *ip, struct sctphdr *, struct sockaddr *, struct sctp_tcb *, struct sctp_nets *); - - int sctp_bindx(struct socket *, int, struct sockaddr_storage *, -int, int, struct proc *); +int +sctp_bindx(struct socket *, int, struct sockaddr_storage *, +int, int, struct proc *); /* can't use sctp_assoc_t here */ - int sctp_peeloff(struct socket *, struct socket *, int, caddr_t, int *); - - int sctp_ingetaddr(struct socket *, -struct sockaddr ** -); - - int sctp_peeraddr(struct socket *, -struct sockaddr ** -); - - int sctp_listen(struct socket *, int, struct thread *); - - int sctp_accept(struct socket *, struct sockaddr **); +int sctp_peeloff(struct socket *, struct socket *, int, caddr_t, int *); +int sctp_ingetaddr(struct socket *, struct sockaddr **); +int sctp_peeraddr(struct socket *, struct sockaddr **); +int sctp_listen(struct socket *, int, struct thread *); +int sctp_accept(struct socket *, struct sockaddr **); #endif /* _KERNEL */ Modified: head/sys/netinet6/sctp6_var.h == --- head/sys/netinet6/sctp6_var.h Mon Oct 29 20:44:29 2012 (r242326) +++ head/sys/netinet6/sctp6_var.h Mon Oct 29 20:47:32 2012
svn commit: r207966 - head/sys/netinet
Author: tuexen Date: Wed May 12 16:10:33 2010 New Revision: 207966 URL: http://svn.freebsd.org/changeset/base/207966 Log: Get rid of unused constants. MFC after: 3 days. Modified: head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_constants.h == --- head/sys/netinet/sctp_constants.h Wed May 12 16:01:48 2010 (r207965) +++ head/sys/netinet/sctp_constants.h Wed May 12 16:10:33 2010 (r207966) @@ -361,14 +361,6 @@ __FBSDID($FreeBSD$); * hit this value) */ #define SCTP_DATAGRAM_RESEND 4 #define SCTP_DATAGRAM_ACKED10010 -/* EY - * If a tsn is nr-gapped, its first tagged as NR_MARKED and then NR_ACKED - * When yet another nr-sack is received, if a particular TSN's sent tag - * is observed to be NR_ACKED after gap-ack info is processed, this implies - * that particular TSN is reneged -*/ -#define SCTP_DATAGRAM_NR_ACKED 10020 -#define SCTP_DATAGRAM_NR_MARKED20005 #define SCTP_DATAGRAM_MARKED 20010 #define SCTP_FORWARD_TSN_SKIP 30010 Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Wed May 12 16:01:48 2010 (r207965) +++ head/sys/netinet/sctp_indata.c Wed May 12 16:10:33 2010 (r207966) @@ -4917,14 +4917,6 @@ done_with_it: if (tp1 != NULL) { /* Peer revoked all dg's marked or acked */ TAILQ_FOREACH(tp1, asoc-sent_queue, sctp_next) { - /* -* EY- maybe check only if it is nr_acked -* nr_marked may not be possible -*/ - if ((tp1-sent == SCTP_DATAGRAM_NR_ACKED) || - (tp1-sent == SCTP_DATAGRAM_NR_MARKED)) { - continue; - } if (tp1-sent == SCTP_DATAGRAM_ACKED) { tp1-sent = SCTP_DATAGRAM_SENT; if (SCTP_BASE_SYSCTL(sctp_logging_level) SCTP_FLIGHT_LOGGING_ENABLE) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r209060 - head/sys/dev/ixgbe
On Jun 11, 2010, at 10:44 PM, Jack Vogel wrote: On Fri, Jun 11, 2010 at 1:27 PM, Jack Vogel jfvo...@gmail.com wrote: On Fri, Jun 11, 2010 at 1:23 PM, Bjoern A. Zeeb b...@freebsd.org wrote: On Fri, 11 Jun 2010, Jack Vogel wrote: Odd though, because that code is in the driver on a system with 16 cores and I'm not hearing about any problem from my test engineer. So this makes it all go away: --- //depot/user/bz/vimage/src/sys/dev/ixgbe/ixgbe.c2010-06-09 07:53:30.0 +++ /zoo/bz/p4/bz_vimage/src/sys/dev/ixgbe/ixgbe.c 2010-06-09 07:53:30.0 --- /tmp/tmp.96356.27 2010-06-11 16:19:14.0 -0400 +++ /zoo/bz/p4/bz_vimage/src/sys/dev/ixgbe/ixgbe.c 2010-06-11 16:16:02.0 -0400 @@ -3637,7 +3637,7 @@ ixgbe_setup_receive_ring(struct rx_ring goto skip_head; /* First the header */ - rxbuf-m_head = m_gethdr(M_WAITOK, MT_DATA); + rxbuf-m_head = m_gethdr(M_DONTWAIT, MT_DATA); if (rxbuf-m_head == NULL) { error = ENOBUFS; goto fail; @@ -3659,7 +3659,7 @@ ixgbe_setup_receive_ring(struct rx_ring skip_head: /* Now the payload cluster */ - rxbuf-m_pack = m_getjcl(M_WAITOK, MT_DATA, + rxbuf-m_pack = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, adapter-rx_mbuf_sz); if (rxbuf-m_pack == NULL) { error = ENOBUFS; Are they running with WITNESS enabled to see the locking warnings? He's running with a recent version of STABLE/8 so probably does not have WITNESS on. So you think that causes the problem? I just went into the lab, he does have the WAITOK in the driver, and the system has 16 cores. So, I'm still not clear why you see a problem when he does not. I will change it back to NOWAIT in any case. Try enabling WITNESS. It is possible that I saw something like this when trying to temporary enable WITNESS on a system. But then went back and did not investigate it... Best regards Michael Jack ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r209178 - head/sys/netinet
Author: tuexen Date: Mon Jun 14 21:25:07 2010 New Revision: 209178 URL: http://svn.freebsd.org/changeset/base/209178 Log: * Fix a bug where the length of the ASCONF-ACK was calculated wrong due to using an uninitialized variable. * Fix a bug where a NULL pointer was dereferenced when interfaces come and go at a high rate. * Fix a bug where inps where not deregistered from iterators. * Fix a race condition in freeing an association. * Fix a refcount problem related to the iterator. Each of the above bug results in a panic. It shows up when interfaces come and go at a high rate. Obtained from: rrs (partly) MFC after: 3 days Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Mon Jun 14 21:18:58 2010 (r209177) +++ head/sys/netinet/sctp_asconf.c Mon Jun 14 21:25:07 2010 (r209178) @@ -826,6 +826,7 @@ send_reply: ack-serial_number = serial_num; ack-last_sent_to = NULL; ack-data = m_ack; + ack-len = 0; n = m_ack; while (n) { ack-len += SCTP_BUF_LEN(n); @@ -1025,7 +1026,8 @@ sctp_asconf_nets_cleanup(struct sctp_tcb * address. */ if (SCTP_ROUTE_HAS_VALID_IFN(net-ro) - SCTP_GET_IF_INDEX_FROM_ROUTE(net-ro) != ifn-ifn_index) { + ((ifn == NULL) || + (SCTP_GET_IF_INDEX_FROM_ROUTE(net-ro) != ifn-ifn_index))) { /* clear any cached route */ RTFREE(net-ro.ro_rt); net-ro.ro_rt = NULL; Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Mon Jun 14 21:18:58 2010(r209177) +++ head/sys/netinet/sctp_pcb.c Mon Jun 14 21:25:07 2010(r209178) @@ -3074,6 +3074,9 @@ sctp_iterator_inp_being_freed(struct sct SCTP_FREE(it, SCTP_M_ITER); } else { it-inp = LIST_NEXT(it-inp, sctp_list); + if (it-inp) { + SCTP_INP_INCR_REF(it-inp); + } } /* * When its put in the refcnt is incremented so decr @@ -3114,17 +3117,10 @@ sctp_inpcb_free(struct sctp_inpcb *inp, #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 0); #endif - if (from == SCTP_CALLED_AFTER_CMPSET_OFCLOSE) { - /* -* Once we are in we can remove the flag from = 1 is only -* passed from the actual closing routines that are called -* via the sockets layer. -*/ - SCTP_ITERATOR_LOCK(); - /* mark any iterators on the list or being processed */ - sctp_iterator_inp_being_freed(inp); - SCTP_ITERATOR_UNLOCK(); - } + SCTP_ITERATOR_LOCK(); + /* mark any iterators on the list or being processed */ + sctp_iterator_inp_being_freed(inp); + SCTP_ITERATOR_UNLOCK(); so = inp-sctp_socket; if (inp-sctp_flags SCTP_PCB_FLAGS_SOCKET_ALLGONE) { /* been here before.. eeks.. get out of here */ @@ -4637,7 +4633,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, atomic_add_int(stcb-asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); - SCTP_INP_INFO_WLOCK(); SCTP_INP_WLOCK(inp); SCTP_TCB_LOCK(stcb); @@ -4680,6 +4675,16 @@ sctp_free_assoc(struct sctp_inpcb *inp, if (from_inpcbfree == SCTP_NORMAL_PROC) { atomic_add_int(stcb-asoc.refcnt, -1); } + if (stcb-asoc.refcnt) { + stcb-asoc.state = ~SCTP_STATE_IN_ACCEPT_QUEUE; + sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL); + if (from_inpcbfree == SCTP_NORMAL_PROC) { + SCTP_INP_INFO_WUNLOCK(); + SCTP_INP_WUNLOCK(inp); + } + SCTP_TCB_UNLOCK(stcb); + return (0); + } asoc-state = 0; if (inp-sctp_tcbhash) { LIST_REMOVE(stcb, sctp_tcbhash); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r209289 - head/sys/netinet
Author: tuexen Date: Fri Jun 18 09:01:44 2010 New Revision: 209289 URL: http://svn.freebsd.org/changeset/base/209289 Log: Fix a rece condition in the shutdown handling. The race condition resulted in a panic. MFC after: 3 days Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp.h == --- head/sys/netinet/sctp.h Fri Jun 18 08:51:20 2010(r209288) +++ head/sys/netinet/sctp.h Fri Jun 18 09:01:44 2010(r209289) @@ -442,6 +442,7 @@ struct sctp_error_unrecognized_chunk { #define SCTP_PCB_FLAGS_BLOCKING_IO 0x0800 #define SCTP_PCB_FLAGS_SOCKET_GONE 0x1000 #define SCTP_PCB_FLAGS_SOCKET_ALLGONE 0x2000 +#define SCTP_PCB_FLAGS_SOCKET_CANT_READ0x4000 /* flags to copy to new PCB */ #define SCTP_PCB_COPY_FLAGS(SCTP_PCB_FLAGS_BOUNDALL|\ SCTP_PCB_FLAGS_WAKEINPUT|\ Modified: head/sys/netinet/sctp_usrreq.c == --- head/sys/netinet/sctp_usrreq.c Fri Jun 18 08:51:20 2010 (r209288) +++ head/sys/netinet/sctp_usrreq.c Fri Jun 18 09:01:44 2010 (r209289) @@ -947,11 +947,30 @@ sctp_flush(struct socket *so, int how) * they will not be able to read the data, the socket will block * that from happening. */ + struct sctp_inpcb *inp; + + inp = (struct sctp_inpcb *)so-so_pcb; + if (inp == NULL) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + return EINVAL; + } + SCTP_INP_RLOCK(inp); + /* For the 1 to many model this does nothing */ + if (inp-sctp_flags SCTP_PCB_FLAGS_UDPTYPE) { + SCTP_INP_RUNLOCK(inp); + return (0); + } + SCTP_INP_RUNLOCK(inp); if ((how == PRU_FLUSH_RD) || (how == PRU_FLUSH_RDWR)) { /* * First make sure the sb will be happy, we don't use these * except maybe the count */ + SCTP_INP_WLOCK(inp); + SCTP_INP_READ_LOCK(inp); + inp-sctp_flags |= SCTP_PCB_FLAGS_SOCKET_CANT_READ; + SCTP_INP_READ_UNLOCK(inp); + SCTP_INP_WUNLOCK(inp); so-so_rcv.sb_cc = 0; so-so_rcv.sb_mbcnt = 0; so-so_rcv.sb_mb = NULL; Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Fri Jun 18 08:51:20 2010(r209288) +++ head/sys/netinet/sctputil.c Fri Jun 18 09:01:44 2010(r209289) @@ -3185,6 +3185,9 @@ sctp_notify_partial_delivery_indication( /* event not enabled */ return; } + if (stcb-sctp_ep-sctp_flags SCTP_PCB_FLAGS_SOCKET_CANT_READ) { + return; + } m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_pdapi_event), 0, M_DONTWAIT, 1, MT_DATA); if (m_notify == NULL) /* no space left */ @@ -4365,6 +4368,17 @@ sctp_add_to_readq(struct sctp_inpcb *inp } if (inp_read_lock_held == 0) SCTP_INP_READ_LOCK(inp); + if (inp-sctp_flags SCTP_PCB_FLAGS_SOCKET_CANT_READ) { + sctp_free_remote_addr(control-whoFrom); + if (control-data) { + sctp_m_freem(control-data); + control-data = NULL; + } + SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), control); + if (inp_read_lock_held == 0) + SCTP_INP_READ_UNLOCK(inp); + return; + } if (!(control-spec_flags M_NOTIFICATION)) { atomic_add_int(inp-total_recvs, 1); if (!control-do_not_ref_stcb) { @@ -4405,6 +4419,8 @@ sctp_add_to_readq(struct sctp_inpcb *inp control-tail_mbuf = prev; } else { /* Everything got collapsed out?? */ + sctp_free_remote_addr(control-whoFrom); + SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), control); if (inp_read_lock_held == 0) SCTP_INP_READ_UNLOCK(inp); return; @@ -4477,6 +4493,10 @@ get_out: } return (-1); } + if (inp (inp-sctp_flags SCTP_PCB_FLAGS_SOCKET_CANT_READ)) { + SCTP_INP_READ_UNLOCK(inp); + return 0; + } if (control-end_added) { /* huh this one is complete? */ goto get_out; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r209540 - head/sys/kern
Author: tuexen Date: Sat Jun 26 19:26:20 2010 New Revision: 209540 URL: http://svn.freebsd.org/changeset/base/209540 Log: * Do not dereference a NULL pointer when calling an SCTP send syscall not providing a destination address and using ktrace. * Do not copy out kernel memory when providing sinfo for sctp_recvmsg(). Both bug where reported by Valentin Nechayev. The first bug results in a kernel panic. MFC after: 3 days. Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c == --- head/sys/kern/uipc_syscalls.c Sat Jun 26 18:13:44 2010 (r209539) +++ head/sys/kern/uipc_syscalls.c Sat Jun 26 19:26:20 2010 (r209540) @@ -2409,7 +2409,7 @@ sctp_generic_sendmsg (td, uap) if (error) goto sctp_bad; #ifdef KTRACE - if (KTRPOINT(td, KTR_STRUCT)) + if (to (KTRPOINT(td, KTR_STRUCT))) ktrsockaddr(to); #endif @@ -2523,7 +2523,7 @@ sctp_generic_sendmsg_iov(td, uap) if (error) goto sctp_bad1; #ifdef KTRACE - if (KTRPOINT(td, KTR_STRUCT)) + if (to (KTRPOINT(td, KTR_STRUCT))) ktrsockaddr(to); #endif @@ -2677,6 +2677,7 @@ sctp_generic_recvmsg(td, uap) if (KTRPOINT(td, KTR_GENIO)) ktruio = cloneuio(auio); #endif /* KTRACE */ + memset(sinfo, 0, sizeof(struct sctp_sndrcvinfo)); CURVNET_SET(so-so_vnet); error = sctp_sorecvmsg(so, auio, (struct mbuf **)NULL, fromsa, fromlen, msg_flags, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r210495 - head/sys/netinet
Author: tuexen Date: Mon Jul 26 09:26:55 2010 New Revision: 210495 URL: http://svn.freebsd.org/changeset/base/210495 Log: Fix a bug where the length of a FORWARD-TSN chunk was set incorrectly in the chunk. This resulted in malformed frames. Remove a duplicate assignment. MFC after: 2 weeks Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Mon Jul 26 09:22:52 2010 (r210494) +++ head/sys/netinet/sctp_output.c Mon Jul 26 09:26:55 2010 (r210495) @@ -2271,7 +2271,6 @@ sctp_is_ifa_addr_acceptable(struct sctp_ { uint8_t dest_is_global = 0; - /* * Here we determine if its a acceptable address. A acceptable * address means it is the same scope or higher scope but we can @@ -9800,7 +9799,8 @@ sctp_fill_in_rest: * peer ack point */ advance_peer_ack_point = last-rec.data.TSN_seq; - space_needed -= (cnt_of_skipped * sizeof(struct sctp_strseq)); + space_needed = sizeof(struct sctp_forward_tsn_chunk) + + cnt_of_skipped * sizeof(struct sctp_strseq); } chk-send_size = space_needed; /* Setup the chunk */ @@ -9809,8 +9809,6 @@ sctp_fill_in_rest: fwdtsn-ch.chunk_flags = 0; fwdtsn-ch.chunk_type = SCTP_FORWARD_CUM_TSN; fwdtsn-new_cumulative_tsn = htonl(advance_peer_ack_point); - chk-send_size = (sizeof(struct sctp_forward_tsn_chunk) + - (cnt_of_skipped * sizeof(struct sctp_strseq))); SCTP_BUF_LEN(chk-data) = chk-send_size; fwdtsn++; /*- ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r210714 - head/sys/netinet
Author: tuexen Date: Sun Aug 1 08:06:59 2010 New Revision: 210714 URL: http://svn.freebsd.org/changeset/base/210714 Log: Cleanup code. MFC after: 2 weeks Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sun Aug 1 06:36:41 2010 (r210713) +++ head/sys/netinet/sctp_output.c Sun Aug 1 08:06:59 2010 (r210714) @@ -9748,8 +9748,7 @@ sctp_fill_in_rest: unsigned int cnt_of_skipped = 0; TAILQ_FOREACH(at, asoc-sent_queue, sctp_next) { - if ((at-sent != SCTP_FORWARD_TSN_SKIP) /* (at-sent != - SCTP_DATAGRAM_ACKED) */ ) { + if (at-sent != SCTP_FORWARD_TSN_SKIP) { /* no more to look at */ break; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r211030 - head/sys/kern
Author: tuexen Date: Sat Aug 7 17:57:58 2010 New Revision: 211030 URL: http://svn.freebsd.org/changeset/base/211030 Log: Fix a bug where MSG_TRUNC was not returned in all necessary cases for SOCK_DGRAM socket. MSG_TRUNC was only returned when some mbufs could not be copied to the application. If some data was left in the last mbuf, it was correctly discarded, but MSG_TRUNC was not set. Reviewed by: bz MFC after: 3 weeks Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c == --- head/sys/kern/uipc_socket.c Sat Aug 7 17:39:22 2010(r211029) +++ head/sys/kern/uipc_socket.c Sat Aug 7 17:57:58 2010(r211030) @@ -2236,7 +2236,12 @@ soreceive_dgram(struct socket *so, struc m_freem(m); return (error); } - m = m_free(m); + if (len == m-m_len) + m = m_free(m); + else { + m-m_data += len; + m-m_len -= len; + } } if (m != NULL) flags |= MSG_TRUNC; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r211944 - in head/sys: netinet netinet6
Author: tuexen Date: Sat Aug 28 17:59:51 2010 New Revision: 211944 URL: http://svn.freebsd.org/changeset/base/211944 Log: Fix the switching on/off of CMT using sysctl and socket option. Fix the switching on/off of PF and NR-SACKs using sysctl. Add minor improvement in handling malloc failures. Improve the address checks when sending. MFC after: 4 weeks Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_cc_functions.c head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_peeloff.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp.h == --- head/sys/netinet/sctp.h Sat Aug 28 17:54:17 2010(r211943) +++ head/sys/netinet/sctp.h Sat Aug 28 17:59:51 2010(r211944) @@ -155,10 +155,8 @@ struct sctp_paramhdr { /* CMT ON/OFF socket option */ #define SCTP_CMT_ON_OFF 0x1200 #define SCTP_CMT_USE_DAC0x1201 -/* EY - NR_SACK on/off socket option */ -#define SCTP_NR_SACK_ON_OFF 0x1300 /* JRS - Pluggable Congestion Control Socket option */ -#define SCTP_PLUGGABLE_CC 0x1202 +#define SCTP_PLUGGABLE_CC 0x1202 /* read only */ #define SCTP_GET_SNDBUF_USE0x1101 Modified: head/sys/netinet/sctp_cc_functions.c == --- head/sys/netinet/sctp_cc_functions.cSat Aug 28 17:54:17 2010 (r211943) +++ head/sys/netinet/sctp_cc_functions.cSat Aug 28 17:59:51 2010 (r211944) @@ -71,7 +71,8 @@ sctp_cwnd_update_after_fr(struct sctp_tc * (net-fast_retran_loss_recovery == 0))) */ TAILQ_FOREACH(net, asoc-nets, sctp_next) { - if ((asoc-fast_retran_loss_recovery == 0) || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 1)) { + if ((asoc-fast_retran_loss_recovery == 0) || + (asoc-sctp_cmt_on_off == 1)) { /* out of a RFC2582 Fast recovery window? */ if (net-net_ack 0) { /* @@ -232,11 +233,11 @@ sctp_cwnd_update_after_sack(struct sctp_ * * Should we stop any running T3 timer here? */ - if (SCTP_BASE_SYSCTL(sctp_cmt_on_off) - SCTP_BASE_SYSCTL(sctp_cmt_pf) + if ((asoc-sctp_cmt_on_off == 1) + (asoc-sctp_cmt_pf 0) ((net-dest_state SCTP_ADDR_PF) == SCTP_ADDR_PF)) { net-dest_state = ~SCTP_ADDR_PF; - net-cwnd = net-mtu * SCTP_BASE_SYSCTL(sctp_cmt_pf); + net-cwnd = net-mtu * asoc-sctp_cmt_pf; SCTPDBG(SCTP_DEBUG_INDATA1, Destination %p moved from PF to reachable with cwnd %d.\n, net, net-cwnd); /* @@ -260,7 +261,9 @@ sctp_cwnd_update_after_sack(struct sctp_ */ #endif - if (asoc-fast_retran_loss_recovery will_exit == 0 SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 0) { + if (asoc-fast_retran_loss_recovery + (will_exit == 0) + (asoc-sctp_cmt_on_off == 0)) { /* * If we are in loss recovery we skip any cwnd * update @@ -271,7 +274,8 @@ sctp_cwnd_update_after_sack(struct sctp_ * CMT: CUC algorithm. Update cwnd if pseudo-cumack has * moved. */ - if (accum_moved || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) net-new_pseudo_cumack)) { + if (accum_moved || + ((asoc-sctp_cmt_on_off == 1) net-new_pseudo_cumack)) { /* If the cumulative ack moved we can proceed */ if (net-cwnd = net-ssthresh) { /* We are in slow start */ @@ -697,7 +701,8 @@ sctp_hs_cwnd_update_after_fr(struct sctp * (net-fast_retran_loss_recovery == 0))) */ TAILQ_FOREACH(net, asoc-nets, sctp_next) { - if ((asoc-fast_retran_loss_recovery == 0) || (SCTP_BASE_SYSCTL(sctp_cmt_on_off) == 1)) { + if ((asoc-fast_retran_loss_recovery == 0) || + (asoc-sctp_cmt_on_off == 1)) { /* out of a RFC2582 Fast recovery window? */ if (net-net_ack 0) { /* @@ -850,11 +855,11 @@ sctp_hs_cwnd_update_after_sack(struct sc
svn commit: r211969 - in head/sys: netinet netinet6
Author: tuexen Date: Sun Aug 29 18:50:30 2010 New Revision: 211969 URL: http://svn.freebsd.org/changeset/base/211969 Log: Fix the the SCTP_WITH_NO_CSUM option when used in combination with interface supporting CRC offload. While at it, make use of the feature that the loopback interface provides CRC offloading. MFC after: 4 weeks Modified: head/sys/netinet/sctp_crc32.c head/sys/netinet/sctp_crc32.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_crc32.c == --- head/sys/netinet/sctp_crc32.c Sun Aug 29 18:31:04 2010 (r211968) +++ head/sys/netinet/sctp_crc32.c Sun Aug 29 18:50:30 2010 (r211969) @@ -115,20 +115,15 @@ sctp_calculate_cksum(struct mbuf *m, uin return (base); } -#else - -uint32_t -sctp_calculate_cksum(struct mbuf *m, uint32_t offset) -{ - return (0); -} - #endif /* !defined(SCTP_WITH_NO_CSUM) */ void sctp_delayed_cksum(struct mbuf *m, uint32_t offset) { +#if defined(SCTP_WITH_NO_CSUM) + panic(sctp_delayed_cksum() called when using no SCTP CRC.); +#else struct ip *ip; uint32_t checksum; @@ -149,4 +144,5 @@ sctp_delayed_cksum(struct mbuf *m, uint3 return; } *(uint32_t *) (m-m_data + offset) = checksum; +#endif } Modified: head/sys/netinet/sctp_crc32.h == --- head/sys/netinet/sctp_crc32.h Sun Aug 29 18:31:04 2010 (r211968) +++ head/sys/netinet/sctp_crc32.h Sun Aug 29 18:50:30 2010 (r211969) @@ -36,11 +36,12 @@ __FBSDID($FreeBSD$); #ifndef __crc32c_h__ #define __crc32c_h__ -#if defined(_KERNEL) || defined(__Userspace__) - +#if defined(_KERNEL) +#if !defined(SCTP_WITH_NO_CSUM) uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t); + +#endif void sctp_delayed_cksum(struct mbuf *, uint32_t offset); #endif /* _KERNEL */ - #endif /* __crc32c_h__ */ Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sun Aug 29 18:31:04 2010 (r211968) +++ head/sys/netinet/sctp_input.c Sun Aug 29 18:50:30 2010 (r211969) @@ -3068,7 +3068,7 @@ process_chunk_drop(struct sctp_tcb *stcb struct sctp_nets *net, uint8_t flg) { switch (desc-chunk_type) { - case SCTP_DATA: + case SCTP_DATA: /* find the tsn to resend (possibly */ { uint32_t tsn; @@ -5717,14 +5717,17 @@ sctp_input_with_port(struct mbuf *i_pak, struct ip *ip; struct sctphdr *sh; struct sctp_inpcb *inp = NULL; - - uint32_t check, calc_check; struct sctp_nets *net; struct sctp_tcb *stcb = NULL; struct sctp_chunkhdr *ch; int refcount_up = 0; int length, mlen, offset; +#if !defined(SCTP_WITH_NO_CSUM) + uint32_t check, calc_check; + +#endif + if (SCTP_GET_PKT_VRFID(i_pak, vrf_id)) { SCTP_RELEASE_PKT(i_pak); return; @@ -5799,18 +5802,14 @@ sctp_input_with_port(struct mbuf *i_pak, m-m_pkthdr.len, if_name(m-m_pkthdr.rcvif), m-m_pkthdr.csum_flags); +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_recvnocrc); +#else if (m-m_pkthdr.csum_flags CSUM_SCTP_VALID) { SCTP_STAT_INCR(sctps_recvhwcrc); goto sctp_skip_csum_4; } check = sh-checksum; /* save incoming checksum */ - if ((check == 0) (SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback)) - ((ip-ip_src.s_addr == ip-ip_dst.s_addr) || - (SCTP_IS_IT_LOOPBACK(m))) - ) { - SCTP_STAT_INCR(sctps_recvnocrc); - goto sctp_skip_csum_4; - } sh-checksum = 0; /* prepare for calc */ calc_check = sctp_calculate_cksum(m, iphlen); sh-checksum = check; @@ -5840,6 +5839,7 @@ sctp_input_with_port(struct mbuf *i_pak, goto bad; } sctp_skip_csum_4: +#endif /* destination port of 0 is illegal, based on RFC2960. */ if (sh-dest_port == 0) { SCTP_STAT_INCR(sctps_hdrops); Modified: head/sys/netinet/sctp_os_bsd.h == --- head/sys/netinet/sctp_os_bsd.h Sun Aug 29 18:31:04 2010 (r211968) +++ head/sys/netinet/sctp_os_bsd.h Sun Aug 29 18:50:30 2010 (r211969) @@ -433,20 +433,21 @@ typedef struct rtentry sctp_rtentry_t; */ #define SCTP_IP_OUTPUT(result, o_pak, ro, stcb, vrf_id) \ { \ - int o_flgs = 0; \ -
svn commit: r212099 - head/sys/netinet
Author: tuexen Date: Wed Sep 1 16:11:26 2010 New Revision: 212099 URL: http://svn.freebsd.org/changeset/base/212099 Log: Fix a bug which results in peer IPv4 addresses a.b.c.d with 224=d=239 incorrectly being detected as multicast addresses on little endian systems. MFC after: 2 weeks Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Wed Sep 1 15:24:47 2010(r212098) +++ head/sys/netinet/sctp_pcb.c Wed Sep 1 16:11:26 2010(r212099) @@ -5988,7 +5988,7 @@ sctp_load_addresses_from_init(struct sct } p4 = (struct sctp_ipv4addr_param *)phdr; sin.sin_addr.s_addr = p4-addr; - if (IN_MULTICAST(sin.sin_addr.s_addr)) { + if (IN_MULTICAST(ntohl(sin.sin_addr.s_addr))) { /* Skip multi-cast addresses */ goto next_param; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r212242 - in head/sys: kern netinet
Author: tuexen Date: Sun Sep 5 20:13:07 2010 New Revision: 212242 URL: http://svn.freebsd.org/changeset/base/212242 Log: Implement correct handling of address parameter and sendinfo for SCTP send calls. MFC after: 4 weeks. Modified: head/sys/kern/uipc_syscalls.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_uio.h Modified: head/sys/kern/uipc_syscalls.c == --- head/sys/kern/uipc_syscalls.c Sun Sep 5 20:04:54 2010 (r212241) +++ head/sys/kern/uipc_syscalls.c Sun Sep 5 20:13:07 2010 (r212242) @@ -2381,7 +2381,6 @@ sctp_generic_sendmsg (td, uap) struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; struct socket *so; struct file *fp = NULL; - int use_rcvinfo = 1; int error = 0, len; struct sockaddr *to = NULL; #ifdef KTRACE @@ -2434,7 +2433,7 @@ sctp_generic_sendmsg (td, uap) CURVNET_SET(so-so_vnet); error = sctp_lower_sosend(so, to, auio, (struct mbuf *)NULL, (struct mbuf *)NULL, - uap-flags, use_rcvinfo, u_sinfo, td); + uap-flags, u_sinfo, td); CURVNET_RESTORE(); if (error) { if (auio.uio_resid != len (error == ERESTART || @@ -2485,7 +2484,6 @@ sctp_generic_sendmsg_iov(td, uap) struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; struct socket *so; struct file *fp = NULL; - int use_rcvinfo = 1; int error=0, len, i; struct sockaddr *to = NULL; #ifdef KTRACE @@ -2552,7 +2550,7 @@ sctp_generic_sendmsg_iov(td, uap) CURVNET_SET(so-so_vnet); error = sctp_lower_sosend(so, to, auio, (struct mbuf *)NULL, (struct mbuf *)NULL, - uap-flags, use_rcvinfo, u_sinfo, td); + uap-flags, u_sinfo, td); CURVNET_RESTORE(); if (error) { if (auio.uio_resid != len (error == ERESTART || Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sun Sep 5 20:04:54 2010 (r212241) +++ head/sys/netinet/sctp_output.c Sun Sep 5 20:13:07 2010 (r212242) @@ -12158,7 +12158,7 @@ sctp_sosend(struct socket *so, error = sctp_lower_sosend(so, addr_to_use, uio, top, control, flags, - use_rcvinfo, srcv + use_rcvinfo ? srcv : NULL ,p ); return (error); @@ -12172,7 +12172,6 @@ sctp_lower_sosend(struct socket *so, struct mbuf *i_pak, struct mbuf *control, int flags, -int use_rcvinfo, struct sctp_sndrcvinfo *srcv , struct thread *p @@ -12200,8 +12199,10 @@ sctp_lower_sosend(struct socket *so, int got_all_of_the_send = 0; int hold_tcblock = 0; int non_blocking = 0; - int temp_flags = 0; uint32_t local_add_more, local_soresv = 0; + uint16_t port; + uint16_t sinfo_flags; + sctp_assoc_t sinfo_assoc_id; error = 0; net = NULL; @@ -12236,28 +12237,39 @@ sctp_lower_sosend(struct socket *so, SCTPDBG(SCTP_DEBUG_OUTPUT1, Send called addr:%p send length %d\n, addr, sndlen); + if ((inp-sctp_flags SCTP_PCB_FLAGS_TCPTYPE) + (inp-sctp_socket-so_qlimit)) { + /* The listener can NOT send */ + SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOTCONN); + error = ENOTCONN; + goto out_unlocked; + } /** * Pre-screen address, if one is given the sin-len * must be set correctly! */ if (addr) { - switch (addr-sa_family) { + union sctp_sockstore *raddr = (union sctp_sockstore *)addr; + + switch (raddr-sa.sa_family) { #if defined(INET) case AF_INET: - if (addr-sa_len != sizeof(struct sockaddr_in)) { + if (raddr-sin.sin_len != sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); error = EINVAL; goto out_unlocked; } + port = raddr-sin.sin_port; break; #endif #if defined(INET6) case AF_INET6: - if (addr-sa_len != sizeof(struct sockaddr_in6)) { + if (raddr-sin6.sin6_len != sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); error = EINVAL; goto out_unlocked; } + port = raddr-sin6.sin6_port; break; #endif
svn commit: r212380 - head/sys/netinet
Author: tuexen Date: Thu Sep 9 20:51:23 2010 New Revision: 212380 URL: http://svn.freebsd.org/changeset/base/212380 Log: * Remove code which has no effect. * Clean up the handling in sctp_lower_sosend(). MFC after: 3 weeks. Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Thu Sep 9 20:37:19 2010 (r212379) +++ head/sys/netinet/sctp_output.c Thu Sep 9 20:51:23 2010 (r212380) @@ -12124,7 +12124,6 @@ sctp_sosend(struct socket *so, struct thread *p ) { - struct sctp_inpcb *inp; int error, use_rcvinfo = 0; struct sctp_sndrcvinfo srcv; struct sockaddr *addr_to_use; @@ -12134,7 +12133,6 @@ sctp_sosend(struct socket *so, #endif - inp = (struct sctp_inpcb *)so-so_pcb; if (control) { /* process cmsg snd/rcv info (maybe a assoc-id) */ if (sctp_find_cmsg(SCTP_SNDRCV, (void *)srcv, control, @@ -12182,7 +12180,7 @@ sctp_lower_sosend(struct socket *so, struct mbuf *top = NULL; int queue_only = 0, queue_only_for_init = 0; int free_cnt_applied = 0; - int un_sent = 0; + int un_sent; int now_filled = 0; unsigned int inqueue_bytes = 0; struct sctp_block_entry be; @@ -12525,9 +12523,10 @@ sctp_lower_sosend(struct socket *so, * change it BEFORE we append the message. */ } - } + } else + asoc = stcb-asoc; if (srcv == NULL) - srcv = (struct sctp_sndrcvinfo *)stcb-asoc.def_send; + srcv = (struct sctp_sndrcvinfo *)asoc-def_send; if (srcv-sinfo_flags SCTP_ADDR_OVER) { if (addr) net = sctp_findnet(stcb, addr); @@ -12542,14 +12541,10 @@ sctp_lower_sosend(struct socket *so, } else { net = stcb-asoc.primary_destination; } - - if ((SCTP_SO_IS_NBIO(so) - || (flags MSG_NBIO) - )) { - non_blocking = 1; - } - asoc = stcb-asoc; atomic_add_int(stcb-total_sends, 1); + /* Keep the stcb from being freed under our feet */ + atomic_add_int(asoc-refcnt, 1); + free_cnt_applied = 1; if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NO_FRAGMENT)) { if (sndlen asoc-smallest_mtu) { @@ -12558,6 +12553,11 @@ sctp_lower_sosend(struct socket *so, goto out_unlocked; } } + if ((SCTP_SO_IS_NBIO(so) + || (flags MSG_NBIO) + )) { + non_blocking = 1; + } /* would we block? */ if (non_blocking) { if (hold_tcblock == 0) { @@ -12581,17 +12581,6 @@ sctp_lower_sosend(struct socket *so, atomic_add_int(stcb-asoc.sb_send_resv, sndlen); } local_soresv = sndlen; - /* Keep the stcb from being freed under our feet */ - if (free_cnt_applied) { -#ifdef INVARIANTS - panic(refcnt already incremented); -#else - printf(refcnt:1 already incremented?\n); -#endif - } else { - atomic_add_int(stcb-asoc.refcnt, 1); - free_cnt_applied = 1; - } if (stcb-asoc.state SCTP_STATE_ABOUT_TO_BE_FREED) { SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ECONNRESET); error = ECONNRESET; @@ -12634,26 +12623,6 @@ sctp_lower_sosend(struct socket *so, if (p) { p-td_ru.ru_msgsnd++; } - if ((net-flight_size net-cwnd) - (asoc-sctp_cmt_on_off == 0)) { - /*- -* CMT: Added check for CMT above. net above is the primary -* dest. If CMT is ON, sender should always attempt to send -* with the output routine sctp_fill_outqueue() that loops -* through all destination addresses. Therefore, if CMT is -* ON, queue_only is NOT set to 1 here, so that -* sctp_chunk_output() can be called below. -*/ - queue_only = 1; - } else if (asoc-ifp_had_enobuf) { - SCTP_STAT_INCR(sctps_ifnomemqueued); - if (net-flight_size (net-mtu * 2)) - queue_only = 1; - asoc-ifp_had_enobuf = 0; - } else { - un_sent = ((stcb-asoc.total_output_queue_size - stcb-asoc.total_flight) + - (stcb-asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); - } /* Are we aborting? */ if (srcv-sinfo_flags SCTP_ABORT) { struct mbuf *mm; @@ -12857,7 +12826,6 @@ sctp_lower_sosend(struct socket *so, } inqueue_bytes = stcb-asoc.total_output_queue_size -
svn commit: r212699 - head/sys/netinet6
Author: tuexen Date: Wed Sep 15 20:41:20 2010 New Revision: 212699 URL: http://svn.freebsd.org/changeset/base/212699 Log: Remove unused variables. MFC after: 2 weeks. Modified: head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet6/sctp6_usrreq.c == --- head/sys/netinet6/sctp6_usrreq.cWed Sep 15 20:40:29 2010 (r212698) +++ head/sys/netinet6/sctp6_usrreq.cWed Sep 15 20:41:20 2010 (r212699) @@ -73,7 +73,11 @@ sctp6_input(struct mbuf **i_pak, int *of struct sctp_nets *net; int refcount_up = 0; uint32_t vrf_id = 0; + +#ifdef IPSEC struct inpcb *in6p_ip; + +#endif struct sctp_chunkhdr *ch; int length, offset, iphlen; uint8_t ecn_bits; @@ -224,11 +228,11 @@ sctp_skip_csum: } else if (stcb == NULL) { refcount_up = 1; } - in6p_ip = (struct inpcb *)in6p; #ifdef IPSEC /* * Check AH/ESP integrity. */ + in6p_ip = (struct inpcb *)in6p; if (in6p_ip (ipsec6_in_reject(m, in6p_ip))) { /* XXX */ MODULE_GLOBAL(ipsec6stat).in_polvio++; @@ -813,7 +817,6 @@ sctp6_send(struct socket *so, int flags, struct mbuf *control, struct thread *p) { struct sctp_inpcb *inp; - struct inpcb *in_inp; struct in6pcb *inp6; #ifdef INET @@ -832,7 +835,6 @@ sctp6_send(struct socket *so, int flags, SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return EINVAL; } - in_inp = (struct inpcb *)inp; inp6 = (struct in6pcb *)inp; /* * For the TCP model we may get a NULL addr, if we are a connected ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r212702 - head/sys/netinet
Author: tuexen Date: Wed Sep 15 20:53:20 2010 New Revision: 212702 URL: http://svn.freebsd.org/changeset/base/212702 Log: * Use !TAILQ_EMPTY() for checking if a tail queue is not empty. * Remove assignment without any effect. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_cc_functions.c Modified: head/sys/netinet/sctp_cc_functions.c == --- head/sys/netinet/sctp_cc_functions.cWed Sep 15 20:50:51 2010 (r212701) +++ head/sys/netinet/sctp_cc_functions.cWed Sep 15 20:53:20 2010 (r212702) @@ -171,7 +171,7 @@ sctp_cwnd_update_after_sack(struct sctp_ * So, first of all do we need to have a Early FR * timer running? */ - if (((TAILQ_FIRST(asoc-sent_queue)) + if ((!TAILQ_EMPTY(asoc-sent_queue) (net-ref_count 1) (net-flight_size net-cwnd)) || (reneged_all)) { @@ -656,7 +656,6 @@ sctp_hs_cwnd_decrease(struct sctp_tcb *s int old_cwnd = net-cwnd; cur_val = net-cwnd 10; - indx = net-last_hs_used; if (cur_val sctp_cwnd_adjust[0].cwnd) { /* normal mode */ net-ssthresh = net-cwnd / 2; @@ -793,7 +792,7 @@ sctp_hs_cwnd_update_after_sack(struct sc * So, first of all do we need to have a Early FR * timer running? */ - if (((TAILQ_FIRST(asoc-sent_queue)) + if ((!TAILQ_EMPTY(asoc-sent_queue) (net-ref_count 1) (net-flight_size net-cwnd)) || (reneged_all)) { @@ -1279,7 +1278,7 @@ sctp_htcp_cwnd_update_after_sack(struct * So, first of all do we need to have a Early FR * timer running? */ - if (((TAILQ_FIRST(asoc-sent_queue)) + if ((!TAILQ_EMPTY(asoc-sent_queue) (net-ref_count 1) (net-flight_size net-cwnd)) || (reneged_all)) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r212704 - head/sys/netinet
Author: tuexen Date: Wed Sep 15 21:08:57 2010 New Revision: 212704 URL: http://svn.freebsd.org/changeset/base/212704 Log: Remove assignment without effect. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_sysctl.c Modified: head/sys/netinet/sctp_sysctl.c == --- head/sys/netinet/sctp_sysctl.c Wed Sep 15 20:59:13 2010 (r212703) +++ head/sys/netinet/sctp_sysctl.c Wed Sep 15 21:08:57 2010 (r212704) @@ -200,8 +200,6 @@ copy_out_local_addresses(struct sctp_inp ipv6_addr_legal = 0; } - error = 0; - /* neither Mac OS X nor FreeBSD support mulitple routing functions */ if ((vrf = sctp_find_vrf(inp-def_vrf_id)) == NULL) { SCTP_INP_RUNLOCK(inp); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r212707 - head/sys/netinet
Author: tuexen Date: Wed Sep 15 21:19:54 2010 New Revision: 212707 URL: http://svn.freebsd.org/changeset/base/212707 Log: Remove unused variable/assignment. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_bsd_addr.c Modified: head/sys/netinet/sctp_bsd_addr.c == --- head/sys/netinet/sctp_bsd_addr.cWed Sep 15 21:15:00 2010 (r212706) +++ head/sys/netinet/sctp_bsd_addr.cWed Sep 15 21:19:54 2010 (r212707) @@ -298,7 +298,6 @@ sctp_init_vrf_list(int vrfid) void sctp_addr_change(struct ifaddr *ifa, int cmd) { - struct sctp_ifa *ifap = NULL; uint32_t ifa_flags = 0; /* @@ -339,7 +338,7 @@ sctp_addr_change(struct ifaddr *ifa, int return; } if (cmd == RTM_ADD) { - ifap = sctp_add_addr_to_vrf(SCTP_DEFAULT_VRFID, (void *)ifa-ifa_ifp, + (void)sctp_add_addr_to_vrf(SCTP_DEFAULT_VRFID, (void *)ifa-ifa_ifp, ifa-ifa_ifp-if_index, ifa-ifa_ifp-if_type, ifa-ifa_ifp-if_xname, (void *)ifa, ifa-ifa_addr, ifa_flags, 1); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r212711 - head/sys/netinet
Author: tuexen Date: Wed Sep 15 21:53:10 2010 New Revision: 212711 URL: http://svn.freebsd.org/changeset/base/212711 Log: Use TAILQ_EMPTY() for testing if a tail queue is empty. Set whoFrom to NULL after freeing whoFrom. Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Wed Sep 15 21:50:37 2010 (r212710) +++ head/sys/netinet/sctp_indata.c Wed Sep 15 21:53:10 2010 (r212711) @@ -708,9 +708,10 @@ protocol_error: control-data = NULL; asoc-size_on_all_streams -= control-length; sctp_ucount_decr(asoc-cnt_on_all_streams); - if (control-whoFrom) + if (control-whoFrom) { sctp_free_remote_addr(control-whoFrom); - control-whoFrom = NULL; + control-whoFrom = NULL; + } sctp_free_a_readq(stcb, control); return; } else { @@ -4845,7 +4846,7 @@ sctp_handle_sack(struct mbuf *m, int off if (asoc-pr_sctp_cnt != 0) asoc-pr_sctp_cnt--; } - if ((TAILQ_FIRST(asoc-sent_queue) == NULL) + if (TAILQ_EMPTY(asoc-sent_queue) (asoc-total_flight 0)) { #ifdef INVARIANTS panic(Warning flight size is postive and should be 0); @@ -5818,7 +5819,7 @@ sctp_handle_forward_tsn(struct sctp_tcb */ sctp_slide_mapping_arrays(stcb); - if (TAILQ_FIRST(asoc-reasmqueue)) { + if (!TAILQ_EMPTY(asoc-reasmqueue)) { /* now lets kick out and check for more fragmented delivery */ /* sa_ignore NO_NULL_CHK */ sctp_deliver_reasm_check(stcb, stcb-asoc); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r212712 - head/sys/netinet
Author: tuexen Date: Wed Sep 15 23:10:45 2010 New Revision: 212712 URL: http://svn.freebsd.org/changeset/base/212712 Log: Delay the assignment of a path for DATA chunk until they hit the sent_queue. Honor a given path when the SCTP_ADDR_OVER flag is set. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_asconf.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Wed Sep 15 21:53:10 2010 (r212711) +++ head/sys/netinet/sctp_asconf.c Wed Sep 15 23:10:45 2010 (r212712) @@ -581,8 +581,8 @@ sctp_process_asconf_set_primary(struct m } if (sctp_is_mobility_feature_on(stcb-sctp_ep, SCTP_MOBILITY_BASE)) { - sctp_move_chunks_from_deleted_prim(stcb, - stcb-asoc.primary_destination); + sctp_move_chunks_from_net(stcb, + stcb-asoc.deleted_primary); } sctp_delete_prim_timer(stcb-sctp_ep, stcb, stcb-asoc.deleted_primary); @@ -1041,47 +1041,6 @@ sctp_asconf_nets_cleanup(struct sctp_tcb } } -void -sctp_move_chunks_from_deleted_prim(struct sctp_tcb *stcb, struct sctp_nets *dst) -{ - struct sctp_association *asoc; - struct sctp_stream_out *outs; - struct sctp_tmit_chunk *chk; - struct sctp_stream_queue_pending *sp; - - if (dst-dest_state SCTP_ADDR_UNCONFIRMED) { - return; - } - if (stcb-asoc.deleted_primary == NULL) { - return; - } - asoc = stcb-asoc; - - /* -* now through all the streams checking for chunks sent to our bad -* network. -*/ - TAILQ_FOREACH(outs, asoc-out_wheel, next_spoke) { - /* now clean up any chunks here */ - TAILQ_FOREACH(sp, outs-outqueue, next) { - if (sp-net == asoc-deleted_primary) { - sctp_free_remote_addr(sp-net); - sp-net = dst; - atomic_add_int(dst-ref_count, 1); - } - } - } - /* Now check the pending queue */ - TAILQ_FOREACH(chk, asoc-send_queue, sctp_next) { - if (chk-whoTo == asoc-deleted_primary) { - sctp_free_remote_addr(chk-whoTo); - chk-whoTo = dst; - atomic_add_int(dst-ref_count, 1); - } - } - -} - void sctp_assoc_immediate_retrans(struct sctp_tcb *stcb, struct sctp_nets *dstnet) @@ -2080,13 +2039,11 @@ sctp_asconf_iterator_ep(struct sctp_inpc struct sctp_asconf_iterator *asc; struct sctp_ifa *ifa; struct sctp_laddr *l; - int type; int cnt_invalid = 0; asc = (struct sctp_asconf_iterator *)ptr; LIST_FOREACH(l, asc-list_of_work, sctp_nxt_addr) { ifa = l-ifa; - type = l-action; if (ifa-address.sa.sa_family == AF_INET6) { /* invalid if we're not a v6 endpoint */ if ((inp-sctp_flags SCTP_PCB_FLAGS_BOUND_V6) == 0) { Modified: head/sys/netinet/sctp_asconf.h == --- head/sys/netinet/sctp_asconf.h Wed Sep 15 21:53:10 2010 (r212711) +++ head/sys/netinet/sctp_asconf.h Wed Sep 15 23:10:45 2010 (r212712) @@ -80,8 +80,6 @@ sctp_check_address_list(struct sctp_tcb struct sockaddr *, uint16_t, uint16_t, uint16_t, uint16_t); extern void - sctp_move_chunks_from_deleted_prim(struct sctp_tcb *, struct sctp_nets *); -extern void sctp_assoc_immediate_retrans(struct sctp_tcb *, struct sctp_nets *); extern void sctp_net_immediate_retrans(struct sctp_tcb *, struct sctp_nets *); Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Wed Sep 15 21:53:10 2010 (r212711) +++ head/sys/netinet/sctp_input.c Wed Sep 15 23:10:45 2010 (r212712) @@ -232,7 +232,10 @@ sctp_is_there_unsent_data(struct sctp_tc } atomic_subtract_int(stcb-asoc.stream_queue_cnt, 1); TAILQ_REMOVE(strq-outqueue, sp, next); - sctp_free_remote_addr(sp-net); + if (sp-net) { + sctp_free_remote_addr(sp-net); +
svn commit: r212713 - head/sys/netinet
Author: tuexen Date: Wed Sep 15 23:40:36 2010 New Revision: 212713 URL: http://svn.freebsd.org/changeset/base/212713 Log: Remove unused variable/assignment. MFC after: 3 weeks. Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Wed Sep 15 23:10:45 2010(r212712) +++ head/sys/netinet/sctputil.c Wed Sep 15 23:40:36 2010(r212713) @@ -5135,7 +5135,7 @@ sctp_sorecvmsg(struct socket *so, int my_len = 0; int cp_len = 0, error = 0; struct sctp_queued_to_read *control = NULL, *ctl = NULL, *nxt = NULL; - struct mbuf *m = NULL, *embuf = NULL; + struct mbuf *m = NULL; struct sctp_tcb *stcb = NULL; int wakeup_read_socket = 0; int freecnt_applied = 0; @@ -5731,7 +5731,6 @@ get_more_data: sctp_sblog(so-so_rcv, control-do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBRESULT, 0); } - embuf = m; copied_so_far += cp_len; freed_so_far += cp_len; freed_so_far += MSIZE; @@ -5783,7 +5782,6 @@ get_more_data: atomic_subtract_int(stcb-asoc.sb_cc, cp_len); } copied_so_far += cp_len; - embuf = m; freed_so_far += cp_len; freed_so_far += MSIZE; if (SCTP_BASE_SYSCTL(sctp_logging_level) SCTP_SB_LOGGING_ENABLE) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r212714 - head/sys/netinet
Author: tuexen Date: Wed Sep 15 23:56:25 2010 New Revision: 212714 URL: http://svn.freebsd.org/changeset/base/212714 Log: Remove old debug code. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Wed Sep 15 23:40:36 2010 (r212713) +++ head/sys/netinet/sctp_output.c Wed Sep 15 23:56:25 2010 (r212714) @@ -3803,9 +3803,6 @@ sctp_lowlevel_chunk_output(struct sctp_i mtu -= sizeof(struct udphdr); } if (mtu (stcb-asoc.smallest_mtu mtu)) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF(sctp_mtu_size_reset called after ip_output mtu-change:%d\n, mtu); -#endif sctp_mtu_size_reset(inp, stcb-asoc, mtu); net-mtu = mtu; } @@ -4134,10 +4131,6 @@ sctp_lowlevel_chunk_output(struct sctp_i mtu = SCTP_GATHER_MTU_FROM_ROUTE(net-ro._s_addr, net-ro._l_addr.sa, ro-ro_rt); if (mtu (stcb-asoc.smallest_mtu mtu)) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF(sctp_mtu_size_reset called after ip6_output mtu-change:%d\n, - mtu); -#endif sctp_mtu_size_reset(inp, stcb-asoc, mtu); net-mtu = mtu; if (net-port) { @@ -4147,10 +4140,6 @@ sctp_lowlevel_chunk_output(struct sctp_i } else if (ifp) { if (ND_IFINFO(ifp)-linkmtu (stcb-asoc.smallest_mtu ND_IFINFO(ifp)-linkmtu)) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF(sctp_mtu_size_reset called via ifp ND_IFINFO() linkmtu:%d\n, - ND_IFINFO(ifp)-linkmtu); -#endif sctp_mtu_size_reset(inp, stcb-asoc, ND_IFINFO(ifp)-linkmtu); Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Wed Sep 15 23:40:36 2010(r212713) +++ head/sys/netinet/sctp_pcb.c Wed Sep 15 23:56:25 2010(r212714) @@ -3916,9 +3916,6 @@ sctp_add_remote_addr(struct sctp_tcb *st } else { net-mtu = 0; } -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF(We have found an interface mtu of %d\n, net-mtu); -#endif if (net-mtu == 0) { /* Huh ?? */ net-mtu = SCTP_DEFAULT_MTU; @@ -3926,9 +3923,6 @@ sctp_add_remote_addr(struct sctp_tcb *st uint32_t rmtu; rmtu = SCTP_GATHER_MTU_FROM_ROUTE(net-ro._s_addr, net-ro._l_addr.sa, net-ro.ro_rt); -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF(The route mtu is %d\n, rmtu); -#endif if (rmtu == 0) { /* * Start things off to match mtu of @@ -3946,9 +3940,6 @@ sctp_add_remote_addr(struct sctp_tcb *st } } if (from == SCTP_ALLOC_ASOC) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF(New assoc sets mtu to :%d\n, net-mtu); -#endif stcb-asoc.smallest_mtu = net-mtu; } } else { @@ -3966,10 +3957,6 @@ sctp_add_remote_addr(struct sctp_tcb *st net-mtu -= sizeof(struct udphdr); } if (stcb-asoc.smallest_mtu net-mtu) { -#ifdef SCTP_PRINT_FOR_B_AND_M - SCTP_PRINTF(new address mtu:%d smaller than smallest:%d\n, - net-mtu, stcb-asoc.smallest_mtu); -#endif stcb-asoc.smallest_mtu = net-mtu; } /* JRS - Use the congestion control given in the CC module */ Modified: head/sys/netinet/sctp_usrreq.c == --- head/sys/netinet/sctp_usrreq.c Wed Sep 15 23:40:36 2010 (r212713) +++ head/sys/netinet/sctp_usrreq.c Wed Sep 15 23:56:25 2010 (r212714) @@ -111,10 +111,6 @@ sctp_pathmtu_adjustment(struct sctp_inpc /* Adjust that too */ stcb-asoc.smallest_mtu = nxtsz; /* now off to subtract IP_DF flag if needed */ -#ifdef SCTP_PRINT_FOR_B_AND_M -
svn commit: r212799 - head/sys/netinet
Author: tuexen Date: Fri Sep 17 16:20:29 2010 New Revision: 212799 URL: http://svn.freebsd.org/changeset/base/212799 Log: * Implement initial version of send buffer splitting. * Make send/recv buffer splitting switchable via sysctl. * While there: Fix some comments. Modified: head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h Modified: head/sys/netinet/sctp_constants.h == --- head/sys/netinet/sctp_constants.h Fri Sep 17 16:05:25 2010 (r212798) +++ head/sys/netinet/sctp_constants.h Fri Sep 17 16:20:29 2010 (r212799) @@ -948,6 +948,9 @@ __FBSDID($FreeBSD$); */ #define SCTP_TIME_WAIT 60 +#define SCTP_SEND_BUFFER_SPLITTING 0x0001 +#define SCTP_RECV_BUFFER_SPLITTING 0x0002 + /* The system retains a cache of free chunks such to * cut down on calls the memory allocation system. There * is a per association limit of free items and a overall Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Fri Sep 17 16:05:25 2010 (r212798) +++ head/sys/netinet/sctp_output.c Fri Sep 17 16:20:29 2010 (r212799) @@ -7407,7 +7407,7 @@ sctp_med_chunk_output(struct sctp_inpcb /* temp arrays for unlinking */ struct sctp_tmit_chunk *data_list[SCTP_MAX_DATA_BUNDLING]; int no_fragmentflg, error; - unsigned int max_rwnd_per_dest; + unsigned int max_rwnd_per_dest, max_send_per_dest; int one_chunk, hbflag, skip_data_for_this_net; int asconf, cookie, no_out_cnt; int bundle_at, ctl_cnt, no_data_chunks, eeor_mode; @@ -7469,6 +7469,10 @@ sctp_med_chunk_output(struct sctp_inpcb } } max_rwnd_per_dest = ((asoc-peers_rwnd + asoc-total_flight) / asoc-numnets); + if (stcb-sctp_socket) + max_send_per_dest = SCTP_SB_LIMIT_SND(stcb-sctp_socket) / asoc-numnets; + else + max_send_per_dest = 0; if ((no_data_chunks == 0) (!TAILQ_EMPTY(asoc-out_wheel))) { TAILQ_FOREACH(net, asoc-nets, sctp_next) { /* @@ -8039,9 +8043,22 @@ again_one_more_time: goto no_data_fill; } if ((asoc-sctp_cmt_on_off == 1) + (SCTP_BASE_SYSCTL(sctp_buffer_splitting) SCTP_RECV_BUFFER_SPLITTING) (net-flight_size max_rwnd_per_dest)) { goto no_data_fill; } + /* +* We need a specific accounting for the usage of the send +* buffer. We also need to check the number of messages per +* net. For now, this is better than nothing and it disabled +* by default... +*/ + if ((asoc-sctp_cmt_on_off == 1) + (SCTP_BASE_SYSCTL(sctp_buffer_splitting) SCTP_SEND_BUFFER_SPLITTING) + (max_send_per_dest 0) + (net-flight_size max_send_per_dest)) { + goto no_data_fill; + } /*/ /* Data transmission */ /*/ Modified: head/sys/netinet/sctp_sysctl.c == --- head/sys/netinet/sctp_sysctl.c Fri Sep 17 16:05:25 2010 (r212798) +++ head/sys/netinet/sctp_sysctl.c Fri Sep 17 16:20:29 2010 (r212799) @@ -109,6 +109,7 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_mobility_base) = SCTPCTL_MOBILITY_BASE_DEFAULT; SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff) = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT; SCTP_BASE_SYSCTL(sctp_vtag_time_wait) = SCTPCTL_TIME_WAIT_DEFAULT; + SCTP_BASE_SYSCTL(sctp_buffer_splitting) = SCTPCTL_BUFFER_SPLITTING_DEFAULT; #if defined(SCTP_LOCAL_TRACE_BUF) memset(SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); #endif @@ -620,7 +621,7 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) RANGECHK(SCTP_BASE_SYSCTL(sctp_default_cc_module), SCTPCTL_DEFAULT_CC_MODULE_MIN, SCTPCTL_DEFAULT_CC_MODULE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_default_frag_interleave), SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_vtag_time_wait), SCTPCTL_TIME_WAIT_MIN, SCTPCTL_TIME_WAIT_MAX); - + RANGECHK(SCTP_BASE_SYSCTL(sctp_buffer_splitting), SCTPCTL_BUFFER_SPLITTING_MIN, SCTPCTL_BUFFER_SPLITTING_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_base), SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), SCTPCTL_MOBILITY_FASTHANDOFF_MIN,
svn commit: r212800 - head/sys/netinet
Author: tuexen Date: Fri Sep 17 18:53:07 2010 New Revision: 212800 URL: http://svn.freebsd.org/changeset/base/212800 Log: Make the initial congestion window configurable via sysctl. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_cc_functions.c head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h Modified: head/sys/netinet/sctp_cc_functions.c == --- head/sys/netinet/sctp_cc_functions.cFri Sep 17 16:20:29 2010 (r212799) +++ head/sys/netinet/sctp_cc_functions.cFri Sep 17 18:53:07 2010 (r212800) @@ -44,18 +44,27 @@ #include netinet/sctp_cc_functions.h #include sys/cdefs.h __FBSDID($FreeBSD$); + void sctp_set_initial_cc_param(struct sctp_tcb *stcb, struct sctp_nets *net) { + struct sctp_association *assoc; + uint32_t cwnd_in_mtu; + + assoc = stcb-asoc; /* -* We take the max of the burst limit times a MTU or the -* INITIAL_CWND. We then limit this to 4 MTU's of sending. cwnd must -* be at least 2 MTU. +* We take the minimum of the burst limit and the initial congestion +* window. The initial congestion window is at least two times the +* MTU. */ - net-cwnd = min((net-mtu * 4), max((2 * net-mtu), SCTP_INITIAL_CWND)); - net-ssthresh = stcb-asoc.peers_rwnd; + cwnd_in_mtu = SCTP_BASE_SYSCTL(sctp_initial_cwnd); + if ((assoc-max_burst 0) (cwnd_in_mtu assoc-max_burst)) + cwnd_in_mtu = assoc-max_burst; + net-cwnd = (net-mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; + net-ssthresh = assoc-peers_rwnd; - if (SCTP_BASE_SYSCTL(sctp_logging_level) (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) + (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION); } } Modified: head/sys/netinet/sctp_sysctl.c == --- head/sys/netinet/sctp_sysctl.c Fri Sep 17 16:20:29 2010 (r212799) +++ head/sys/netinet/sctp_sysctl.c Fri Sep 17 18:53:07 2010 (r212800) @@ -110,6 +110,7 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff) = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT; SCTP_BASE_SYSCTL(sctp_vtag_time_wait) = SCTPCTL_TIME_WAIT_DEFAULT; SCTP_BASE_SYSCTL(sctp_buffer_splitting) = SCTPCTL_BUFFER_SPLITTING_DEFAULT; + SCTP_BASE_SYSCTL(sctp_initial_cwnd) = SCTPCTL_INITIAL_CWND_DEFAULT; #if defined(SCTP_LOCAL_TRACE_BUF) memset(SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); #endif @@ -622,6 +623,7 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) RANGECHK(SCTP_BASE_SYSCTL(sctp_default_frag_interleave), SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_vtag_time_wait), SCTPCTL_TIME_WAIT_MIN, SCTPCTL_TIME_WAIT_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_buffer_splitting), SCTPCTL_BUFFER_SPLITTING_MIN, SCTPCTL_BUFFER_SPLITTING_MAX); + RANGECHK(SCTP_BASE_SYSCTL(sctp_initial_cwnd), SCTPCTL_INITIAL_CWND_MIN, SCTPCTL_INITIAL_CWND_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_base), SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff), SCTPCTL_MOBILITY_FASTHANDOFF_MIN, SCTPCTL_MOBILITY_FASTHANDOFF_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_udp_tunneling_for_client_enable), SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MIN, SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MAX); @@ -1072,6 +1074,10 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, bu SCTP_BASE_SYSCTL(sctp_buffer_splitting), 0, sysctl_sctp_check, IU, SCTPCTL_BUFFER_SPLITTING_DESC); +SYSCTL_PROC(_net_inet_sctp, OID_AUTO, initial_cwnd, CTLTYPE_INT | CTLFLAG_RW, +SCTP_BASE_SYSCTL(sctp_initial_cwnd), 0, sysctl_sctp_check, IU, +SCTPCTL_INITIAL_CWND_DESC); + #ifdef SCTP_DEBUG SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW, SCTP_BASE_SYSCTL(sctp_debug_on), 0, sysctl_sctp_check, IU, Modified: head/sys/netinet/sctp_sysctl.h == --- head/sys/netinet/sctp_sysctl.h Fri Sep 17 16:20:29 2010 (r212799) +++ head/sys/netinet/sctp_sysctl.h Fri Sep 17 18:53:07 2010 (r212800) @@ -108,6 +108,7 @@ struct sctp_sysctl { uint32_t sctp_enable_sack_immediately; uint32_t sctp_vtag_time_wait; uint32_t sctp_buffer_splitting; + uint32_t sctp_initial_cwnd; #if defined(SCTP_DEBUG) uint32_t sctp_debug_on; #endif @@ -497,6 +498,12 @@ struct sctp_sysctl { #define SCTPCTL_BUFFER_SPLITTING_MAX 0x3 #define SCTPCTL_BUFFER_SPLITTING_DEFAULT
svn commit: r212850 - head/sys/netinet
Author: tuexen Date: Sun Sep 19 11:42:16 2010 New Revision: 212850 URL: http://svn.freebsd.org/changeset/base/212850 Log: Fix a locking issue which shows up when the code is used on Mac OS X. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_auth.c == --- head/sys/netinet/sctp_auth.cSun Sep 19 11:22:22 2010 (r212849) +++ head/sys/netinet/sctp_auth.cSun Sep 19 11:42:16 2010 (r212850) @@ -614,7 +614,7 @@ sctp_auth_key_release(struct sctp_tcb *s if ((skey-refcount = 1) (skey-deactivated)) { /* notify ULP that key is no longer used */ sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, - key_id, 0, SCTP_SO_NOT_LOCKED); + key_id, 0, SCTP_SO_LOCKED); SCTPDBG(SCTP_DEBUG_AUTH2, %s: stcb %p key %u no longer used, %d\n, __FUNCTION__, stcb, key_id, skey-refcount); Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Sun Sep 19 11:22:22 2010(r212849) +++ head/sys/netinet/sctp_pcb.c Sun Sep 19 11:42:16 2010(r212850) @@ -4822,7 +4822,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, /* Still an open socket - report */ sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb, SCTP_NOTIFY_DATAGRAM_UNSENT, - (void *)sp, 0); + (void *)sp, SCTP_SO_LOCKED); } if (sp-data) { sctp_m_freem(sp-data); @@ -4894,7 +4894,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, if (so) { /* Still a socket? */ sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_UNSENT, chk, 0); + SCTP_NOTIFY_DATAGRAM_UNSENT, chk, SCTP_SO_LOCKED); } if (chk-data) { sctp_m_freem(chk-data); @@ -4929,7 +4929,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, if (so) { /* Still a socket? */ sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, - SCTP_NOTIFY_DATAGRAM_SENT, chk, 0); + SCTP_NOTIFY_DATAGRAM_SENT, chk, SCTP_SO_LOCKED); } if (chk-data) { sctp_m_freem(chk-data); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r212851 - head/sys/netinet
Author: tuexen Date: Sun Sep 19 11:57:21 2010 New Revision: 212851 URL: http://svn.freebsd.org/changeset/base/212851 Log: Allow the initial congestion window to be configure to one MTU. Improve the description. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_sysctl.h Modified: head/sys/netinet/sctp_sysctl.h == --- head/sys/netinet/sctp_sysctl.h Sun Sep 19 11:42:16 2010 (r212850) +++ head/sys/netinet/sctp_sysctl.h Sun Sep 19 11:57:21 2010 (r212851) @@ -499,8 +499,8 @@ struct sctp_sysctl { #define SCTPCTL_BUFFER_SPLITTING_DEFAULT SCTPCTL_BUFFER_SPLITTING_MIN /* Initial congestion window in MTU */ -#define SCTPCTL_INITIAL_CWND_DESC Initial congestion window in MTU -#define SCTPCTL_INITIAL_CWND_MIN 2 +#define SCTPCTL_INITIAL_CWND_DESC Initial congestion window in MTUs +#define SCTPCTL_INITIAL_CWND_MIN 1 #define SCTPCTL_INITIAL_CWND_MAX 0x #define SCTPCTL_INITIAL_CWND_DEFAULT 3 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r212897 - head/sys/netinet
Author: tuexen Date: Mon Sep 20 12:19:11 2010 New Revision: 212897 URL: http://svn.freebsd.org/changeset/base/212897 Log: Fix a locking issue which resulted in aborted associations due to a corrupted nr-mapping array. MFC after: 2 weeks. Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Mon Sep 20 11:53:57 2010 (r212896) +++ head/sys/netinet/sctp_indata.c Mon Sep 20 12:19:11 2010 (r212897) @@ -1776,6 +1776,10 @@ sctp_process_a_data_chunk(struct sctp_tc if (control == NULL) { goto failed_express_del; } + SCTP_SET_TSN_PRESENT(asoc-nr_mapping_array, gap); + if (compare_with_wrap(tsn, asoc-highest_tsn_inside_nr_map, MAX_TSN)) { + asoc-highest_tsn_inside_nr_map = tsn; + } sctp_add_to_readq(stcb-sctp_ep, stcb, control, stcb-sctp_socket-so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); @@ -1791,10 +1795,6 @@ sctp_process_a_data_chunk(struct sctp_tc } control = NULL; - SCTP_SET_TSN_PRESENT(asoc-nr_mapping_array, gap); - if (compare_with_wrap(tsn, asoc-highest_tsn_inside_nr_map, MAX_TSN)) { - asoc-highest_tsn_inside_nr_map = tsn; - } goto finish_express_del; } failed_express_del: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r236332 - in head/sys: net netinet netinet6 sys
Author: tuexen Date: Wed May 30 20:56:07 2012 New Revision: 236332 URL: http://svn.freebsd.org/changeset/base/236332 Log: Seperate SCTP checksum offloading for IPv4 and IPv6. While there: remove some trainling whitespaces. MFC after: 3 days X-MFC with: 236170 Modified: head/sys/net/if_loop.c head/sys/netinet/sctp_output.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_output.c head/sys/sys/mbuf.h Modified: head/sys/net/if_loop.c == --- head/sys/net/if_loop.c Wed May 30 20:49:28 2012(r236331) +++ head/sys/net/if_loop.c Wed May 30 20:56:07 2012(r236332) @@ -92,7 +92,7 @@ #endif #defineLO_CSUM_FEATURES(CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_SCTP) -#defineLO_CSUM_FEATURES6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_SCTP) +#defineLO_CSUM_FEATURES6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_SCTP_IPV6) #defineLO_CSUM_SET (CSUM_DATA_VALID | CSUM_DATA_VALID_IPV6 | \ CSUM_PSEUDO_HDR | \ CSUM_IP_CHECKED | CSUM_IP_VALID | \ Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Wed May 30 20:49:28 2012 (r236331) +++ head/sys/netinet/sctp_output.c Wed May 30 20:56:07 2012 (r236332) @@ -4478,7 +4478,7 @@ sctp_lowlevel_chunk_output(struct sctp_i #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - m-m_pkthdr.csum_flags = CSUM_SCTP; + m-m_pkthdr.csum_flags = CSUM_SCTP_IPV6; m-m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif @@ -11072,7 +11072,7 @@ sctp_send_shutdown_complete2(struct mbuf #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - mout-m_pkthdr.csum_flags = CSUM_SCTP; + mout-m_pkthdr.csum_flags = CSUM_SCTP_IPV6; mout-m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif @@ -12179,7 +12179,7 @@ sctp_send_abort(struct mbuf *m, int iphl #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - mout-m_pkthdr.csum_flags = CSUM_SCTP; + mout-m_pkthdr.csum_flags = CSUM_SCTP_IPV6; mout-m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif @@ -12443,7 +12443,7 @@ sctp_send_operr_to(struct mbuf *m, int i #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - mout-m_pkthdr.csum_flags = CSUM_SCTP; + mout-m_pkthdr.csum_flags = CSUM_SCTP_IPV6; mout-m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif Modified: head/sys/netinet6/ip6_forward.c == --- head/sys/netinet6/ip6_forward.c Wed May 30 20:49:28 2012 (r236331) +++ head/sys/netinet6/ip6_forward.c Wed May 30 20:56:07 2012 (r236332) @@ -587,7 +587,7 @@ skip_routing: m-m_pkthdr.csum_data = 0x; } #ifdef SCTP - if (m-m_pkthdr.csum_flags CSUM_SCTP) + if (m-m_pkthdr.csum_flags CSUM_SCTP_IPV6) m-m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif error = netisr_queue(NETISR_IPV6, m); @@ -607,9 +607,9 @@ skip_routing: m-m_pkthdr.csum_data = 0x; } #ifdef SCTP - if (m-m_pkthdr.csum_flags CSUM_SCTP) - m-m_pkthdr.csum_flags |= CSUM_SCTP_VALID; -#endif + if (m-m_pkthdr.csum_flags CSUM_SCTP_IPV6) + m-m_pkthdr.csum_flags |= CSUM_SCTP_VALID; +#endif error = netisr_queue(NETISR_IPV6, m); goto out; } Modified: head/sys/netinet6/ip6_output.c == --- head/sys/netinet6/ip6_output.c Wed May 30 20:49:28 2012 (r236331) +++ head/sys/netinet6/ip6_output.c Wed May 30 20:56:07 2012 (r236332) @@ -508,7 +508,7 @@ skip_ipsec2:; #ifdef FLOWTABLE if (ro == ip6route) { struct flentry *fle; - + /* * The flow table returns route entries valid for up to 30 * seconds; we rely on the remainder of ip_output() taking no @@ -521,7 +521,7 @@ skip_ipsec2:; flevalid = 1; }
svn commit: r236391 - head/sys/netinet
Author: tuexen Date: Fri Jun 1 08:26:50 2012 New Revision: 236391 URL: http://svn.freebsd.org/changeset/base/236391 Log: Small cleanups. No functional change. MFC after: 3 days Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Fri Jun 1 07:07:36 2012 (r236390) +++ head/sys/netinet/sctp_asconf.c Fri Jun 1 08:26:50 2012 (r236391) @@ -48,8 +48,6 @@ __FBSDID($FreeBSD$); * SCTP_DEBUG_ASCONF1: protocol info, general info and errors * SCTP_DEBUG_ASCONF2: detailed info */ -#ifdef SCTP_DEBUG -#endif /* SCTP_DEBUG */ static void Modified: head/sys/netinet/sctputil.h == --- head/sys/netinet/sctputil.h Fri Jun 1 07:07:36 2012(r236390) +++ head/sys/netinet/sctputil.h Fri Jun 1 08:26:50 2012(r236391) @@ -381,7 +381,5 @@ sctp_auditing(int, struct sctp_inpcb *, void sctp_audit_log(uint8_t, uint8_t); #endif - - #endif /* _KERNEL */ #endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r236450 - head/sys/netinet
Author: tuexen Date: Sat Jun 2 13:13:38 2012 New Revision: 236450 URL: http://svn.freebsd.org/changeset/base/236450 Log: Remove an unused parameter. MFC after: 3 days Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sat Jun 2 13:04:50 2012 (r236449) +++ head/sys/netinet/sctp_input.c Sat Jun 2 13:13:38 2012 (r236450) @@ -4516,7 +4516,7 @@ __attribute__((noinline)) } if (stcb == NULL) { /* no association, so it's out of the blue... */ - sctp_handle_ootb(m, iphlen, *offset, sh, inp, NULL, + sctp_handle_ootb(m, iphlen, *offset, sh, inp, vrf_id, port); *offset = length; if (locked_tcb) { @@ -4554,7 +4554,7 @@ __attribute__((noinline)) SCTP_TCB_UNLOCK(locked_tcb); } sctp_handle_ootb(m, iphlen, *offset, sh, inp, - NULL, vrf_id, port); + vrf_id, port); return (NULL); } } else { @@ -5586,7 +5586,7 @@ sctp_common_input_processing(struct mbuf * NOT respond to any packet.. its OOTB. */ SCTP_TCB_UNLOCK(stcb); - sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL, + sctp_handle_ootb(m, iphlen, offset, sh, inp, vrf_id, port); goto out_now; } @@ -5630,7 +5630,7 @@ sctp_common_input_processing(struct mbuf } if (stcb == NULL) { /* out of the blue DATA chunk */ - sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL, + sctp_handle_ootb(m, iphlen, offset, sh, inp, vrf_id, port); goto out_now; } @@ -5699,7 +5699,7 @@ sctp_common_input_processing(struct mbuf /* * We consider OOTB any data sent during asoc setup. */ - sctp_handle_ootb(m, iphlen, offset, sh, inp, NULL, + sctp_handle_ootb(m, iphlen, offset, sh, inp, vrf_id, port); SCTP_TCB_UNLOCK(stcb); goto out_now; Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Sat Jun 2 13:04:50 2012(r236449) +++ head/sys/netinet/sctputil.c Sat Jun 2 13:13:38 2012(r236450) @@ -3994,7 +3994,7 @@ sctp_abort_an_association(struct sctp_in void sctp_handle_ootb(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, -struct sctp_inpcb *inp, struct mbuf *op_err, uint32_t vrf_id, uint16_t port) +struct sctp_inpcb *inp, uint32_t vrf_id, uint16_t port) { struct sctp_chunkhdr *ch, chunk_buf; unsigned int chk_length; @@ -4049,7 +4049,7 @@ sctp_handle_ootb(struct mbuf *m, int iph if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) (contains_init_chunk == 0))) { - sctp_send_abort(m, iphlen, sh, 0, op_err, vrf_id, port); + sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); } } Modified: head/sys/netinet/sctputil.h == --- head/sys/netinet/sctputil.h Sat Jun 2 13:04:50 2012(r236449) +++ head/sys/netinet/sctputil.h Sat Jun 2 13:13:38 2012(r236450) @@ -200,7 +200,7 @@ sctp_abort_an_association(struct sctp_in void sctp_handle_ootb(struct mbuf *, int, int, struct sctphdr *, -struct sctp_inpcb *, struct mbuf *, uint32_t, uint16_t); +struct sctp_inpcb *, uint32_t, uint16_t); int sctp_connectx_helper_add(struct sctp_tcb *stcb, struct sockaddr *addr, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r236493 - head/sys/netinet
Author: tuexen Date: Sat Jun 2 21:22:26 2012 New Revision: 236493 URL: http://svn.freebsd.org/changeset/base/236493 Log: Honor sysctl for TTL. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sat Jun 2 20:53:23 2012 (r236492) +++ head/sys/netinet/sctp_output.c Sat Jun 2 21:22:26 2012 (r236493) @@ -10923,7 +10923,7 @@ sctp_send_shutdown_complete2(struct mbuf iph_out-ip_tos = (u_char)0; iph_out-ip_id = 0; iph_out-ip_off = 0; - iph_out-ip_ttl = MAXTTL; + iph_out-ip_ttl = MODULE_GLOBAL(ip_defttl); if (port) { iph_out-ip_p = IPPROTO_UDP; } else { @@ -11992,7 +11992,7 @@ sctp_send_abort(struct mbuf *m, int iphl iph_out-ip_tos = (u_char)0; iph_out-ip_id = 0; iph_out-ip_off = 0; - iph_out-ip_ttl = MAXTTL; + iph_out-ip_ttl = MODULE_GLOBAL(ip_defttl); if (port) { iph_out-ip_p = IPPROTO_UDP; } else { @@ -12255,7 +12255,7 @@ sctp_send_operr_to(struct mbuf *m, int i iph_out-ip_tos = (u_char)0; iph_out-ip_id = 0; iph_out-ip_off = 0; - iph_out-ip_ttl = MAXTTL; + iph_out-ip_ttl = MODULE_GLOBAL(ip_defttl); if (port) { iph_out-ip_p = IPPROTO_UDP; } else { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r236515 - head/sys/netinet
Author: tuexen Date: Sun Jun 3 14:54:50 2012 New Revision: 236515 URL: http://svn.freebsd.org/changeset/base/236515 Log: Use an existing function to get the source address. MFC after: 3 days Modified: head/sys/netinet/sctp_asconf.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Sun Jun 3 12:19:16 2012 (r236514) +++ head/sys/netinet/sctp_asconf.c Sun Jun 3 14:54:50 2012 (r236515) @@ -856,70 +856,20 @@ send_reply: * this could happen if the source address was just newly * added */ - struct ip *iph; - struct sctphdr *sh; - struct sockaddr_storage from_store; - struct sockaddr *from = (struct sockaddr *)from_store; + struct sockaddr_storage addr; + struct sockaddr *src = (struct sockaddr *)addr; SCTPDBG(SCTP_DEBUG_ASCONF1, handle_asconf: looking up net for IP source address\n); - /* pullup already done, IP options already stripped */ - iph = mtod(m, struct ip *); - switch (iph-ip_v) { -#ifdef INET - case IPVERSION: - { - struct sockaddr_in *from4; - - sh = (struct sctphdr *)((caddr_t)iph + sizeof(*iph)); - from4 = (struct sockaddr_in *)from_store; - bzero(from4, sizeof(*from4)); - from4-sin_family = AF_INET; - from4-sin_len = sizeof(struct sockaddr_in); - from4-sin_addr.s_addr = iph-ip_src.s_addr; - from4-sin_port = sh-src_port; - break; - } -#endif -#ifdef INET6 - case IPV6_VERSION 4: - { - struct ip6_hdr *ip6; - struct sockaddr_in6 *from6; - - ip6 = mtod(m, struct ip6_hdr *); - sh = (struct sctphdr *)((caddr_t)ip6 + sizeof(*ip6)); - from6 = (struct sockaddr_in6 *)from_store; - bzero(from6, sizeof(*from6)); - from6-sin6_family = AF_INET6; - from6-sin6_len = sizeof(struct sockaddr_in6); - from6-sin6_addr = ip6-ip6_src; - from6-sin6_port = sh-src_port; - /* -* Get the scopes in properly to the sin6 -* addr's -*/ - /* we probably don't need these operations */ - (void)sa6_recoverscope(from6); - sa6_embedscope(from6, - MODULE_GLOBAL(ip6_use_defzone)); - - break; - } -#endif - default: - /* unknown address type */ - from = NULL; - } - if (from != NULL) { - SCTPDBG(SCTP_DEBUG_ASCONF1, Looking for IP source: ); - SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, from); - /* look up the from address */ - stcb-asoc.last_control_chunk_from = sctp_findnet(stcb, from); + sctp_asconf_get_source_ip(m, src); + SCTPDBG(SCTP_DEBUG_ASCONF1, Looking for IP source: ); + SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, src); + /* look up the from address */ + stcb-asoc.last_control_chunk_from = sctp_findnet(stcb, src); #ifdef SCTP_DEBUG - if (stcb-asoc.last_control_chunk_from == NULL) - SCTPDBG(SCTP_DEBUG_ASCONF1, handle_asconf: IP source address not found?!\n); -#endif + if (stcb-asoc.last_control_chunk_from == NULL) { + SCTPDBG(SCTP_DEBUG_ASCONF1, handle_asconf: IP source address not found?!\n); } +#endif } } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r236522 - head/sys/netinet
Author: tuexen Date: Sun Jun 3 18:14:57 2012 New Revision: 236522 URL: http://svn.freebsd.org/changeset/base/236522 Log: Remove code which is not needed. MFC after: 3 days Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Sun Jun 3 18:05:19 2012(r236521) +++ head/sys/netinet/sctp_pcb.c Sun Jun 3 18:14:57 2012(r236522) @@ -2187,8 +2187,6 @@ sctp_findassociation_addr(struct mbuf *m from6-sin6_addr = ip6-ip6_src; from6-sin6_port = sh-src_port; /* Get the scopes in properly to the sin6 addr's */ - /* we probably don't need these operations */ - (void)sa6_recoverscope(from6); sa6_embedscope(from6, MODULE_GLOBAL(ip6_use_defzone)); break; } @@ -2230,8 +2228,6 @@ sctp_findassociation_addr(struct mbuf *m to6-sin6_addr = ip6-ip6_dst; to6-sin6_port = sh-dest_port; /* Get the scopes in properly to the sin6 addr's */ - /* we probably don't need these operations */ - (void)sa6_recoverscope(to6); sa6_embedscope(to6, MODULE_GLOBAL(ip6_use_defzone)); break; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r236640 - head/share/man/man4
Author: tuexen Date: Tue Jun 5 20:48:13 2012 New Revision: 236640 URL: http://svn.freebsd.org/changeset/base/236640 Log: The cmsg_len field includes the cmsg header. So use CMSG_LEN(). MFC after: 3 days Modified: head/share/man/man4/ip.4 Modified: head/share/man/man4/ip.4 == --- head/share/man/man4/ip.4Tue Jun 5 20:39:12 2012(r236639) +++ head/share/man/man4/ip.4Tue Jun 5 20:48:13 2012(r236640) @@ -165,7 +165,7 @@ The .Vt cmsghdr fields have the following values: .Bd -literal -cmsg_len = sizeof(struct in_addr) +cmsg_len = CMSG_LEN(sizeof(struct in_addr)) cmsg_level = IPPROTO_IP cmsg_type = IP_RECVDSTADDR .Ed @@ -184,7 +184,7 @@ structure followed by the address. The cmsghdr fields should have the following values: .Bd -literal -cmsg_len = sizeof(struct in_addr) +cmsg_len = CMSG_LEN(sizeof(struct in_addr)) cmsg_level = IPPROTO_IP cmsg_type = IP_SENDSRCADDR .Ed @@ -279,7 +279,7 @@ that contains a cmsghdr structure follow .Tn TTL . The cmsghdr fields have the following values: .Bd -literal -cmsg_len = sizeof(u_char) +cmsg_len = CMSG_LEN(sizeof(u_char)) cmsg_level = IPPROTO_IP cmsg_type = IP_RECVTTL .Ed @@ -307,7 +307,7 @@ The .Vt cmsghdr fields have the following values: .Bd -literal -cmsg_len = sizeof(struct sockaddr_dl) +cmsg_len = CMSG_LEN(sizeof(struct sockaddr_dl)) cmsg_level = IPPROTO_IP cmsg_type = IP_RECVIF .Ed ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r236949 - head/sys/netinet
Author: tuexen Date: Tue Jun 12 09:18:28 2012 New Revision: 236949 URL: http://svn.freebsd.org/changeset/base/236949 Log: Small cleanup. MFC after: 3 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Tue Jun 12 08:10:14 2012(r236948) +++ head/sys/netinet/sctputil.c Tue Jun 12 09:18:28 2012(r236949) @@ -2573,15 +2573,13 @@ sctp_pad_lastmbuf(struct mbuf *m, int pa /* find the last mbuf in chain and pad it */ struct mbuf *m_at; - m_at = m; if (last_mbuf) { return (sctp_add_pad_tombuf(last_mbuf, padval)); } else { - while (m_at) { + for (m_at = m; m_at; m_at = SCTP_BUF_NEXT(m_at)) { if (SCTP_BUF_NEXT(m_at) == NULL) { return (sctp_add_pad_tombuf(m_at, padval)); } - m_at = SCTP_BUF_NEXT(m_at); } } SCTP_LTRACE_ERR_RET_PKT(m, NULL, NULL, NULL, SCTP_FROM_SCTPUTIL, EFAULT); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r236956 - head/sys/netinet
Author: tuexen Date: Tue Jun 12 13:15:27 2012 New Revision: 236956 URL: http://svn.freebsd.org/changeset/base/236956 Log: Unify the sending of ABORT, SHUTDOWN-COMPLETE and ERROR chunks. While there: Fix also some minor bugs and prepare for SCTP/DTLS. MFC after: 3 days Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Tue Jun 12 12:44:17 2012 (r236955) +++ head/sys/netinet/sctp_input.c Tue Jun 12 13:15:27 2012 (r236956) @@ -1442,7 +1442,7 @@ sctp_process_cookie_existing(struct mbuf ph = mtod(op_err, struct sctp_paramhdr *); ph-param_type = htons(SCTP_CAUSE_COOKIE_IN_SHUTDOWN); ph-param_length = htons(sizeof(struct sctp_paramhdr)); - sctp_send_operr_to(m, iphlen, op_err, cookie-peers_vtag, + sctp_send_operr_to(m, sh, cookie-peers_vtag, op_err, vrf_id, net-port); if (how_indx sizeof(asoc-cookie_how)) asoc-cookie_how[how_indx] = 2; @@ -2570,7 +2570,7 @@ sctp_handle_cookie_echo(struct mbuf *m, if (tim == 0) tim = now.tv_usec - cookie-time_entered.tv_usec; scm-time_usec = htonl(tim); - sctp_send_operr_to(m, iphlen, op_err, cookie-peers_vtag, + sctp_send_operr_to(m, sh, cookie-peers_vtag, op_err, vrf_id, port); return (NULL); } Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Tue Jun 12 12:44:17 2012 (r236955) +++ head/sys/netinet/sctp_output.c Tue Jun 12 13:15:27 2012 (r236956) @@ -4478,7 +4478,7 @@ sctp_lowlevel_chunk_output(struct sctp_i #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - m-m_pkthdr.csum_flags = CSUM_SCTP_IPV6; + m-m_pkthdr.csum_flags = CSUM_SCTP; m-m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif @@ -10854,19 +10854,20 @@ sctp_send_shutdown_complete(struct sctp_ return; } -void -sctp_send_shutdown_complete2(struct mbuf *m, struct sctphdr *sh, -uint32_t vrf_id, uint16_t port) +static void +sctp_send_resp_msg(struct mbuf *m, struct sctphdr *sh, uint32_t vtag, +uint8_t type, struct mbuf *cause, uint32_t vrf_id, uint16_t port) { - /* formulate and SEND a SHUTDOWN-COMPLETE */ struct mbuf *o_pak; struct mbuf *mout; + struct sctphdr *shout; + struct sctp_chunkhdr *ch; struct ip *iph; - struct udphdr *udp = NULL; - int offset_out, len, mlen; - struct sctp_shutdown_complete_msg *comp_cp; + struct udphdr *udp; + int len, cause_len, padding_len, ret; #ifdef INET + sctp_route_t ro; struct ip *iph_out; #endif @@ -10875,31 +10876,59 @@ sctp_send_shutdown_complete2(struct mbuf #endif + /* Compute the length of the cause and add final padding. */ + cause_len = 0; + if (cause != NULL) { + struct mbuf *m_at, *m_last = NULL; + + for (m_at = cause; m_at; m_at = SCTP_BUF_NEXT(m_at)) { + if (SCTP_BUF_NEXT(m_at) == NULL) + m_last = m_at; + cause_len += SCTP_BUF_LEN(m_at); + } + padding_len = cause_len % 4; + if (padding_len != 0) { + padding_len = 4 - padding_len; + } + if (padding_len != 0) { + if (sctp_add_pad_tombuf(m_last, padding_len)) { + sctp_m_freem(cause); + return; + } + } + } else { + padding_len = 0; + } + /* Get an mbuf for the header. */ + len = sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr); iph = mtod(m, struct ip *); switch (iph-ip_v) { #ifdef INET case IPVERSION: - len = (sizeof(struct ip) + sizeof(struct sctp_shutdown_complete_msg)); + len += sizeof(struct ip); break; #endif #ifdef INET6 case IPV6_VERSION 4: - len = (sizeof(struct ip6_hdr) + sizeof(struct sctp_shutdown_complete_msg)); + len += sizeof(struct ip6_hdr); break; #endif default: - return; + break; } if (port) { len += sizeof(struct udphdr); } mout = sctp_get_mbuf_for_msg(len + max_linkhdr, 1, M_DONTWAIT, 1, MT_DATA);
svn commit: r236958 - head/sys/netinet6
Author: tuexen Date: Tue Jun 12 13:57:56 2012 New Revision: 236958 URL: http://svn.freebsd.org/changeset/base/236958 Log: Deliver IPV6_TCLASS, IPV6_HOPLIMIT and IPV6_PKTINFO cmsgs (if requested) on IPV6 sockets, which have been marked to be not IPV6_V6ONLY, for each received IPV4 packet. MFC after: 3 days Modified: head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/ip6_input.c == --- head/sys/netinet6/ip6_input.c Tue Jun 12 13:31:32 2012 (r236957) +++ head/sys/netinet6/ip6_input.c Tue Jun 12 13:57:56 2012 (r236958) @@ -1321,19 +1321,28 @@ ip6_savecontrol_v4(struct inpcb *inp, st } #endif - if ((ip6-ip6_vfc IPV6_VERSION_MASK) != IPV6_VERSION) { - if (v4only != NULL) - *v4only = 1; - return (mp); - } - #define IS2292(inp, x, y) (((inp)-inp_flags IN6P_RFC2292) ? (x) : (y)) /* RFC 2292 sec. 5 */ if ((inp-inp_flags IN6P_PKTINFO) != 0) { struct in6_pktinfo pi6; - bcopy(ip6-ip6_dst, pi6.ipi6_addr, sizeof(struct in6_addr)); - in6_clearscope(pi6.ipi6_addr); /* XXX */ + if ((ip6-ip6_vfc IPV6_VERSION_MASK) != IPV6_VERSION) { +#ifdef INET + struct ip *ip; + + ip = mtod(m, struct ip *); + pi6.ipi6_addr.s6_addr32[0] = 0; + pi6.ipi6_addr.s6_addr32[1] = 0; + pi6.ipi6_addr.s6_addr32[2] = IPV6_ADDR_INT32_SMP; + pi6.ipi6_addr.s6_addr32[3] = ip-ip_dst.s_addr; +#else + /* We won't hit this code */ + bzero(pi6.ipi6_addr, sizeof(struct in6_addr)); +#endif + } else { + bcopy(ip6-ip6_dst, pi6.ipi6_addr, sizeof(struct in6_addr)); + in6_clearscope(pi6.ipi6_addr); /* XXX */ + } pi6.ipi6_ifindex = (m m-m_pkthdr.rcvif) ? m-m_pkthdr.rcvif-if_index : 0; @@ -1345,8 +1354,21 @@ ip6_savecontrol_v4(struct inpcb *inp, st } if ((inp-inp_flags IN6P_HOPLIMIT) != 0) { - int hlim = ip6-ip6_hlim 0xff; + int hlim; + + if ((ip6-ip6_vfc IPV6_VERSION_MASK) != IPV6_VERSION) { +#ifdef INET + struct ip *ip; + ip = mtod(m, struct ip *); + hlim = ip-ip_ttl; +#else + /* We won't hit this code */ + hlim = 0; +#endif + } else { + hlim = ip6-ip6_hlim 0xff; + } *mp = sbcreatecontrol((caddr_t) hlim, sizeof(int), IS2292(inp, IPV6_2292HOPLIMIT, IPV6_HOPLIMIT), IPPROTO_IPV6); @@ -1354,8 +1376,40 @@ ip6_savecontrol_v4(struct inpcb *inp, st mp = (*mp)-m_next; } - if (v4only != NULL) - *v4only = 0; + if ((inp-inp_flags IN6P_TCLASS) != 0) { + int tclass; + + if ((ip6-ip6_vfc IPV6_VERSION_MASK) != IPV6_VERSION) { +#ifdef INET + struct ip *ip; + + ip = mtod(m, struct ip *); + tclass = ip-ip_tos; +#else + /* We won't hit this code */ + tclass = 0; +#endif + } else { + u_int32_t flowinfo; + + flowinfo = (u_int32_t)ntohl(ip6-ip6_flow IPV6_FLOWINFO_MASK); + flowinfo = 20; + tclass = flowinfo 0xff; + } + *mp = sbcreatecontrol((caddr_t) tclass, sizeof(int), + IPV6_TCLASS, IPPROTO_IPV6); + if (*mp) + mp = (*mp)-m_next; + } + + if (v4only != NULL) { + if ((ip6-ip6_vfc IPV6_VERSION_MASK) != IPV6_VERSION) { + *v4only = 1; + } else { + *v4only = 0; + } + } + return (mp); } @@ -1369,20 +1423,6 @@ ip6_savecontrol(struct inpcb *in6p, stru if (v4only) return; - if ((in6p-inp_flags IN6P_TCLASS) != 0) { - u_int32_t flowinfo; - int tclass; - - flowinfo = (u_int32_t)ntohl(ip6-ip6_flow IPV6_FLOWINFO_MASK); - flowinfo = 20; - - tclass = flowinfo 0xff; - *mp = sbcreatecontrol((caddr_t) tclass, sizeof(tclass), - IPV6_TCLASS, IPPROTO_IPV6); - if (*mp) - mp = (*mp)-m_next; - } - /* * IPV6_HOPOPTS socket option. Recall that we required super-user * privilege for the option (see ip6_ctloutput), but it might be too
svn commit: r236959 - in head: share/man/man4 sys/netinet
Author: tuexen Date: Tue Jun 12 14:02:38 2012 New Revision: 236959 URL: http://svn.freebsd.org/changeset/base/236959 Log: Add a IP_RECVTOS socket option to receive for received UDP/IPv4 packets a cmsg of type IP_RECVTOS which contains the TOS byte. Much like IP_RECVTTL does for TTL. This allows to implement a protocol on top of UDP and implementing ECN. MFC after: 3 days Modified: head/share/man/man4/ip.4 head/sys/netinet/in.h head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h head/sys/netinet/ip_input.c head/sys/netinet/ip_output.c Modified: head/share/man/man4/ip.4 == --- head/share/man/man4/ip.4Tue Jun 12 13:57:56 2012(r236958) +++ head/share/man/man4/ip.4Tue Jun 12 14:02:38 2012(r236959) @@ -32,7 +32,7 @@ .\ @(#)ip.4 8.2 (Berkeley) 11/30/93 .\ $FreeBSD$ .\ -.Dd November 14, 2011 +.Dd June 12, 2012 .Dt IP 4 .Os .Sh NAME @@ -286,6 +286,29 @@ cmsg_type = IP_RECVTTL .\ .Pp If the +.Dv IP_RECVTOS +option is enabled on a +.Dv SOCK_DGRAM +socket, the +.Xr recvmsg 2 +call will return the +.Tn IP +.Tn TOS +(type of service) field for a +.Tn UDP +datagram. +The msg_control field in the msghdr structure points to a buffer +that contains a cmsghdr structure followed by the +.Tn TOS . +The cmsghdr fields have the following values: +.Bd -literal +cmsg_len = CMSG_LEN(sizeof(u_char)) +cmsg_level = IPPROTO_IP +cmsg_type = IP_RECVTOS +.Ed +.\ +.Pp +If the .Dv IP_RECVIF option is enabled on a .Dv SOCK_DGRAM Modified: head/sys/netinet/in.h == --- head/sys/netinet/in.h Tue Jun 12 13:57:56 2012(r236958) +++ head/sys/netinet/in.h Tue Jun 12 14:02:38 2012(r236959) @@ -462,6 +462,7 @@ __END_DECLS #defineIP_RECVTTL 65 /* bool; receive IP TTL w/dgram */ #defineIP_MINTTL 66 /* minimum TTL for packet or drop */ #defineIP_DONTFRAG 67 /* don't fragment packet */ +#defineIP_RECVTOS 68 /* bool; receive IP TOS w/dgram */ /* IPv4 Source Filter Multicast API [RFC3678] */ #defineIP_ADD_SOURCE_MEMBERSHIP70 /* join a source-specific group */ Modified: head/sys/netinet/in_pcb.c == --- head/sys/netinet/in_pcb.c Tue Jun 12 13:57:56 2012(r236958) +++ head/sys/netinet/in_pcb.c Tue Jun 12 14:02:38 2012(r236959) @@ -2295,6 +2295,10 @@ db_print_inpflags(int inp_flags) db_printf(%sINP_DONTFRAG, comma ? , : ); comma = 1; } + if (inp_flags INP_RECVTOS) { + db_printf(%sINP_RECVTOS, comma ? , : ); + comma = 1; + } if (inp_flags IN6P_IPV6_V6ONLY) { db_printf(%sIN6P_IPV6_V6ONLY, comma ? , : ); comma = 1; Modified: head/sys/netinet/in_pcb.h == --- head/sys/netinet/in_pcb.h Tue Jun 12 13:57:56 2012(r236958) +++ head/sys/netinet/in_pcb.h Tue Jun 12 14:02:38 2012(r236959) @@ -509,6 +509,7 @@ voidinp_4tuple_get(struct inpcb *inp, #defineINP_DONTFRAG0x0800 /* don't fragment packet */ #defineINP_BINDANY 0x1000 /* allow bind to any address */ #defineINP_INHASHLIST 0x2000 /* in_pcbinshash() has been called */ +#defineINP_RECVTOS 0x4000 /* receive incoming IP TOS */ #defineIN6P_IPV6_V6ONLY0x8000 /* restrict AF_INET6 socket for v6 */ #defineIN6P_PKTINFO0x0001 /* receive IP6 dst and I/F */ #defineIN6P_HOPLIMIT 0x0002 /* receive hoplimit */ @@ -528,7 +529,7 @@ voidinp_4tuple_get(struct inpcb *inp, #defineIN6P_MTU0x8000 /* receive path MTU */ #defineINP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\ -INP_RECVIF|INP_RECVTTL|\ +INP_RECVIF|INP_RECVTTL|INP_RECVTOS|\ IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\ IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\ IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\ Modified: head/sys/netinet/ip_input.c == --- head/sys/netinet/ip_input.c Tue Jun 12 13:57:56 2012(r236958) +++ head/sys/netinet/ip_input.c Tue Jun 12 14:02:38 2012(r236959) @@ -1684,6 +1684,12 @@ makedummy: if (*mp) mp = (*mp)-m_next; } + if (inp-inp_flags INP_RECVTOS) { + *mp = sbcreatecontrol((caddr_t) ip-ip_tos, +
svn commit: r236961 - head/sys/netinet
Author: tuexen Date: Tue Jun 12 14:56:08 2012 New Revision: 236961 URL: http://svn.freebsd.org/changeset/base/236961 Log: Add a cmsg of type IP_TOS for UDP/IPv4 sockets to specify the TOS byte. MFC after: 3 days Modified: head/sys/netinet/udp_usrreq.c Modified: head/sys/netinet/udp_usrreq.c == --- head/sys/netinet/udp_usrreq.c Tue Jun 12 14:40:19 2012 (r236960) +++ head/sys/netinet/udp_usrreq.c Tue Jun 12 14:56:08 2012 (r236961) @@ -956,6 +956,7 @@ udp_output(struct inpcb *inp, struct mbu int ipflags; u_short fport, lport; int unlock_udbinfo; + u_char tos; /* * udp_output() may need to temporarily bind or connect the current @@ -972,6 +973,7 @@ udp_output(struct inpcb *inp, struct mbu src.sin_family = 0; INP_RLOCK(inp); + tos = inp-inp_ip_tos; if (control != NULL) { /* * XXX: Currently, we assume all the optional information is @@ -1010,6 +1012,14 @@ udp_output(struct inpcb *inp, struct mbu *(struct in_addr *)CMSG_DATA(cm); break; + case IP_TOS: + if (cm-cmsg_len != CMSG_LEN(sizeof(u_char))) { + error = EINVAL; + break; + } + tos = *(u_char *)CMSG_DATA(cm); + break; + default: error = ENOPROTOOPT; break; @@ -1225,7 +1235,7 @@ udp_output(struct inpcb *inp, struct mbu ui-ui_sum = 0; ((struct ip *)ui)-ip_len = sizeof (struct udpiphdr) + len; ((struct ip *)ui)-ip_ttl = inp-inp_ip_ttl;/* XXX */ - ((struct ip *)ui)-ip_tos = inp-inp_ip_tos;/* XXX */ + ((struct ip *)ui)-ip_tos = tos;/* XXX */ UDPSTAT_INC(udps_opackets); if (unlock_udbinfo == UH_WLOCKED) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r237049 - in head/sys: netinet netinet6
Author: tuexen Date: Thu Jun 14 06:54:48 2012 New Revision: 237049 URL: http://svn.freebsd.org/changeset/base/237049 Log: Pass flowid explicitly through the stack instead of taking it from the mbuf chain at different places. While there: Fix several bugs related to VRFs. MFC after: 3 days Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_indata.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_input.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Thu Jun 14 06:54:35 2012 (r237048) +++ head/sys/netinet/sctp_indata.c Thu Jun 14 06:54:48 2012 (r237049) @@ -2516,8 +2516,10 @@ doit_again: int sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, -struct sctphdr *sh, struct sctp_inpcb *inp, struct sctp_tcb *stcb, -struct sctp_nets *net, uint32_t * high_tsn) +struct sctphdr *sh, struct sctp_inpcb *inp, +struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t * high_tsn, +uint8_t use_mflowid, uint32_t mflowid, +uint32_t vrf_id, uint16_t port) { struct sctp_data_chunk *ch, chunk_buf; struct sctp_association *asoc; @@ -2625,7 +2627,9 @@ sctp_process_data(struct mbuf **mm, int } stcb-sctp_ep-last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_19; sctp_abort_association(inp, stcb, m, iphlen, sh, - op_err, 0, net-port); + op_err, + use_mflowid, mflowid, + vrf_id, port); return (2); } #ifdef SCTP_AUDITING_ENABLED @@ -2689,7 +2693,11 @@ sctp_process_data(struct mbuf **mm, int struct mbuf *op_err; op_err = sctp_generate_invmanparam(SCTP_CAUSE_PROTOCOL_VIOLATION); - sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, 0, net-port); + sctp_abort_association(inp, stcb, + m, iphlen, + sh, op_err, + use_mflowid, mflowid, + vrf_id, port); return (2); } break; Modified: head/sys/netinet/sctp_indata.h == --- head/sys/netinet/sctp_indata.h Thu Jun 14 06:54:35 2012 (r237048) +++ head/sys/netinet/sctp_indata.h Thu Jun 14 06:54:48 2012 (r237049) @@ -113,7 +113,9 @@ void int sctp_process_data(struct mbuf **, int, int *, int, struct sctphdr *, struct sctp_inpcb *, struct sctp_tcb *, -struct sctp_nets *, uint32_t *); +struct sctp_nets *, uint32_t *, +uint8_t, uint32_t, +uint32_t, uint16_t); void sctp_slide_mapping_arrays(struct sctp_tcb *stcb); Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Thu Jun 14 06:54:35 2012 (r237048) +++ head/sys/netinet/sctp_input.c Thu Jun 14 06:54:48 2012 (r237049) @@ -81,8 +81,10 @@ sctp_stop_all_cookie_timers(struct sctp_ /* INIT handler */ static void sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, -struct sctp_init_chunk *cp, struct sctp_inpcb *inp, struct sctp_tcb *stcb, -int *abort_no_unlock, uint32_t vrf_id, uint16_t port) +struct sctp_init_chunk *cp, struct sctp_inpcb *inp, +struct sctp_tcb *stcb, int *abort_no_unlock, +uint8_t use_mflowid, uint32_t mflowid, +uint32_t vrf_id, uint16_t port) { struct sctp_init *init; struct mbuf *op_err; @@ -96,6 +98,7 @@ sctp_handle_init(struct mbuf *m, int iph if (ntohs(cp-ch.chunk_length) sizeof(struct sctp_init_chunk)) { op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + use_mflowid, mflowid, vrf_id, port); if (stcb) *abort_no_unlock = 1; @@ -107,6 +110,7 @@ sctp_handle_init(struct mbuf *m, int iph /* protocol error... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + use_mflowid, mflowid,
svn commit: r237229 - head/sys/netinet
Author: tuexen Date: Mon Jun 18 17:09:39 2012 New Revision: 237229 URL: http://svn.freebsd.org/changeset/base/237229 Log: Cleanup the UDP decapsulation code. MFC after: 3 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Mon Jun 18 16:21:59 2012(r237228) +++ head/sys/netinet/sctputil.c Mon Jun 18 17:09:39 2012(r237229) @@ -6837,83 +6837,61 @@ sctp_recv_udp_tunneled_packet(struct mbu struct ip *iph; struct mbuf *sp, *last; struct udphdr *uhdr; - uint16_t port = 0; - int header_size = sizeof(struct udphdr) + sizeof(struct sctphdr); + uint16_t port; - /* -* Split out the mbuf chain. Leave the IP header in m, place the -* rest in the sp. -*/ if ((m-m_flags M_PKTHDR) == 0) { /* Can't handle one that is not a pkt hdr */ goto out; } - /* pull the src port */ + /* Pull the src port */ iph = mtod(m, struct ip *); uhdr = (struct udphdr *)((caddr_t)iph + off); - port = uhdr-uh_sport; + /* +* Split out the mbuf chain. Leave the IP header in m, place the +* rest in the sp. +*/ sp = m_split(m, off, M_DONTWAIT); if (sp == NULL) { /* Gak, drop packet, we can't do a split */ goto out; } - if (sp-m_pkthdr.len header_size) { - /* Gak, packet can't have an SCTP header in it - to small */ + if (sp-m_pkthdr.len sizeof(struct udphdr) + sizeof(struct sctphdr)) { + /* Gak, packet can't have an SCTP header in it - too small */ m_freem(sp); goto out; } - /* ok now pull up the UDP header and SCTP header together */ - sp = m_pullup(sp, header_size); + /* Now pull up the UDP header and SCTP header together */ + sp = m_pullup(sp, sizeof(struct udphdr) + sizeof(struct sctphdr)); if (sp == NULL) { /* Gak pullup failed */ goto out; } - /* trim out the UDP header */ + /* Trim out the UDP header */ m_adj(sp, sizeof(struct udphdr)); /* Now reconstruct the mbuf chain */ - /* 1) find last one */ - last = m; - while (last-m_next != NULL) { - last = last-m_next; - } + for (last = m; last-m_next; last = last-m_next); last-m_next = sp; m-m_pkthdr.len += sp-m_pkthdr.len; - last = m; - while (last != NULL) { - last = last-m_next; - } - /* Now its ready for sctp_input or sctp6_input */ iph = mtod(m, struct ip *); switch (iph-ip_v) { #ifdef INET case IPVERSION: - { - uint16_t len; - - /* its IPv4 */ - len = SCTP_GET_IPV4_LENGTH(iph); - len -= sizeof(struct udphdr); - SCTP_GET_IPV4_LENGTH(iph) = len; - sctp_input_with_port(m, off, port); - break; - } + iph-ip_len -= sizeof(struct udphdr); + sctp_input_with_port(m, off, port); + break; #endif #ifdef INET6 case IPV6_VERSION 4: - { - /* its IPv6 - NOT supported */ - goto out; - break; + /* Not yet supported. */ + goto out; + break; - } #endif default: - { - m_freem(m); - break; - } + goto out; + break; } return; out: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r237230 - head/sys/netinet
Author: tuexen Date: Mon Jun 18 17:11:24 2012 New Revision: 237230 URL: http://svn.freebsd.org/changeset/base/237230 Log: Add rate limitation for SCTP OOTB responses. MFC after: 3 days Modified: head/sys/netinet/icmp_var.h head/sys/netinet/ip_icmp.c head/sys/netinet/sctp_input.c Modified: head/sys/netinet/icmp_var.h == --- head/sys/netinet/icmp_var.h Mon Jun 18 17:09:39 2012(r237229) +++ head/sys/netinet/icmp_var.h Mon Jun 18 17:11:24 2012(r237230) @@ -102,7 +102,8 @@ extern int badport_bandlim(int); #define BANDLIM_RST_CLOSEDPORT 3 /* No connection, and no listeners */ #define BANDLIM_RST_OPENPORT 4 /* No connection, listener */ #define BANDLIM_ICMP6_UNREACH 5 -#define BANDLIM_MAX 5 +#define BANDLIM_SCTP_OOTB 6 +#define BANDLIM_MAX 6 #endif #endif Modified: head/sys/netinet/ip_icmp.c == --- head/sys/netinet/ip_icmp.c Mon Jun 18 17:09:39 2012(r237229) +++ head/sys/netinet/ip_icmp.c Mon Jun 18 17:11:24 2012(r237230) @@ -965,7 +965,8 @@ badport_bandlim(int which) { icmp tstamp response }, { closed port RST response }, { open port RST response }, - { icmp6 unreach response } + { icmp6 unreach response }, + { sctp ootb response } }; /* Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Mon Jun 18 17:09:39 2012 (r237229) +++ head/sys/netinet/sctp_input.c Mon Jun 18 17:11:24 2012 (r237230) @@ -6060,15 +6060,8 @@ sctp_skip_csum_4: struct sctp_init_chunk *init_chk, chunk_buf; SCTP_STAT_INCR(sctps_noport); -#ifdef ICMP_BANDLIM - /* -* we use the bandwidth limiting to protect against sending -* too many ABORTS all at once. In this case these count the -* same as an ICMP message. -*/ - if (badport_bandlim(0) 0) + if (badport_bandlim(BANDLIM_SCTP_OOTB) 0) goto bad; -#endif /* ICMP_BANDLIM */ SCTPDBG(SCTP_DEBUG_INPUT1, Sending a ABORT from packet entry!\n); if (ch-chunk_type == SCTP_INITIATION) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r237392 - head/sys/netinet
Author: tuexen Date: Thu Jun 21 12:51:24 2012 New Revision: 237392 URL: http://svn.freebsd.org/changeset/base/237392 Log: Remove redundant #ifdef. Reported by gnn@. MFC after: 3 days Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c == --- head/sys/netinet/sctp_usrreq.c Thu Jun 21 12:47:21 2012 (r237391) +++ head/sys/netinet/sctp_usrreq.c Thu Jun 21 12:51:24 2012 (r237392) @@ -6476,7 +6476,6 @@ sctp_peeraddr(struct socket *so, struct return (0); } -#ifdef INET struct pr_usrreqs sctp_usrreqs = { .pru_abort = sctp_abort, .pru_accept = sctp_accept, @@ -6499,4 +6498,3 @@ struct pr_usrreqs sctp_usrreqs = { }; #endif -#endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r237540 - in head/sys: netinet netinet6
Author: tuexen Date: Sun Jun 24 21:25:54 2012 New Revision: 237540 URL: http://svn.freebsd.org/changeset/base/237540 Log: Do packet logging in a consistent way. MFC after: 3 days Modified: head/sys/netinet/sctp_bsd_addr.c head/sys/netinet/sctp_bsd_addr.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_output.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_bsd_addr.c == --- head/sys/netinet/sctp_bsd_addr.cSun Jun 24 18:38:16 2012 (r237539) +++ head/sys/netinet/sctp_bsd_addr.cSun Jun 24 21:25:54 2012 (r237540) @@ -422,11 +422,12 @@ sctp_get_mbuf_for_msg(unsigned int space #ifdef SCTP_PACKET_LOGGING void -sctp_packet_log(struct mbuf *m, int length) +sctp_packet_log(struct mbuf *m) { int *lenat, thisone; void *copyto; uint32_t *tick_tock; + int length; int total_len; int grabbed_lock = 0; int value, newval, thisend, thisbegin; @@ -436,6 +437,7 @@ sctp_packet_log(struct mbuf *m, int leng * (value) -ticks of log (ticks) o -ip packet o -as logged - * where this started (thisbegin) x --end points here */ + length = SCTP_HEADER_LEN(m); total_len = SCTP_SIZE32((length + (4 * sizeof(int; /* Log a packet to the buffer. */ if (total_len SCTP_PACKET_LOG_SIZE) { Modified: head/sys/netinet/sctp_bsd_addr.h == --- head/sys/netinet/sctp_bsd_addr.hSun Jun 24 18:38:16 2012 (r237539) +++ head/sys/netinet/sctp_bsd_addr.hSun Jun 24 21:25:54 2012 (r237540) @@ -53,7 +53,7 @@ void sctp_gather_internal_ifa_flags(stru #ifdef SCTP_PACKET_LOGGING -void sctp_packet_log(struct mbuf *m, int length); +void sctp_packet_log(struct mbuf *m); int sctp_copy_out_packet_log(uint8_t * target, int length); #endif Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sun Jun 24 18:38:16 2012 (r237539) +++ head/sys/netinet/sctp_input.c Sun Jun 24 21:25:54 2012 (r237540) @@ -5932,9 +5932,9 @@ sctp_input_with_port(struct mbuf *i_pak, } } #endif -#ifdef SCTP_PACKET_LOGGING +#ifdef SCTP_PACKET_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) SCTP_LAST_PACKET_TRACING) - sctp_packet_log(m, mlen); + sctp_packet_log(m); #endif if (m-m_flags M_FLOWID) { mflowid = m-m_pkthdr.flowid; Modified: head/sys/netinet/sctp_os_bsd.h == --- head/sys/netinet/sctp_os_bsd.h Sun Jun 24 18:38:16 2012 (r237539) +++ head/sys/netinet/sctp_os_bsd.h Sun Jun 24 21:25:54 2012 (r237540) @@ -365,7 +365,7 @@ typedef struct callout sctp_os_timer_t; */ #define SCTP_HEADER_TO_CHAIN(m) (m) #define SCTP_DETACH_HEADER_FROM_CHAIN(m) -#define SCTP_HEADER_LEN(m) (m-m_pkthdr.len) +#define SCTP_HEADER_LEN(m) ((m)-m_pkthdr.len) #define SCTP_GET_HEADER_FOR_OUTPUT(o_pak) 0 #define SCTP_RELEASE_HEADER(m) #define SCTP_RELEASE_PKT(m)sctp_m_freem(m) Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sun Jun 24 18:38:16 2012 (r237539) +++ head/sys/netinet/sctp_output.c Sun Jun 24 21:25:54 2012 (r237540) @@ -4107,10 +4107,6 @@ sctp_lowlevel_chunk_output(struct sctp_i sctp_m_freem(m); return (ENOMEM); } -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) SCTP_LAST_PACKET_TRACING) - sctp_packet_log(m, packet_length); -#endif SCTP_ATTACH_CHAIN(o_pak, m, packet_length); if (port) { #if defined(SCTP_WITH_NO_CSUM) @@ -4131,6 +4127,10 @@ sctp_lowlevel_chunk_output(struct sctp_i SCTP_STAT_INCR(sctps_sendhwcrc); #endif } +#ifdef SCTP_PACKET_LOGGING + if (SCTP_BASE_SYSCTL(sctp_logging_level) SCTP_LAST_PACKET_TRACING) + sctp_packet_log(o_pak); +#endif /* send it out. table id is taken from stcb */ #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) (so_locked)) { @@ -4459,10 +4459,6 @@ sctp_lowlevel_chunk_output(struct sctp_i SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM); return (ENOMEM); } -#ifdef SCTP_PACKET_LOGGING -
svn commit: r237541 - head/sys/netinet
Author: tuexen Date: Sun Jun 24 22:22:44 2012 New Revision: 237541 URL: http://svn.freebsd.org/changeset/base/237541 Log: Remove redundant check. MFC after: 3 days Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sun Jun 24 21:25:54 2012 (r237540) +++ head/sys/netinet/sctp_input.c Sun Jun 24 22:22:44 2012 (r237541) @@ -2392,7 +2392,7 @@ sctp_handle_cookie_echo(struct mbuf *m, uint8_t calc_sig[SCTP_SIGNATURE_SIZE], tmp_sig[SCTP_SIGNATURE_SIZE]; uint8_t *sig; uint8_t cookie_ok = 0; - unsigned int size_of_pkt, sig_offset, cookie_offset; + unsigned int sig_offset, cookie_offset; unsigned int cookie_len; struct timeval now; struct timeval time_expires; @@ -2434,7 +2434,6 @@ sctp_handle_cookie_echo(struct mbuf *m, lsin-sin_len = sizeof(*lsin); lsin-sin_port = sh-dest_port; lsin-sin_addr.s_addr = iph-ip_dst.s_addr; - size_of_pkt = SCTP_GET_IPV4_LENGTH(iph); break; } #endif @@ -2452,7 +2451,6 @@ sctp_handle_cookie_echo(struct mbuf *m, ip6 = mtod(m, struct ip6_hdr *); lsin6-sin6_port = sh-dest_port; lsin6-sin6_addr = ip6-ip6_dst; - size_of_pkt = SCTP_GET_IPV6_LENGTH(ip6) + iphlen; break; } #endif @@ -2476,11 +2474,10 @@ sctp_handle_cookie_echo(struct mbuf *m, */ return (NULL); } - if (cookie_len size_of_pkt || - cookie_len sizeof(struct sctp_cookie_echo_chunk) + + if (cookie_len sizeof(struct sctp_cookie_echo_chunk) + sizeof(struct sctp_init_chunk) + sizeof(struct sctp_init_ack_chunk) + SCTP_SIGNATURE_SIZE) { - /* cookie too long! or too small */ + /* cookie too small */ return (NULL); } /* @@ -2488,11 +2485,6 @@ sctp_handle_cookie_echo(struct mbuf *m, * calculated in the sctp_hmac_m() call). */ sig_offset = offset + cookie_len - SCTP_SIGNATURE_SIZE; - if (sig_offset size_of_pkt) { - /* packet not correct size! */ - /* XXX this may already be accounted for earlier... */ - return (NULL); - } m_sig = m_split(m, sig_offset, M_DONTWAIT); if (m_sig == NULL) { /* out of memory or ?? */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r237565 - in head/sys: netinet netinet6
Author: tuexen Date: Mon Jun 25 17:15:09 2012 New Revision: 237565 URL: http://svn.freebsd.org/changeset/base/237565 Log: Whitespace cleanup. MFC after: 3 days Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Mon Jun 25 17:12:51 2012 (r237564) +++ head/sys/netinet/sctp_indata.c Mon Jun 25 17:15:09 2012 (r237565) @@ -1529,7 +1529,7 @@ sctp_process_a_data_chunk(struct sctp_tc */ if (stcb-sctp_socket-so_rcv.sb_cc) { /* some to read, wake-up */ -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; so = SCTP_INP_SO(stcb-sctp_ep); @@ -1545,7 +1545,7 @@ sctp_process_a_data_chunk(struct sctp_tc } #endif sctp_sorwakeup(stcb-sctp_ep, stcb-sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } @@ -3982,7 +3982,7 @@ sctp_express_handle_sack(struct sctp_tcb } /* sa_ignore NO_NULL_CHK */ if (stcb-sctp_socket) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -3991,7 +3991,7 @@ sctp_express_handle_sack(struct sctp_tcb /* sa_ignore NO_NULL_CHK */ sctp_wakeup_log(stcb, 1, SCTP_WAKESND_FROM_SACK); } -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb-sctp_ep); atomic_add_int(stcb-asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -4005,7 +4005,7 @@ sctp_express_handle_sack(struct sctp_tcb } #endif sctp_sowwakeup_locked(stcb-sctp_ep, stcb-sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } else { @@ -4734,7 +4734,7 @@ sctp_handle_sack(struct mbuf *m, int off } /* sa_ignore NO_NULL_CHK */ if ((wake_him) (stcb-sctp_socket)) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -4742,7 +4742,7 @@ sctp_handle_sack(struct mbuf *m, int off if (SCTP_BASE_SYSCTL(sctp_logging_level) SCTP_WAKE_LOGGING_ENABLE) { sctp_wakeup_log(stcb, wake_him, SCTP_WAKESND_FROM_SACK); } -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb-sctp_ep); atomic_add_int(stcb-asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -4756,7 +4756,7 @@ sctp_handle_sack(struct mbuf *m, int off } #endif sctp_sowwakeup_locked(stcb-sctp_ep, stcb-sctp_socket); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } else { Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Mon Jun 25 17:12:51 2012 (r237564) +++ head/sys/netinet/sctp_input.c Mon Jun 25 17:15:09 2012 (r237565) @@ -757,7 +757,7 @@ static void sctp_handle_abort(struct sctp_abort_chunk *abort, struct sctp_tcb *stcb, struct sctp_nets *net) { -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; #endif @@ -807,7 +807,7 @@ sctp_handle_abort(struct sctp_abort_chun #ifdef SCTP_ASOCLOG_OF_TSNS sctp_print_out_track_log(stcb); #endif -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb-sctp_ep); atomic_add_int(stcb-asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); @@ -818,7 +818,7 @@ sctp_handle_abort(struct sctp_abort_chun stcb-asoc.state |= SCTP_STATE_WAS_ABORTED; (void)sctp_free_assoc(stcb-sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_6); -#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) +#if
svn commit: r237569 - in head/sys: netinet netinet6
Author: tuexen Date: Mon Jun 25 19:13:43 2012 New Revision: 237569 URL: http://svn.freebsd.org/changeset/base/237569 Log: Unify sctp_input() and sctp6_input(). MFC after: 3 days Modified: head/sys/netinet/sctp_input.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Mon Jun 25 19:01:04 2012 (r237568) +++ head/sys/netinet/sctp_input.c Mon Jun 25 19:13:43 2012 (r237569) @@ -5885,12 +5885,12 @@ sctp_input_with_port(struct mbuf *i_pak, uint8_t ecn_bits; struct ip *ip; struct sctphdr *sh; + struct sctp_chunkhdr *ch; struct sctp_inpcb *inp = NULL; - struct sctp_nets *net; struct sctp_tcb *stcb = NULL; - struct sctp_chunkhdr *ch; + struct sctp_nets *net = NULL; int refcount_up = 0; - int length, mlen, offset; + int length, offset; uint32_t mflowid; uint8_t use_mflowid; @@ -5899,19 +5899,12 @@ sctp_input_with_port(struct mbuf *i_pak, #endif + iphlen = off; if (SCTP_GET_PKT_VRFID(i_pak, vrf_id)) { SCTP_RELEASE_PKT(i_pak); return; } - mlen = SCTP_HEADER_LEN(i_pak); - iphlen = off; m = SCTP_HEADER_TO_CHAIN(i_pak); - - net = NULL; - SCTP_STAT_INCR(sctps_recvpackets); - SCTP_STAT_INCR_COUNTER64(sctps_inpackets); - - #ifdef SCTP_MBUF_LOGGING /* Log in any input mbufs */ if (SCTP_BASE_SYSCTL(sctp_logging_level) SCTP_MBUF_LOGGING_ENABLE) { @@ -5925,8 +5918,9 @@ sctp_input_with_port(struct mbuf *i_pak, } #endif #ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) SCTP_LAST_PACKET_TRACING) + if (SCTP_BASE_SYSCTL(sctp_logging_level) SCTP_LAST_PACKET_TRACING) { sctp_packet_log(m); + } #endif if (m-m_flags M_FLOWID) { mflowid = m-m_pkthdr.flowid; @@ -5935,17 +5929,11 @@ sctp_input_with_port(struct mbuf *i_pak, mflowid = 0; use_mflowid = 0; } - /* -* Must take out the iphlen, since mlen expects this (only effect lb -* case) -*/ - mlen -= iphlen; - - /* -* Get IP, SCTP, and first chunk header together in first mbuf. -*/ + SCTP_STAT_INCR(sctps_recvpackets); + SCTP_STAT_INCR_COUNTER64(sctps_inpackets); + /* Get IP, SCTP, and first chunk header together in the first mbuf. */ ip = mtod(m, struct ip *); - offset = iphlen + sizeof(*sh) + sizeof(*ch); + offset = iphlen + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr); if (SCTP_BUF_LEN(m) offset) { if ((m = m_pullup(m, offset)) == 0) { SCTP_STAT_INCR(sctps_hdrops); @@ -5953,28 +5941,26 @@ sctp_input_with_port(struct mbuf *i_pak, } ip = mtod(m, struct ip *); } - /* validate mbuf chain length with IP payload length */ - if (mlen (SCTP_GET_IPV4_LENGTH(ip) - iphlen)) { + sh = (struct sctphdr *)((caddr_t)ip + iphlen); + ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(struct sctphdr)); + offset -= sizeof(struct sctp_chunkhdr); + length = ip-ip_len + iphlen; + /* Validate mbuf chain length with IP payload length. */ + if (SCTP_HEADER_LEN(i_pak) != length) { + SCTPDBG(SCTP_DEBUG_INPUT1, + sctp_input() length:%d reported length:%d\n, length, SCTP_HEADER_LEN(i_pak)); SCTP_STAT_INCR(sctps_hdrops); goto bad; } - sh = (struct sctphdr *)((caddr_t)ip + iphlen); - ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(*sh)); - SCTPDBG(SCTP_DEBUG_INPUT1, - sctp_input() length:%d iphlen:%d\n, mlen, iphlen); - /* SCTP does not allow broadcasts or multicasts */ if (IN_MULTICAST(ntohl(ip-ip_dst.s_addr))) { goto bad; } if (SCTP_IS_IT_BROADCAST(ip-ip_dst, m)) { - /* -* We only look at broadcast if its a front state, All -* others we will not have a tcb for anyway. -*/ goto bad; } - /* validate SCTP checksum */ + SCTPDBG(SCTP_DEBUG_INPUT1, + sctp_input() length:%d iphlen:%d\n, length, iphlen); SCTPDBG(SCTP_DEBUG_CRCOFFLOAD, sctp_input(): Packet of length %d received on %s with csum_flags 0x%x.\n, m-m_pkthdr.len, @@ -5985,21 +5971,18 @@ sctp_input_with_port(struct mbuf *i_pak, #else if (m-m_pkthdr.csum_flags CSUM_SCTP_VALID) { SCTP_STAT_INCR(sctps_recvhwcrc); - goto sctp_skip_csum_4; + goto sctp_skip_csum; } - check = sh-checksum; /* save incoming checksum */ - sh-checksum = 0; /* prepare for
svn commit: r237715 - in head/sys: netinet netinet6
Author: tuexen Date: Thu Jun 28 16:01:08 2012 New Revision: 237715 URL: http://svn.freebsd.org/changeset/base/237715 Log: Pass the src and dst address of a received packet explicitly around. MFC after: 3 days Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_asconf.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_indata.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_input.h head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Thu Jun 28 15:38:14 2012 (r237714) +++ head/sys/netinet/sctp_asconf.c Thu Jun 28 16:01:08 2012 (r237715) @@ -50,59 +50,8 @@ __FBSDID($FreeBSD$); */ -static void -sctp_asconf_get_source_ip(struct mbuf *m, struct sockaddr *sa) -{ - struct ip *iph; - -#ifdef INET - struct sockaddr_in *sin; - -#endif -#ifdef INET6 - struct sockaddr_in6 *sin6; - -#endif - - iph = mtod(m, struct ip *); - switch (iph-ip_v) { -#ifdef INET - case IPVERSION: - { - /* IPv4 source */ - sin = (struct sockaddr_in *)sa; - bzero(sin, sizeof(*sin)); - sin-sin_family = AF_INET; - sin-sin_len = sizeof(struct sockaddr_in); - sin-sin_port = 0; - sin-sin_addr.s_addr = iph-ip_src.s_addr; - break; - } -#endif -#ifdef INET6 - case (IPV6_VERSION 4): - { - /* IPv6 source */ - struct ip6_hdr *ip6; - - sin6 = (struct sockaddr_in6 *)sa; - bzero(sin6, sizeof(*sin6)); - sin6-sin6_family = AF_INET6; - sin6-sin6_len = sizeof(struct sockaddr_in6); - sin6-sin6_port = 0; - ip6 = mtod(m, struct ip6_hdr *); - sin6-sin6_addr = ip6-ip6_src; - break; - } -#endif /* INET6 */ - default: - break; - } - return; -} - /* - * draft-ietf-tsvwg-addip-sctp + * RFC 5061 * * An ASCONF parameter queue exists per asoc which holds the pending address * operations. Lists are updated upon receipt of ASCONF-ACK. @@ -194,12 +143,12 @@ sctp_asconf_error_response(uint32_t id, } static struct mbuf * -sctp_process_asconf_add_ip(struct mbuf *m, struct sctp_asconf_paramhdr *aph, +sctp_process_asconf_add_ip(struct sockaddr *src, struct sctp_asconf_paramhdr *aph, struct sctp_tcb *stcb, int send_hb, int response_required) { struct sctp_nets *net; struct mbuf *m_reply = NULL; - struct sockaddr_storage sa_source, sa_store; + struct sockaddr_storage sa_store; struct sctp_paramhdr *ph; uint16_t param_type, param_length, aparam_length; struct sockaddr *sa; @@ -279,11 +228,10 @@ sctp_process_asconf_add_ip(struct mbuf * /* if 0.0.0.0/::0, add the source address instead */ if (zero_address SCTP_BASE_SYSCTL(sctp_nat_friendly)) { - sa = (struct sockaddr *)sa_source; - sctp_asconf_get_source_ip(m, sa); + sa = src; SCTPDBG(SCTP_DEBUG_ASCONF1, process_asconf_add_ip: using source addr ); - SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, sa); + SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, src); } /* add the address */ if (bad_address) { @@ -343,11 +291,12 @@ sctp_asconf_del_remote_addrs_except(stru } static struct mbuf * -sctp_process_asconf_delete_ip(struct mbuf *m, struct sctp_asconf_paramhdr *aph, +sctp_process_asconf_delete_ip(struct sockaddr *src, +struct sctp_asconf_paramhdr *aph, struct sctp_tcb *stcb, int response_required) { struct mbuf *m_reply = NULL; - struct sockaddr_storage sa_source, sa_store; + struct sockaddr_storage sa_store; struct sctp_paramhdr *ph; uint16_t param_type, param_length, aparam_length; struct sockaddr *sa; @@ -365,9 +314,6 @@ sctp_process_asconf_delete_ip(struct mbu #endif - /* get the source IP address for src and 0.0.0.0/::0 delete checks */ - sctp_asconf_get_source_ip(m, (struct sockaddr *)sa_source); - aparam_length = ntohs(aph-ph.param_length); ph = (struct sctp_paramhdr *)(aph + 1); param_type = ntohs(ph-param_type); @@ -424,7 +370,7 @@ sctp_process_asconf_delete_ip(struct mbu } /* make sure the source address is not being deleted */ -
svn commit: r238002 - head/sys/netinet
Author: tuexen Date: Mon Jul 2 16:40:11 2012 New Revision: 238002 URL: http://svn.freebsd.org/changeset/base/238002 Log: Remove dead code (on FreeBSD) as suggested by glebius@. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Mon Jul 2 16:24:43 2012 (r238001) +++ head/sys/netinet/sctp_output.c Mon Jul 2 16:40:11 2012 (r238002) @@ -10811,7 +10811,6 @@ sctp_send_resp_msg(struct sockaddr *src, int len, cause_len, padding_len, ret; #ifdef INET - sctp_route_t ro; struct sockaddr_in *src_sin, *dst_sin; struct ip *ip; @@ -10979,8 +10978,6 @@ sctp_send_resp_msg(struct sockaddr *src, SCTP_ATTACH_CHAIN(o_pak, mout, len); #ifdef INET if (ip != NULL) { - /* zap the stack pointer to the route */ - bzero(ro, sizeof(sctp_route_t)); if (port) { if (V_udp_cksum) { udp-uh_sum = in_pseudo(ip-ip_src.s_addr, ip-ip_dst.s_addr, udp-uh_ulen + htons(IPPROTO_UDP)); @@ -11013,11 +11010,7 @@ sctp_send_resp_msg(struct sockaddr *src, sctp_packet_log(o_pak); } #endif - SCTP_IP_OUTPUT(ret, o_pak, ro, NULL, vrf_id); - /* Free the route if we got one back */ - if (ro.ro_rt) { - RTFREE(ro.ro_rt); - } + SCTP_IP_OUTPUT(ret, o_pak, NULL, NULL, vrf_id); } #endif #ifdef INET6 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r238003 - in head/sys: netinet netinet6
Author: tuexen Date: Mon Jul 2 16:44:09 2012 New Revision: 238003 URL: http://svn.freebsd.org/changeset/base/238003 Log: Move common code parts to sctp_common_input_processing(). MFC after: 3 days Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctp_input.h head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Mon Jul 2 16:40:11 2012 (r238002) +++ head/sys/netinet/sctp_input.c Mon Jul 2 16:44:09 2012 (r238003) @@ -5590,26 +5590,141 @@ void sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int length, struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh, struct sctp_chunkhdr *ch, -struct sctp_inpcb *inp, struct sctp_tcb *stcb, -struct sctp_nets *net, uint8_t ecn_bits, +#if !defined(SCTP_WITH_NO_CSUM) +uint8_t compute_crc, +#endif +uint8_t ecn_bits, uint8_t use_mflowid, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { - /* -* Control chunk processing -*/ uint32_t high_tsn; int fwd_tsn_seen = 0, data_processed = 0; struct mbuf *m = *mm; int un_sent; int cnt_ctrl_ready = 0; + struct sctp_inpcb *inp, *inp_decr = NULL; + struct sctp_tcb *stcb = NULL; + struct sctp_nets *net; SCTP_STAT_INCR(sctps_recvdatagrams); #ifdef SCTP_AUDITING_ENABLED sctp_audit_log(0xE0, 1); sctp_auditing(0, inp, stcb, net); #endif +#if !defined(SCTP_WITH_NO_CSUM) + if (compute_crc != 0) { + uint32_t check, calc_check; + check = sh-checksum; + sh-checksum = 0; + calc_check = sctp_calculate_cksum(m, iphlen); + sh-checksum = check; + if (calc_check != check) { + SCTPDBG(SCTP_DEBUG_INPUT1, Bad CSUM on SCTP packet calc_check:%x check:%x m:%p mlen:%d iphlen:%d\n, + calc_check, check, m, length, iphlen); + stcb = sctp_findassociation_addr(m, offset, src, dst, + sh, ch, inp, net, vrf_id); + if ((net != NULL) (port != 0)) { + if (net-port == 0) { + sctp_pathmtu_adjustment(stcb, net-mtu - sizeof(struct udphdr)); + } + net-port = port; + } + if ((net != NULL) (use_mflowid != 0)) { + net-flowid = mflowid; +#ifdef INVARIANTS + net-flowidset = 1; +#endif + } + if ((inp != NULL) (stcb != NULL)) { + sctp_send_packet_dropped(stcb, net, m, length, iphlen, 1); + sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_INPUT_ERROR, SCTP_SO_NOT_LOCKED); + } else if ((inp != NULL) (stcb == NULL)) { + inp_decr = inp; + } + SCTP_STAT_INCR(sctps_badsum); + SCTP_STAT_INCR_COUNTER32(sctps_checksumerrors); + goto out; + } + } +#endif + /* Destination port of 0 is illegal, based on RFC4960. */ + if (sh-dest_port == 0) { + SCTP_STAT_INCR(sctps_hdrops); + goto out; + } + stcb = sctp_findassociation_addr(m, offset, src, dst, + sh, ch, inp, net, vrf_id); + if ((net != NULL) (port != 0)) { + if (net-port == 0) { + sctp_pathmtu_adjustment(stcb, net-mtu - sizeof(struct udphdr)); + } + net-port = port; + } + if ((net != NULL) (use_mflowid != 0)) { + net-flowid = mflowid; +#ifdef INVARIANTS + net-flowidset = 1; +#endif + } + if (inp == NULL) { + SCTP_STAT_INCR(sctps_noport); + if (badport_bandlim(BANDLIM_SCTP_OOTB) 0) { + goto out; + } + if (ch-chunk_type == SCTP_SHUTDOWN_ACK) { + sctp_send_shutdown_complete2(src, dst, sh, + use_mflowid, mflowid, + vrf_id, port); + goto out; + } + if (ch-chunk_type == SCTP_SHUTDOWN_COMPLETE) { + goto out; + } + if (ch-chunk_type != SCTP_ABORT_ASSOCIATION) { + if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || + ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) + (ch-chunk_type != SCTP_INIT))) { + sctp_send_abort(m, iphlen, src, dst, +
svn commit: r238087 - head/sys/netinet
Author: tuexen Date: Tue Jul 3 21:41:19 2012 New Revision: 238087 URL: http://svn.freebsd.org/changeset/base/238087 Log: Iniitialize a variable. MFC after: 3 days Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Tue Jul 3 19:11:38 2012 (r238086) +++ head/sys/netinet/sctp_input.c Tue Jul 3 21:41:19 2012 (r238087) @@ -5604,7 +5604,7 @@ sctp_common_input_processing(struct mbuf int cnt_ctrl_ready = 0; struct sctp_inpcb *inp, *inp_decr = NULL; struct sctp_tcb *stcb = NULL; - struct sctp_nets *net; + struct sctp_nets *net = NULL; SCTP_STAT_INCR(sctps_recvdatagrams); #ifdef SCTP_AUDITING_ENABLED ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r238121 - head/sys/netinet
Author: tuexen Date: Wed Jul 4 20:29:16 2012 New Revision: 238121 URL: http://svn.freebsd.org/changeset/base/238121 Log: Use CSUM_SCTP_IPV6 for IPv6. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Wed Jul 4 20:20:48 2012 (r238120) +++ head/sys/netinet/sctp_output.c Wed Jul 4 20:29:16 2012 (r238121) @@ -4471,7 +4471,7 @@ sctp_lowlevel_chunk_output(struct sctp_i #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - m-m_pkthdr.csum_flags = CSUM_SCTP; + m-m_pkthdr.csum_flags = CSUM_SCTP_IPV6; m-m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif @@ -11025,7 +11025,7 @@ sctp_send_resp_msg(struct sockaddr *src, #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - mout-m_pkthdr.csum_flags = CSUM_SCTP; + mout-m_pkthdr.csum_flags = CSUM_SCTP_IPV6; mout-m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r238122 - head/sys/netinet
Author: tuexen Date: Wed Jul 4 20:59:30 2012 New Revision: 238122 URL: http://svn.freebsd.org/changeset/base/238122 Log: Use consistent method to determine IPV4_OUTPUT/IPV6_OUTPUT. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Wed Jul 4 20:29:16 2012 (r238121) +++ head/sys/netinet/sctp_output.c Wed Jul 4 20:59:30 2012 (r238122) @@ -10971,8 +10971,9 @@ sctp_send_resp_msg(struct sockaddr *src, return; } SCTP_ATTACH_CHAIN(o_pak, mout, len); + switch (dst-sa_family) { #ifdef INET - if (ip != NULL) { + case AF_INET: if (port) { if (V_udp_cksum) { udp-uh_sum = in_pseudo(ip-ip_src.s_addr, ip-ip_dst.s_addr, udp-uh_ulen + htons(IPPROTO_UDP)); @@ -11006,10 +11007,10 @@ sctp_send_resp_msg(struct sockaddr *src, } #endif SCTP_IP_OUTPUT(ret, o_pak, NULL, NULL, vrf_id); - } + break; #endif #ifdef INET6 - if (ip6 != NULL) { + case AF_INET6: ip6-ip6_plen = len - sizeof(struct ip6_hdr); if (port) { #if defined(SCTP_WITH_NO_CSUM) @@ -11036,8 +11037,15 @@ sctp_send_resp_msg(struct sockaddr *src, } #endif SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); - } + break; #endif + default: + SCTPDBG(SCTP_DEBUG_OUTPUT1, Unknown protocol (TSNH) type %d\n, + dst-sa_family); + sctp_m_freem(mout); + SCTP_LTRACE_ERR_RET_PKT(mout, NULL, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EFAULT); + return; + } SCTP_STAT_INCR(sctps_sendpackets); SCTP_STAT_INCR_COUNTER64(sctps_outpackets); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r238294 - head/sys/netinet
Author: tuexen Date: Mon Jul 9 10:59:39 2012 New Revision: 238294 URL: http://svn.freebsd.org/changeset/base/238294 Log: Fix a bug introduced in r237715. MFC after:i 3 days. Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Mon Jul 9 10:39:57 2012 (r238293) +++ head/sys/netinet/sctp_output.c Mon Jul 9 10:59:39 2012 (r238294) @@ -5520,6 +5520,7 @@ do_a_abort: case AF_INET6: { stc.addr_type = SCTP_IPV6_ADDRESS; + memcpy(stc.address, src6-sin6_addr, sizeof(struct in6_addr)); stc.scope_id = in6_getscope(src6-sin6_addr); if (sctp_is_address_on_local_host(src, vrf_id)) { stc.loopback_scope = 1; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r238454 - head/sys/netinet
Author: tuexen Date: Sat Jul 14 19:44:39 2012 New Revision: 238454 URL: http://svn.freebsd.org/changeset/base/238454 Log: Use case for selecting the address family (as in other places). MFC after: 3 days Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sat Jul 14 19:39:53 2012 (r238453) +++ head/sys/netinet/sctp_input.c Sat Jul 14 19:44:39 2012 (r238454) @@ -2874,14 +2874,12 @@ sctp_handle_cookie_echo(struct mbuf *m, return (m); } } - if ((*inp_p)-sctp_flags SCTP_PCB_FLAGS_UDPTYPE) { - if (notification) { - sctp_ulp_notify(notification, *stcb, 0, NULL, SCTP_SO_NOT_LOCKED); - } - if (send_int_conf) { - sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED, - (*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED); - } + if (notification) { + sctp_ulp_notify(notification, *stcb, 0, NULL, SCTP_SO_NOT_LOCKED); + } + if (send_int_conf) { + sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED, + (*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED); } return (m); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r238455 - head/sys/netinet
Author: tuexen Date: Sat Jul 14 20:08:03 2012 New Revision: 238455 URL: http://svn.freebsd.org/changeset/base/238455 Log: Use case for selecting the address family (as in other places). MFC after: 3 days Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Sat Jul 14 19:44:39 2012(r238454) +++ head/sys/netinet/sctp_pcb.c Sat Jul 14 20:08:03 2012(r238455) @@ -1203,11 +1203,18 @@ sctp_findassociation_ep_addr(struct sctp uint16_t rport; inp = *inp_p; - if (remote-sa_family == AF_INET) { + switch (remote-sa_family) { +#ifdef INET + case AF_INET: rport = (((struct sockaddr_in *)remote)-sin_port); - } else if (remote-sa_family == AF_INET6) { + break; +#endif +#ifdef INET6 + case AF_INET6: rport = (((struct sockaddr_in6 *)remote)-sin6_port); - } else { + break; +#endif + default: return (NULL); } if (locked_tcb) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r238454 - head/sys/netinet
On Jul 14, 2012, at 9:44 PM, Michael Tuexen wrote: Author: tuexen Date: Sat Jul 14 19:44:39 2012 New Revision: 238454 URL: http://svn.freebsd.org/changeset/base/238454 Log: Use case for selecting the address family (as in other places). Wrong commit message. It should have been: Bugfix: Send up a COMM UP notification for active 1-to-1 style sockets also in the case where the assoc comes up due to a remotely started handshake (collision case). MFC after: 3 days Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sat Jul 14 19:39:53 2012 (r238453) +++ head/sys/netinet/sctp_input.c Sat Jul 14 19:44:39 2012 (r238454) @@ -2874,14 +2874,12 @@ sctp_handle_cookie_echo(struct mbuf *m, return (m); } } - if ((*inp_p)-sctp_flags SCTP_PCB_FLAGS_UDPTYPE) { - if (notification) { - sctp_ulp_notify(notification, *stcb, 0, NULL, SCTP_SO_NOT_LOCKED); - } - if (send_int_conf) { - sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED, - (*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED); - } + if (notification) { + sctp_ulp_notify(notification, *stcb, 0, NULL, SCTP_SO_NOT_LOCKED); + } + if (send_int_conf) { + sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED, + (*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED); } return (m); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r238458 - head/sys/netinet
Author: tuexen Date: Sat Jul 14 21:25:14 2012 New Revision: 238458 URL: http://svn.freebsd.org/changeset/base/238458 Log: Provide the correct notification type (SCTP_SEND_FAILED_EVENT) for unsent messages. MFC after: 3 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Sat Jul 14 20:24:00 2012(r238457) +++ head/sys/netinet/sctputil.c Sat Jul 14 21:25:14 2012(r238458) @@ -2951,7 +2951,7 @@ sctp_notify_send_failed2(struct sctp_tcb SCTP_BUF_LEN(m_notify) = 0; if (sctp_stcb_is_feature_on(stcb-sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { ssfe = mtod(m_notify, struct sctp_send_failed_event *); - ssfe-ssfe_type = SCTP_SEND_FAILED; + ssfe-ssfe_type = SCTP_SEND_FAILED_EVENT; ssfe-ssfe_flags = SCTP_DATA_UNSENT; ssfe-ssfe_length = length; ssfe-ssfe_error = error; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r238475 - in head/sys: netinet netinet6
Author: tuexen Date: Sun Jul 15 11:04:49 2012 New Revision: 238475 URL: http://svn.freebsd.org/changeset/base/238475 Log: #ifdef INET and INET6 consistently. This also fixes a bug, where it was done wrong. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sun Jul 15 11:04:35 2012 (r238474) +++ head/sys/netinet/sctp_output.c Sun Jul 15 11:04:49 2012 (r238475) @@ -8432,12 +8432,14 @@ again_one_more_time: } /* now lets add any data within the MTU constraints */ switch (((struct sockaddr *)net-ro._l_addr)-sa_family) { +#ifdef INET case AF_INET: if (net-mtu (sizeof(struct ip) + sizeof(struct sctphdr))) omtu = net-mtu - (sizeof(struct ip) + sizeof(struct sctphdr)); else omtu = 0; break; +#endif #ifdef INET6 case AF_INET6: if (net-mtu (sizeof(struct ip6_hdr) + sizeof(struct sctphdr))) @@ -12165,7 +12167,7 @@ sctp_lower_sosend(struct socket *so, union sctp_sockstore *raddr = (union sctp_sockstore *)addr; switch (raddr-sa.sa_family) { -#if defined(INET) +#ifdef INET case AF_INET: if (raddr-sin.sin_len != sizeof(struct sockaddr_in)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); @@ -12175,7 +12177,7 @@ sctp_lower_sosend(struct socket *so, port = raddr-sin.sin_port; break; #endif -#if defined(INET6) +#ifdef INET6 case AF_INET6: if (raddr-sin6.sin6_len != sizeof(struct sockaddr_in6)) { SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EINVAL); Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Sun Jul 15 11:04:35 2012(r238474) +++ head/sys/netinet/sctp_pcb.c Sun Jul 15 11:04:49 2012(r238475) @@ -3016,6 +3016,7 @@ continue_anyway: memset(store_sa, 0, sizeof(store_sa)); switch (addr-sa_family) { +#ifdef INET case AF_INET: { struct sockaddr_in *sin; @@ -3025,6 +3026,8 @@ continue_anyway: sin-sin_port = 0; break; } +#endif +#ifdef INET6 case AF_INET6: { struct sockaddr_in6 *sin6; @@ -3034,6 +3037,7 @@ continue_anyway: sin6-sin6_port = 0; break; } +#endif default: break; } @@ -5195,12 +5199,16 @@ sctp_destination_is_reachable(struct sct } /* NOTE: all scope checks are done when local addresses are added */ switch (destaddr-sa_family) { +#ifdef INET6 case AF_INET6: answer = inp-ip_inp.inp.inp_vflag INP_IPV6; break; +#endif +#ifdef INET case AF_INET: answer = inp-ip_inp.inp.inp_vflag INP_IPV4; break; +#endif default: /* invalid family, so it's unreachable */ answer = 0; @@ -5291,7 +5299,7 @@ sctp_add_local_addr_ep(struct sctp_inpcb inp-ip_inp.inp.inp_vflag |= INP_IPV6; break; #endif -#ifdef INET6 +#ifdef INET case AF_INET: inp-ip_inp.inp.inp_vflag |= INP_IPV4; break; Modified: head/sys/netinet/sctp_usrreq.c == --- head/sys/netinet/sctp_usrreq.c Sun Jul 15 11:04:35 2012 (r238474) +++ head/sys/netinet/sctp_usrreq.c Sun Jul 15 11:04:49 2012 (r238475) @@ -38,7 +38,7 @@ __FBSDID($FreeBSD$); #include netinet/sctp_pcb.h #include netinet/sctp_header.h #include netinet/sctp_var.h -#if defined(INET6) +#ifdef INET6 #endif #include netinet/sctp_sysctl.h #include netinet/sctp_output.h Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Sun Jul 15 11:04:35 2012(r238474) +++ head/sys/netinet/sctputil.c Sun Jul 15 11:04:49 2012(r238475) @@ -5637,7 +5637,7 @@ found_one: memcpy(from, sin6, sizeof(struct
svn commit: r238501 - in head/sys: netinet netinet6
Author: tuexen Date: Sun Jul 15 20:16:17 2012 New Revision: 238501 URL: http://svn.freebsd.org/changeset/base/238501 Log: Changes which improve compilation if neither INET nor INET6 is defined. MFC after: 3 days Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Sun Jul 15 19:52:23 2012 (r238500) +++ head/sys/netinet/sctp_asconf.c Sun Jul 15 20:16:17 2012 (r238501) @@ -2747,13 +2747,14 @@ sctp_process_initack_addresses(struct sc struct sctp_paramhdr tmp_param, *ph; uint16_t plen, ptype; struct sctp_ifa *sctp_ifa; - struct sctp_ipv6addr_param addr_store; #ifdef INET6 + struct sctp_ipv6addr_param addr6_store; struct sockaddr_in6 sin6; #endif #ifdef INET + struct sctp_ipv4addr_param addr4_store; struct sockaddr_in sin; #endif @@ -2802,7 +2803,7 @@ sctp_process_initack_addresses(struct sc a6p = (struct sctp_ipv6addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv6addr_param), - (uint8_t *) addr_store); + (uint8_t *) addr6_store); if (plen != sizeof(struct sctp_ipv6addr_param) || a6p == NULL) { return; @@ -2821,7 +2822,7 @@ sctp_process_initack_addresses(struct sc /* get the entire IPv4 address param */ a4p = (struct sctp_ipv4addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), - (uint8_t *) addr_store); + (uint8_t *) addr4_store); if (plen != sizeof(struct sctp_ipv4addr_param) || a4p == NULL) { return; @@ -2899,16 +2900,17 @@ sctp_addr_in_initack(struct mbuf *m, uin { struct sctp_paramhdr tmp_param, *ph; uint16_t plen, ptype; - struct sctp_ipv6addr_param addr_store; #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *a4p; + struct sctp_ipv6addr_param addr4_store; #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *a6p; + struct sctp_ipv6addr_param addr6_store; struct sockaddr_in6 sin6_tmp; #endif @@ -2954,7 +2956,7 @@ sctp_addr_in_initack(struct mbuf *m, uin a6p = (struct sctp_ipv6addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv6addr_param), - (uint8_t *) addr_store); + (uint8_t *) addr6_store); if (a6p == NULL) { return (0); } @@ -2984,7 +2986,7 @@ sctp_addr_in_initack(struct mbuf *m, uin a4p = (struct sctp_ipv4addr_param *) sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), - (uint8_t *) addr_store); + (uint8_t *) addr4_store); if (a4p == NULL) { return (0); } Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sun Jul 15 19:52:23 2012 (r238500) +++ head/sys/netinet/sctp_output.c Sun Jul 15 20:16:17 2012 (r238501) @@ -3799,6 +3799,7 @@ sctp_get_ect(struct sctp_tcb *stcb) } } +#if defined(INET) || defined(INET6) static void sctp_handle_no_route(struct sctp_tcb *stcb, struct sctp_nets *net, @@ -3843,6 +3844,8 @@ sctp_handle_no_route(struct sctp_tcb *st } } +#endif + static int sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, struct sctp_tcb *stcb, /* may be NULL */ @@ -3882,14 +3885,18 @@ sctp_lowlevel_chunk_output(struct sctp_i * interface and smallest_mtu size as well. */ /* Will need ifdefs around this */ - struct mbuf *o_pak; struct mbuf *newm; struct sctphdr *sctphdr; int packet_length; int ret; uint32_t vrf_id; + +#if defined(INET) || defined(INET6) + struct mbuf *o_pak; sctp_route_t *ro = NULL;