summaryrefslogtreecommitdiff
path: root/slirp/bootp.c
diff options
context:
space:
mode:
authorKlaus Stengel <Klaus.Stengel@asamnet.de>2012-10-27 19:53:39 +0200
committerJan Kiszka <jan.kiszka@siemens.com>2012-11-15 10:27:14 +0100
commit63d2960bc46f63137d7fbd5ff56b81e54710d195 (patch)
treed79d96216f2bab684f153fb70e2277e8a51feaca /slirp/bootp.c
parent1a89b60885ccc2abf7cc50275fcee70d0347425e (diff)
downloadqemu-63d2960bc46f63137d7fbd5ff56b81e54710d195.tar.gz
slirp: Add domain-search option to slirp's DHCP server
This patch will allow the user to include the domain-search option in replies from the built-in DHCP server. The domain suffixes can be specified by adding dnssearch= entries to the "-net user" parameter. [Jan: tiny style adjustments] Signed-off-by: Klaus Stengel <Klaus.Stengel@asamnet.de> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Diffstat (limited to 'slirp/bootp.c')
-rw-r--r--slirp/bootp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/slirp/bootp.c b/slirp/bootp.c
index 64eac7d101..b7db9fa335 100644
--- a/slirp/bootp.c
+++ b/slirp/bootp.c
@@ -287,6 +287,18 @@ static void bootp_reply(Slirp *slirp, const struct bootp_t *bp)
memcpy(q, slirp->client_hostname, val);
q += val;
}
+
+ if (slirp->vdnssearch) {
+ size_t spaceleft = sizeof(rbp->bp_vend) - (q - rbp->bp_vend);
+ val = slirp->vdnssearch_len;
+ if (val + 1 > spaceleft) {
+ g_warning("DHCP packet size exceeded, "
+ "omitting domain-search option.");
+ } else {
+ memcpy(q, slirp->vdnssearch, val);
+ q += val;
+ }
+ }
} else {
static const char nak_msg[] = "requested address not available";