summaryrefslogtreecommitdiffstats
path: root/slirp/tcp_input.c
diff options
context:
space:
mode:
authorPeter Maydell2019-02-07 19:53:25 +0100
committerPeter Maydell2019-02-07 19:53:25 +0100
commite47f81b617684c4546af286d307b69014a83538a (patch)
tree11e4e8c6482d092d91ed9faed327f341f3cc69f8 /slirp/tcp_input.c
parentMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.0-pull-re... (diff)
parentslirp: API is extern C (diff)
downloadqemu-e47f81b617684c4546af286d307b69014a83538a.tar.gz
qemu-e47f81b617684c4546af286d307b69014a83538a.tar.xz
qemu-e47f81b617684c4546af286d307b69014a83538a.zip
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
More work towards libslirp Marc-André Lureau (27): slirp: generalize guestfwd with a callback based approach net/slirp: simplify checking for cmd: prefix net/slirp: free forwarding rules on cleanup net/slirp: fix leaks on forwarding rule registration error slirp: add callbacks for timer slirp: replace trace functions with DEBUG calls slirp: replace QEMU_PACKED with SLIRP_PACKED slirp: replace most qemu socket utilities with slirp own version slirp: replace qemu_set_nonblock() slirp: add unregister_poll_fd() callback slirp: replace qemu_notify_event() with a callback slirp: move QEMU state saving to a separate unit slirp: do not include qemu headers in libslirp.h public API header slirp: improve windows headers inclusion slirp: add slirp own version of pstrcpy slirp: remove qemu timer.h dependency slirp: remove now useless QEMU headers inclusions slirp: replace net/eth.h inclusion with own defines slirp: replace qemu qtailq with slirp own copy slirp: replace remaining qemu headers dependency slirp: prefer c99 types over BSD kind slirp: improve send_packet() callback slirp: replace global polling with per-instance & notifier slirp: remove slirp_instances list slirp: use polling callbacks, drop glib requirement slirp: pass opaque to all callbacks slirp: API is extern C Peter Maydell (2): slirp: Avoid marking naturally packed structs as QEMU_PACKED slirp: Don't mark struct ipq or struct ipasfrag as packed Samuel Thibault (3): slirp: Avoid unaligned 16bit memory access slirp: replace QEMU_BUILD_BUG_ON with G_STATIC_ASSERT slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/ # gpg: Signature made Thu 07 Feb 2019 14:02:41 GMT # gpg: using RSA key E61DBB15D4172BDEC97E92D9DB550E89F0FA54F3 # gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>" [unknown] # gpg: aka "Samuel Thibault <sthibault@debian.org>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@gnu.org>" [unknown] # gpg: aka "Samuel Thibault <samuel.thibault@inria.fr>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@labri.fr>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@ens-lyon.org>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>" [unknown] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 900C B024 B679 31D4 0F82 304B D017 8C76 7D06 9EE6 # Subkey fingerprint: E61D BB15 D417 2BDE C97E 92D9 DB55 0E89 F0FA 54F3 * remotes/thibault/tags/samuel-thibault: (32 commits) slirp: API is extern C slirp: pass opaque to all callbacks slirp: use polling callbacks, drop glib requirement slirp: remove slirp_instances list slirp: replace global polling with per-instance & notifier slirp: improve send_packet() callback slirp: prefer c99 types over BSD kind slirp: replace remaining qemu headers dependency slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/ slirp: replace QEMU_BUILD_BUG_ON with G_STATIC_ASSERT slirp: replace qemu qtailq with slirp own copy slirp: replace net/eth.h inclusion with own defines slirp: remove now useless QEMU headers inclusions slirp: remove qemu timer.h dependency slirp: add slirp own version of pstrcpy slirp: improve windows headers inclusion slirp: do not include qemu headers in libslirp.h public API header slirp: move QEMU state saving to a separate unit slirp: replace qemu_notify_event() with a callback slirp: add unregister_poll_fd() callback ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'slirp/tcp_input.c')
-rw-r--r--slirp/tcp_input.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c
index de5b74a52b..6749b32f5d 100644
--- a/slirp/tcp_input.c
+++ b/slirp/tcp_input.c
@@ -38,7 +38,6 @@
* terms and conditions of the copyright.
*/
-#include "qemu/osdep.h"
#include "slirp.h"
#include "ip_icmp.h"
@@ -77,7 +76,7 @@
} \
}
-static void tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt,
+static void tcp_dooptions(struct tcpcb *tp, uint8_t *cp, int cnt,
struct tcpiphdr *ti);
static void tcp_xmit_timer(register struct tcpcb *tp, int rtt);
@@ -198,7 +197,7 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso, unsigned short af)
struct ip save_ip, *ip;
struct ip6 save_ip6, *ip6;
register struct tcpiphdr *ti;
- caddr_t optp = NULL;
+ char *optp = NULL;
int optlen = 0;
int len, tlen, off;
register struct tcpcb *tp = NULL;
@@ -206,7 +205,7 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso, unsigned short af)
struct socket *so = NULL;
int todrop, acked, ourfinisacked, needoutput = 0;
int iss = 0;
- u_long tiwin;
+ uint32_t tiwin;
int ret;
struct sockaddr_storage lhost, fhost;
struct sockaddr_in *lhost4, *fhost4;
@@ -328,7 +327,7 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso, unsigned short af)
ti->ti_len = tlen;
if (off > sizeof (struct tcphdr)) {
optlen = off - sizeof (struct tcphdr);
- optp = mtod(m, caddr_t) + sizeof (struct tcpiphdr);
+ optp = mtod(m, char *) + sizeof (struct tcpiphdr);
}
tiflags = ti->ti_flags;
@@ -470,7 +469,7 @@ findso:
* else do it below (after getting remote address).
*/
if (optp && tp->t_state != TCPS_LISTEN)
- tcp_dooptions(tp, (u_char *)optp, optlen, ti);
+ tcp_dooptions(tp, (uint8_t *)optp, optlen, ti);
/*
* Header prediction: check for the two common cases
@@ -506,7 +505,7 @@ findso:
SEQ_GT(ti->ti_ack, tp->t_rtseq))
tcp_xmit_timer(tp, tp->t_rtt);
acked = ti->ti_ack - tp->snd_una;
- sbdrop(&so->so_snd, acked);
+ sodrop(so, acked);
tp->snd_una = ti->ti_ack;
m_free(m);
@@ -725,7 +724,7 @@ findso:
tcp_template(tp);
if (optp)
- tcp_dooptions(tp, (u_char *)optp, optlen, ti);
+ tcp_dooptions(tp, (uint8_t *)optp, optlen, ti);
if (iss)
tp->iss = iss;
@@ -1040,7 +1039,7 @@ trimthenstep6:
tp->t_dupacks = 0;
else if (++tp->t_dupacks == TCPREXMTTHRESH) {
tcp_seq onxt = tp->snd_nxt;
- u_int win =
+ unsigned win =
MIN(tp->snd_wnd, tp->snd_cwnd) /
2 / tp->t_maxseg;
@@ -1109,8 +1108,8 @@ trimthenstep6:
* (maxseg^2 / cwnd per packet).
*/
{
- register u_int cw = tp->snd_cwnd;
- register u_int incr = tp->t_maxseg;
+ register unsigned cw = tp->snd_cwnd;
+ register unsigned incr = tp->t_maxseg;
if (cw > tp->snd_ssthresh)
incr = incr * incr / cw;
@@ -1118,10 +1117,10 @@ trimthenstep6:
}
if (acked > so->so_snd.sb_cc) {
tp->snd_wnd -= so->so_snd.sb_cc;
- sbdrop(&so->so_snd, (int )so->so_snd.sb_cc);
+ sodrop(so, (int)so->so_snd.sb_cc);
ourfinisacked = 1;
} else {
- sbdrop(&so->so_snd, acked);
+ sodrop(so, acked);
tp->snd_wnd -= acked;
ourfinisacked = 0;
}
@@ -1382,7 +1381,7 @@ drop:
}
static void
-tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti)
+tcp_dooptions(struct tcpcb *tp, uint8_t *cp, int cnt, struct tcpiphdr *ti)
{
uint16_t mss;
int opt, optlen;
@@ -1512,7 +1511,7 @@ tcp_xmit_timer(register struct tcpcb *tp, int rtt)
*/
int
-tcp_mss(struct tcpcb *tp, u_int offer)
+tcp_mss(struct tcpcb *tp, unsigned offer)
{
struct socket *so = tp->t_socket;
int mss;