aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-07-20 12:20:15 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2011-07-23 10:19:49 -0500
commite754e7479659c0488e5c1afbafaf458a02275dc1 (patch)
treeafced581ed19c2027f7c85e55ce01e0e0995a0dd
parent6c5f2201da4d4aa4ee1030d7a1e7f2e02fb58125 (diff)
downloadslirp-e754e7479659c0488e5c1afbafaf458a02275dc1.zip
slirp-e754e7479659c0488e5c1afbafaf458a02275dc1.tar.gz
slirp-e754e7479659c0488e5c1afbafaf458a02275dc1.tar.bz2
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>
-rw-r--r--udp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/udp.c b/udp.c
index 3ba311d..9f69c4e 100644
--- a/udp.c
+++ b/udp.c
@@ -118,7 +118,9 @@ void udp_input(register struct mbuf *m, int iphlen)
/*
* handle DHCP/BOOTP
*/
- if (ntohs(uh->uh_dport) == BOOTP_SERVER) {
+ 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;
}
@@ -126,7 +128,8 @@ void udp_input(register struct mbuf *m, int iphlen)
/*
* 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;
}