summaryrefslogtreecommitdiff
path: root/slirp/udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'slirp/udp.c')
-rw-r--r--slirp/udp.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/slirp/udp.c b/slirp/udp.c
index 02b3793e9f..5b060f397b 100644
--- a/slirp/udp.c
+++ b/slirp/udp.c
@@ -120,23 +120,26 @@ udp_input(register struct mbuf *m, int iphlen)
/*
* handle DHCP/BOOTP
*/
- if (ntohs(uh->uh_dport) == BOOTP_SERVER) {
- bootp_input(m);
- goto bad;
- }
-
- if (slirp->restricted) {
- 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;
}
+ if (slirp->restricted) {
+ goto bad;
+ }
+
/*
* Locate pcb for datagram.
*/
@@ -219,7 +222,7 @@ udp_input(register struct mbuf *m, int iphlen)
return;
bad:
- m_freem(m);
+ m_free(m);
return;
}