diff options
author | Thomas Huth <thuth@redhat.com> | 2016-06-28 12:48:31 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-07-03 23:59:42 +0200 |
commit | 7b143999f2fbbd576d60a180add163966634fca6 (patch) | |
tree | bc6689a703b2b8fcf116ae03741f52b82890c941 /slirp/udp6.c | |
parent | e5857062a61de50e4d9249edfff3c222f8aca113 (diff) |
slirp: Add support for stateless DHCPv6
Provide basic support for stateless DHCPv6 (see RFC 3736) so
that guests can also automatically boot via IPv6 with SLIRP
(for IPv6 network booting, see RFC 5970 for details).
Tested with:
qemu-system-ppc64 -nographic -vga none -boot n -net nic \
-net user,ipv6=yes,ipv4=no,tftp=/path/to/tftp,bootfile=ppc64.img
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/udp6.c')
-rw-r--r-- | slirp/udp6.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/slirp/udp6.c b/slirp/udp6.c index 94efb13240..9fa314bc2d 100644 --- a/slirp/udp6.c +++ b/slirp/udp6.c @@ -7,6 +7,7 @@ #include "qemu-common.h" #include "slirp.h" #include "udp.h" +#include "dhcpv6.h" void udp6_input(struct mbuf *m) { @@ -61,7 +62,17 @@ void udp6_input(struct mbuf *m) lhost.sin6_addr = ip->ip_src; lhost.sin6_port = uh->uh_sport; - /* TODO handle DHCP/BOOTP */ + /* handle DHCPv6 */ + if (ntohs(uh->uh_dport) == DHCPV6_SERVER_PORT && + (in6_equal(&ip->ip_dst, &slirp->vhost_addr6) || + in6_equal(&ip->ip_dst, &(struct in6_addr)ALLDHCP_MULTICAST))) { + m->m_data += iphlen; + m->m_len -= iphlen; + dhcpv6_input(&lhost, m); + m->m_data -= iphlen; + m->m_len += iphlen; + goto bad; + } /* handle TFTP */ if (ntohs(uh->uh_dport) == TFTP_SERVER && |