diff --git a/src/add-ons/kernel/network/protocols/tcp/arc4random.c b/src/add-ons/kernel/network/protocols/tcp/arc4random.c index 9b3514a5ab..368d70dd91 100644 --- a/src/add-ons/kernel/network/protocols/tcp/arc4random.c +++ b/src/add-ons/kernel/network/protocols/tcp/arc4random.c @@ -45,6 +45,11 @@ struct arc4_stream { int rs_initialized; static struct arc4_stream rs; +void arc4random_stir(void); +void arc4random_addrandom(u_char *dat, int datlen); +uint32 arc4random(void); + + static inline void arc4_init(struct arc4_stream *as) { @@ -138,7 +143,7 @@ void arc4random_addrandom(u_char *dat, int datlen) } -uint32 arc4random() +uint32 arc4random(void) { if (!rs_initialized) arc4random_stir(); diff --git a/src/add-ons/kernel/network/protocols/tcp/tcp_input.c b/src/add-ons/kernel/network/protocols/tcp/tcp_input.c index 8ccd4010b8..9f62c5452b 100644 --- a/src/add-ons/kernel/network/protocols/tcp/tcp_input.c +++ b/src/add-ons/kernel/network/protocols/tcp/tcp_input.c @@ -139,6 +139,9 @@ extern uint32 sb_max; }\ } +int tcp_reass(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m); + + /* * Insert segment ti into reassembly queue of tcp with * control block tp. Return TH_FIN if reassembly now includes @@ -340,7 +343,7 @@ void tcp_input(struct mbuf *m, int iphlen) */ ti = mtod(m, struct tcpiphdr*); - if (iphlen > sizeof(struct ip)) + if (iphlen > (int) sizeof(struct ip)) ipm->ip_stripoptions(m, NULL); if (m->m_len < sizeof(struct tcpiphdr)) { @@ -368,7 +371,7 @@ void tcp_input(struct mbuf *m, int iphlen) } off = ti->ti_off << 2; - if (off < sizeof(struct tcphdr) || off > tlen) { + if (off < (int) sizeof(struct tcphdr) || off > tlen) { tcpstat.tcps_rcvbadoff++; printf("tcp_input: bad len\n"); goto drop; @@ -377,7 +380,7 @@ void tcp_input(struct mbuf *m, int iphlen) tlen -=off; ti->ti_len = tlen; - if (off > sizeof(struct tcphdr)) { + if (off > (int) sizeof(struct tcphdr)) { if (m->m_len < sizeof(struct ip) + off) { if ((m = m_pullup(m, sizeof(struct ip) + off)) == NULL) { tcpstat.tcps_rcvshort++; @@ -1164,7 +1167,7 @@ close: if (cw > tp->snd_ssthresh) incr = incr * incr / cw + incr / 8; - tp->snd_cwnd = min(cw + incr, TCP_MAXWIN << tp->snd_scale); + tp->snd_cwnd = min((int) (cw + incr), TCP_MAXWIN << tp->snd_scale); } if (acked > so->so_snd.sb_cc) { tp->snd_wnd -= so->so_snd.sb_cc; @@ -1275,7 +1278,7 @@ step6: * soreceive. It's hard to imagine someone * actually wanting to send this much urgent data. */ - if (ti->ti_urp + so->so_rcv.sb_cc > sb_max) { + if (ti->ti_urp + so->so_rcv.sb_cc > (int) sb_max) { ti->ti_urp = 0; /* XXX */ tiflags &= ~TH_URG; /* XXX */ goto dodata; /* XXX */ @@ -1526,7 +1529,7 @@ void tcp_pulloutofband(struct socket *so, struct tcpiphdr *ti, struct mbuf *m) int cnt = ti->ti_urp - 1; while (cnt >= 0) { - if (m->m_len > cnt) { + if ((int) m->m_len > cnt) { char *cp = mtod(m, caddr_t) + cnt; struct tcpcb *tp = sototcpcb(so); @@ -1683,7 +1686,7 @@ void tcp_mss_update(struct tcpcb *tp) if ((bufsize = rt->rt_rmx.rmx_sendpipe) == 0) #endif bufsize = so->so_snd.sb_hiwat; - if (bufsize < mss) { + if ((int) bufsize < mss) { mss = bufsize; /* Update t_maxseg and t_maxopd */ tcp_mss(tp, mss); @@ -1698,7 +1701,7 @@ void tcp_mss_update(struct tcpcb *tp) if ((bufsize = rt->rt_rmx.rmx_recvpipe) == 0) #endif bufsize = so->so_rcv.sb_hiwat; - if (bufsize > mss) { + if ((int) bufsize > mss) { bufsize = roundup(bufsize, mss); if (bufsize > sb_max) bufsize = sb_max; @@ -1722,7 +1725,7 @@ void tcp_mss_update(struct tcpcb *tp) * the slow start threshhold, but set the * threshold to no less than 2*mss. */ - tp->snd_ssthresh = max(2 * mss, rt->rt_rmx.rmx_ssthresh); + tp->snd_ssthresh = max(2 * mss, (int) rt->rt_rmx.rmx_ssthresh); } #endif /* RTV_MTU */ } diff --git a/src/add-ons/kernel/network/protocols/tcp/tcp_output.c b/src/add-ons/kernel/network/protocols/tcp/tcp_output.c index 5af7e8a8eb..f80da2f430 100644 --- a/src/add-ons/kernel/network/protocols/tcp/tcp_output.c +++ b/src/add-ons/kernel/network/protocols/tcp/tcp_output.c @@ -110,13 +110,13 @@ else } if (offer) - mss = min(mss, offer); + mss = min(mss, (int) offer); mss = max(mss, 32); if (mss < tp->t_maxseg || offer != 0) { if ((bufsize = rt->rt_rmx.rmx_sendpipe) == 0) bufsize = so->so_snd.sb_hiwat; - if (bufsize < mss) + if ((int) bufsize < mss) mss = bufsize; else { bufsize = roundup(bufsize, mss); @@ -128,7 +128,7 @@ else if ((bufsize = rt->rt_rmx.rmx_recvpipe) == 0) bufsize = so->so_rcv.sb_hiwat; - if (bufsize > mss) { + if ((int) bufsize > mss) { bufsize = roundup(bufsize, mss); if (bufsize > sb_max) bufsize = sb_max; @@ -137,7 +137,7 @@ else } tp->snd_cwnd = mss; if (rt->rt_rmx.rmx_ssthresh) { - tp->snd_ssthresh = max(2 * mss, rt->rt_rmx.rmx_ssthresh); + tp->snd_ssthresh = max(2 * mss, (int) rt->rt_rmx.rmx_ssthresh); } return mss; } @@ -225,7 +225,7 @@ again: goto send; if (tp->t_force) goto send; - if (len >= tp->max_sndwnd / 2) + if (len >= (int) tp->max_sndwnd / 2) goto send; if (SEQ_LT(tp->snd_nxt, tp->snd_max)) goto send; @@ -235,7 +235,7 @@ again: (tp->rcv_adv - tp->rcv_nxt); if (adv >= (int32)(2 * tp->t_maxseg)) goto send; - if (2 * adv >= (int32)so->so_rcv.sb_hiwat) + if (2 * adv >= (int32) so->so_rcv.sb_hiwat) goto send; } if (tp->t_flags & TF_ACKNOW) @@ -294,7 +294,7 @@ send: } hdrlen += optlen; - if (len > tp->t_maxseg - optlen) { + if (len > (int) (tp->t_maxseg - optlen)) { len = tp->t_maxseg - optlen; sendalot = 1; } @@ -317,7 +317,7 @@ send: } m->m_data += get_max_linkhdr(); m->m_len = hdrlen; - if (len <= MHLEN - hdrlen - get_max_linkhdr()) { + if (len <= (int) (MHLEN - hdrlen - get_max_linkhdr())) { m_copydata(so->so_snd.sb_mb, off, (int)len, mtod(m, caddr_t) + hdrlen); m->m_len += len; } else {