From a490cf2e7ef9d2e524f85d9cde3d5c8318409542 Mon Sep 17 00:00:00 2001 From: rrs Date: Tue, 20 May 2008 09:51:36 +0000 Subject: - Define changes in sctp.h - Bug in CA that does not get us incrementing the PBA properly which made us more conservative. - comment updated in sctp_input.c - memsets added before we log - added arg to hmac id's MFC after: 2 weeks --- sys/netinet/sctp.h | 12 ++++++---- sys/netinet/sctp_cc_functions.c | 51 +++++++++++------------------------------ sys/netinet/sctp_input.c | 10 +++++++- sys/netinet/sctp_uio.h | 1 + sys/netinet/sctputil.c | 5 ++++ 5 files changed, 35 insertions(+), 44 deletions(-) (limited to 'sys/netinet') diff --git a/sys/netinet/sctp.h b/sys/netinet/sctp.h index ad5e84c..959865e 100644 --- a/sys/netinet/sctp.h +++ b/sys/netinet/sctp.h @@ -436,12 +436,13 @@ __attribute__((packed)); #define SCTP_PCB_FLAGS_WAKEOUTPUT 0x01000000 #define SCTP_PCB_FLAGS_WAKEINPUT 0x02000000 #define SCTP_PCB_FLAGS_BOUND_V6 0x04000000 -#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4 0x08000000 -#define SCTP_PCB_FLAGS_BLOCKING_IO 0x10000000 -#define SCTP_PCB_FLAGS_SOCKET_GONE 0x20000000 -#define SCTP_PCB_FLAGS_SOCKET_ALLGONE 0x40000000 +#define SCTP_PCB_FLAGS_BLOCKING_IO 0x08000000 +#define SCTP_PCB_FLAGS_SOCKET_GONE 0x10000000 +#define SCTP_PCB_FLAGS_SOCKET_ALLGONE 0x20000000 /* flags to copy to new PCB */ -#define SCTP_PCB_COPY_FLAGS 0x0e000004 +#define SCTP_PCB_COPY_FLAGS (SCTP_PCB_FLAGS_BOUNDALL|\ + SCTP_PCB_FLAGS_WAKEINPUT|\ + SCTP_PCB_FLAGS_BOUND_V6) /* @@ -470,6 +471,7 @@ __attribute__((packed)); #define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x00080000 #define SCTP_PCB_FLAGS_NO_FRAGMENT 0x00100000 #define SCTP_PCB_FLAGS_EXPLICIT_EOR 0x00400000 +#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4 0x00800000 /*- * mobility_features parameters (by micchie).Note diff --git a/sys/netinet/sctp_cc_functions.c b/sys/netinet/sctp_cc_functions.c index 90a809c..3e22a54 100644 --- a/sys/netinet/sctp_cc_functions.c +++ b/sys/netinet/sctp_cc_functions.c @@ -304,50 +304,25 @@ sctp_cwnd_update_after_sack(struct sctp_tcb *stcb, } } else { /* We are in congestion avoidance */ - if (net->flight_size + net->net_ack >= - net->cwnd) { - /* - * add to pba only if we had a - * cwnd's worth (or so) in flight OR - * the burst limit was applied. - */ - net->partial_bytes_acked += - net->net_ack; - - /* - * Do we need to increase (if pba is - * > cwnd)? - */ - if (net->partial_bytes_acked >= - net->cwnd) { - if (net->cwnd < - net->partial_bytes_acked) { - net->partial_bytes_acked -= - net->cwnd; - } else { - net->partial_bytes_acked = - 0; - } - net->cwnd += net->mtu; - if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) { - sctp_log_cwnd(stcb, net, net->mtu, - SCTP_CWND_LOG_FROM_CA); - } - } else { - if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) { - sctp_log_cwnd(stcb, net, net->net_ack, - SCTP_CWND_LOG_NOADV_CA); - } + /* + * Add to pba + */ + net->partial_bytes_acked += + net->net_ack; + + if ((net->flight_size + net->net_ack >= net->cwnd) && + (net->partial_bytes_acked >= net->cwnd)) { + net->partial_bytes_acked -= net->cwnd; + net->cwnd += net->mtu; + if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) { + sctp_log_cwnd(stcb, net, net->mtu, + SCTP_CWND_LOG_FROM_CA); } } else { - unsigned int dif; - if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) { sctp_log_cwnd(stcb, net, net->net_ack, SCTP_CWND_LOG_NOADV_CA); } - dif = net->cwnd - (net->flight_size + - net->net_ack); } } } else { diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 1602459..4c515f6 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -102,7 +102,15 @@ sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, inp->sctp_socket->so_qlimit); /* * FIX ME ?? What about TCP model and we have a - * match/restart case? + * match/restart case? Actually no fix is needed. the lookup + * will always find the existing assoc so stcb would not be + * NULL. It may be questionable to do this since we COULD + * just send back the INIT-ACK and hope that the app did + * accept()'s by the time the COOKIE was sent. But there is + * a price to pay for COOKIE generation and I don't want to + * pay it on the chance that the app will actually do some + * accepts(). The App just looses and should NOT be in this + * state :-) */ sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, vrf_id); diff --git a/sys/netinet/sctp_uio.h b/sys/netinet/sctp_uio.h index ef6942b..a04c14d 100644 --- a/sys/netinet/sctp_uio.h +++ b/sys/netinet/sctp_uio.h @@ -507,6 +507,7 @@ struct sctp_authkey { /* SCTP_HMAC_IDENT */ struct sctp_hmacalgo { + uint32_t shmac_number_of_idents; uint16_t shmac_idents[0]; }; diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index ac7c51a..aab1510 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -110,6 +110,7 @@ rto_logging(struct sctp_nets *net, int from) { struct sctp_cwnd_log sctp_clog; + memset(&sctp_clog, 0, sizeof(sctp_clog)); sctp_clog.x.rto.net = (void *)net; sctp_clog.x.rto.rtt = net->prev_rtt; SCTP_CTR6(KTR_SCTP, "SCTP:%d[%d]:%x-%x-%x-%x", @@ -187,6 +188,7 @@ sctp_log_map(uint32_t map, uint32_t cum, uint32_t high, int from) { struct sctp_cwnd_log sctp_clog; + memset(&sctp_clog, 0, sizeof(sctp_clog)); sctp_clog.x.map.base = map; sctp_clog.x.map.cum = cum; sctp_clog.x.map.high = high; @@ -205,6 +207,7 @@ sctp_log_fr(uint32_t biggest_tsn, uint32_t biggest_new_tsn, uint32_t tsn, { struct sctp_cwnd_log sctp_clog; + memset(&sctp_clog, 0, sizeof(sctp_clog)); sctp_clog.x.fr.largest_tsn = biggest_tsn; sctp_clog.x.fr.largest_new_tsn = biggest_new_tsn; sctp_clog.x.fr.tsn = tsn; @@ -317,6 +320,7 @@ sctp_log_lock(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint8_t from) { struct sctp_cwnd_log sctp_clog; + memset(&sctp_clog, 0, sizeof(sctp_clog)); if (inp) { sctp_clog.x.lock.sock = (void *)inp->sctp_socket; @@ -361,6 +365,7 @@ sctp_log_maxburst(struct sctp_tcb *stcb, struct sctp_nets *net, int error, int b { struct sctp_cwnd_log sctp_clog; + memset(&sctp_clog, 0, sizeof(sctp_clog)); sctp_clog.x.cwnd.net = net; sctp_clog.x.cwnd.cwnd_new_value = error; sctp_clog.x.cwnd.inflight = net->flight_size; -- cgit v1.1