summaryrefslogtreecommitdiffstats
path: root/slirp
diff options
context:
space:
mode:
authorJan Kiszka2011-07-20 12:20:15 +0200
committerAnthony Liguori2011-07-23 17:19:49 +0200
commit5a82362ad0bf06bba3377d63ca0ecd05fb74f322 (patch)
tree86848ea69e666e4b29ba2541720207eb3fab4518 /slirp
parentslirp: Canonicalize restrict syntax (diff)
downloadqemu-5a82362ad0bf06bba3377d63ca0ecd05fb74f322.tar.gz
qemu-5a82362ad0bf06bba3377d63ca0ecd05fb74f322.tar.xz
qemu-5a82362ad0bf06bba3377d63ca0ecd05fb74f322.zip
slirp: Strictly associate DHCP/BOOTP and TFTP with virtual host
Instead of accepting every DHCP/BOOTP and TFTP packet, only invoke the built-in servers if the target is the virtual host. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'slirp')
-rw-r--r--slirp/udp.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/slirp/udp.c b/slirp/udp.c
index f1a9a10948..cefd50b792 100644
--- a/slirp/udp.c
+++ b/slirp/udp.c
@@ -120,15 +120,18 @@ udp_input(register struct mbuf *m, int iphlen)
/*
* handle DHCP/BOOTP
*/
- if (ntohs(uh->uh_dport) == BOOTP_SERVER) {
- bootp_input(m);
- goto bad;
- }
+ if (ntohs(uh->uh_dport) == BOOTP_SERVER &&
+ (ip->ip_dst.s_addr == slirp->vhost_addr.s_addr ||
+ ip->ip_dst.s_addr == 0xffffffff)) {
+ bootp_input(m);
+ goto bad;
+ }
/*
* handle TFTP
*/
- if (ntohs(uh->uh_dport) == TFTP_SERVER) {
+ if (ntohs(uh->uh_dport) == TFTP_SERVER &&
+ ip->ip_dst.s_addr == slirp->vhost_addr.s_addr) {
tftp_input(m);
goto bad;
}