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>
This commit is contained in:
Jan Kiszka 2011-07-20 12:20:15 +02:00 committed by Anthony Liguori
parent c54ed5bcdd
commit 5a82362ad0
1 changed files with 8 additions and 5 deletions

View File

@ -120,15 +120,18 @@ udp_input(register struct mbuf *m, int iphlen)
/* /*
* handle DHCP/BOOTP * handle DHCP/BOOTP
*/ */
if (ntohs(uh->uh_dport) == BOOTP_SERVER) { if (ntohs(uh->uh_dport) == BOOTP_SERVER &&
bootp_input(m); (ip->ip_dst.s_addr == slirp->vhost_addr.s_addr ||
goto bad; ip->ip_dst.s_addr == 0xffffffff)) {
} bootp_input(m);
goto bad;
}
/* /*
* handle TFTP * 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); tftp_input(m);
goto bad; goto bad;
} }