Merge remote-tracking branch 'kiszka/queues/slirp' into staging
* kiszka/queues/slirp: slirp: Prevent sending ICMP error replies to source-only addresses slirp: Remove unused variable and unused code
This commit is contained in:
commit
006c891fc9
@ -262,6 +262,11 @@ icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
|
|||||||
#endif
|
#endif
|
||||||
if(ip->ip_off & IP_OFFMASK) goto end_error; /* Only reply to fragment 0 */
|
if(ip->ip_off & IP_OFFMASK) goto end_error; /* Only reply to fragment 0 */
|
||||||
|
|
||||||
|
/* Do not reply to source-only IPs */
|
||||||
|
if ((ip->ip_src.s_addr & htonl(~(0xf << 28))) == 0) {
|
||||||
|
goto end_error;
|
||||||
|
}
|
||||||
|
|
||||||
shlen=ip->ip_hl << 2;
|
shlen=ip->ip_hl << 2;
|
||||||
s_ip_len=ip->ip_len;
|
s_ip_len=ip->ip_len;
|
||||||
if(ip->ip_p == IPPROTO_ICMP) {
|
if(ip->ip_p == IPPROTO_ICMP) {
|
||||||
|
19
slirp/misc.c
19
slirp/misc.c
@ -113,7 +113,6 @@ fork_exec(struct socket *so, const char *ex, int do_pty)
|
|||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
socklen_t addrlen = sizeof(addr);
|
socklen_t addrlen = sizeof(addr);
|
||||||
int opt;
|
int opt;
|
||||||
int master = -1;
|
|
||||||
const char *argv[256];
|
const char *argv[256];
|
||||||
/* don't want to clobber the original */
|
/* don't want to clobber the original */
|
||||||
char *bptr;
|
char *bptr;
|
||||||
@ -148,20 +147,12 @@ fork_exec(struct socket *so, const char *ex, int do_pty)
|
|||||||
case -1:
|
case -1:
|
||||||
lprint("Error: fork failed: %s\n", strerror(errno));
|
lprint("Error: fork failed: %s\n", strerror(errno));
|
||||||
close(s);
|
close(s);
|
||||||
if (do_pty == 2)
|
|
||||||
close(master);
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
setsid();
|
setsid();
|
||||||
|
|
||||||
/* Set the DISPLAY */
|
/* Set the DISPLAY */
|
||||||
if (do_pty == 2) {
|
|
||||||
(void) close(master);
|
|
||||||
#ifdef TIOCSCTTY /* XXXXX */
|
|
||||||
ioctl(s, TIOCSCTTY, (char *)NULL);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
getsockname(s, (struct sockaddr *)&addr, &addrlen);
|
getsockname(s, (struct sockaddr *)&addr, &addrlen);
|
||||||
close(s);
|
close(s);
|
||||||
/*
|
/*
|
||||||
@ -173,7 +164,6 @@ fork_exec(struct socket *so, const char *ex, int do_pty)
|
|||||||
do {
|
do {
|
||||||
ret = connect(s, (struct sockaddr *)&addr, addrlen);
|
ret = connect(s, (struct sockaddr *)&addr, addrlen);
|
||||||
} while (ret < 0 && errno == EINTR);
|
} while (ret < 0 && errno == EINTR);
|
||||||
}
|
|
||||||
|
|
||||||
dup2(s, 0);
|
dup2(s, 0);
|
||||||
dup2(s, 1);
|
dup2(s, 1);
|
||||||
@ -210,10 +200,6 @@ fork_exec(struct socket *so, const char *ex, int do_pty)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
qemu_add_child_watch(pid);
|
qemu_add_child_watch(pid);
|
||||||
if (do_pty == 2) {
|
|
||||||
close(s);
|
|
||||||
so->s = master;
|
|
||||||
} else {
|
|
||||||
/*
|
/*
|
||||||
* XXX this could block us...
|
* XXX this could block us...
|
||||||
* XXX Should set a timer here, and if accept() doesn't
|
* XXX Should set a timer here, and if accept() doesn't
|
||||||
@ -226,10 +212,9 @@ fork_exec(struct socket *so, const char *ex, int do_pty)
|
|||||||
} while (so->s < 0 && errno == EINTR);
|
} while (so->s < 0 && errno == EINTR);
|
||||||
closesocket(s);
|
closesocket(s);
|
||||||
opt = 1;
|
opt = 1;
|
||||||
setsockopt(so->s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int));
|
setsockopt(so->s, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(int));
|
||||||
opt = 1;
|
opt = 1;
|
||||||
setsockopt(so->s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int));
|
setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, (char *)&opt, sizeof(int));
|
||||||
}
|
|
||||||
fd_nonblock(so->s);
|
fd_nonblock(so->s);
|
||||||
|
|
||||||
/* Append the telnet options now */
|
/* Append the telnet options now */
|
||||||
|
Loading…
Reference in New Issue
Block a user