Skip to content

Commit 8c4db8e

Browse files
committed
vendor libslirp@76462e2f16c6fce6856fb914cbef6207d0be4bc5
https://gitlab.freedesktop.org/slirp/libslirp/compare/30804efc8f80f43d415057f3099c2894b0f947c4...76462e2f16c6fce6856fb914cbef6207d0be4bc5 Now the legacy `tcp_emu()` is disabled Signed-off-by: Akihiro Suda <[email protected]>
1 parent ed51817 commit 8c4db8e

File tree

9 files changed

+24
-30
lines changed

9 files changed

+24
-30
lines changed

vendor.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -eux -o pipefail
3-
# Aug 1, 2019
4-
LIBSLIRP_COMMIT=30804efc8f80f43d415057f3099c2894b0f947c4
3+
# Aug 2, 2019
4+
LIBSLIRP_COMMIT=76462e2f16c6fce6856fb914cbef6207d0be4bc5
55
LIBSLIRP_REPO=https://gitlab.freedesktop.org/slirp/libslirp.git
66

77
# Jul 12, 2019

vendor/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# DO NOT EDIT MANUALLY
22

33
Vendored components:
4-
* libslirp: https://gitlab.freedesktop.org/slirp/libslirp.git (`30804efc8f80f43d415057f3099c2894b0f947c4`)
4+
* libslirp: https://gitlab.freedesktop.org/slirp/libslirp.git (`76462e2f16c6fce6856fb914cbef6207d0be4bc5`)
55
* parson: https://github.com/kgabis/parson.git (`c5bb9557fe98367aa8e041c65863909f12ee76b2`)
66

77
Please do not edit the contents under this directory manually.

vendor/libslirp/src/bootp.c

+4-6
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,12 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp)
350350
q += sizeof(nak_msg) - 1;
351351
}
352352
assert(q < end);
353-
*q =
354-
RFC1533_END
355-
;
353+
*q = RFC1533_END;
356354

357-
daddr.sin_addr.s_addr = 0xffffffffu;
355+
daddr.sin_addr.s_addr = 0xffffffffu;
358356

359-
m->m_len = sizeof(struct bootp_t) - sizeof(struct ip) - sizeof(struct udphdr);
360-
udp_output(NULL, m, &saddr, &daddr, IPTOS_LOWDELAY);
357+
m->m_len = sizeof(struct bootp_t) - sizeof(struct ip) - sizeof(struct udphdr);
358+
udp_output(NULL, m, &saddr, &daddr, IPTOS_LOWDELAY);
361359
}
362360

363361
void bootp_input(struct mbuf *m)

vendor/libslirp/src/ip_input.c

+4-5
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,10 @@ static struct ip *ip_reass(Slirp *slirp, struct ip *ip, struct ipq *fp)
344344
q = fp->frag_link.next;
345345

346346
/*
347-
* If the fragments concatenated to an mbuf that's
348-
* bigger than the total size of the fragment, then and
349-
* m_ext buffer was alloced. But fp->ipq_next points to
350-
* the old buffer (in the mbuf), so we must point ip
351-
* into the new buffer.
347+
* If the fragments concatenated to an mbuf that's bigger than the total
348+
* size of the fragment and the mbuf was not already using an m_ext buffer,
349+
* then an m_ext buffer was alloced. But fp->ipq_next points to the old
350+
* buffer (in the mbuf), so we must point ip into the new buffer.
352351
*/
353352
if (!was_ext && m->m_flags & M_EXT) {
354353
int delta = (char *)q - m->m_dat;

vendor/libslirp/src/libslirp.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ typedef struct SlirpCb {
7070
#define SLIRP_CONFIG_VERSION_MAX 1
7171

7272
typedef struct SlirpConfig {
73-
/* Version must be already provided */
73+
/* Version must be provided */
7474
uint32_t version;
7575
/*
7676
* Fields introduced in SlirpConfig version 1 begin
@@ -99,6 +99,11 @@ typedef struct SlirpConfig {
9999
size_t if_mru;
100100
/* Prohibit connecting to 127.0.0.1:* */
101101
bool disable_host_loopback;
102+
/*
103+
* Enable emulation code (*warning*: this code isn't safe, it is not
104+
* recommended to enable it)
105+
*/
106+
bool enable_emu;
102107
/*
103108
* Fields introduced in SlirpConfig version 2 begin
104109
*/

vendor/libslirp/src/slirp.c

+1
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ Slirp *slirp_new(const SlirpConfig *cfg, const SlirpCb *callbacks, void *opaque)
321321
slirp->if_mtu = cfg->if_mtu == 0 ? IF_MTU_DEFAULT : cfg->if_mtu;
322322
slirp->if_mru = cfg->if_mru == 0 ? IF_MRU_DEFAULT : cfg->if_mru;
323323
slirp->disable_host_loopback = cfg->disable_host_loopback;
324+
slirp->enable_emu = cfg->enable_emu;
324325

325326
return slirp;
326327
}

vendor/libslirp/src/slirp.h

+2
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ struct Slirp {
195195
GRand *grand;
196196
void *ra_timer;
197197

198+
bool enable_emu;
199+
198200
const SlirpCb *cb;
199201
void *opaque;
200202
};

vendor/libslirp/src/tcp_subr.c

+2-14
Original file line numberDiff line numberDiff line change
@@ -556,34 +556,22 @@ static const struct tos_t tcptos[] = {
556556
{ 0, 0, 0, 0 }
557557
};
558558

559-
static struct emu_t *tcpemu = NULL;
560-
561559
/*
562560
* Return TOS according to the above table
563561
*/
564562
uint8_t tcp_tos(struct socket *so)
565563
{
566564
int i = 0;
567-
struct emu_t *emup;
568565

569566
while (tcptos[i].tos) {
570567
if ((tcptos[i].fport && (ntohs(so->so_fport) == tcptos[i].fport)) ||
571568
(tcptos[i].lport && (ntohs(so->so_lport) == tcptos[i].lport))) {
572-
so->so_emu = tcptos[i].emu;
569+
if (so->slirp->enable_emu)
570+
so->so_emu = tcptos[i].emu;
573571
return tcptos[i].tos;
574572
}
575573
i++;
576574
}
577-
578-
/* Nope, lets see if there's a user-added one */
579-
for (emup = tcpemu; emup; emup = emup->next) {
580-
if ((emup->fport && (ntohs(so->so_fport) == emup->fport)) ||
581-
(emup->lport && (ntohs(so->so_lport) == emup->lport))) {
582-
so->so_emu = emup->emu;
583-
return emup->tos;
584-
}
585-
}
586-
587575
return 0;
588576
}
589577

vendor/libslirp/src/udp.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ static uint8_t udp_tos(struct socket *so)
302302
while (udptos[i].tos) {
303303
if ((udptos[i].fport && ntohs(so->so_fport) == udptos[i].fport) ||
304304
(udptos[i].lport && ntohs(so->so_lport) == udptos[i].lport)) {
305-
so->so_emu = udptos[i].emu;
305+
if (so->slirp->enable_emu)
306+
so->so_emu = udptos[i].emu;
306307
return udptos[i].tos;
307308
}
308309
i++;

0 commit comments

Comments
 (0)