diff -Nru qemu-2.11+dfsg/debian/changelog qemu-2.11+dfsg/debian/changelog --- qemu-2.11+dfsg/debian/changelog 2018-03-07 07:08:30.000000000 +0000 +++ qemu-2.11+dfsg/debian/changelog 2018-03-22 09:32:33.000000000 +0000 @@ -1,3 +1,10 @@ +qemu (1:2.11+dfsg-1ubuntu5) bionic; urgency=medium + + * Revert the slirp changes of 1:2.11+dfsg-1ubuntu3 until they are upstream + accepted to be better long term maintainable (LP: #1753938) + + -- Christian Ehrhardt Thu, 22 Mar 2018 10:31:23 +0100 + qemu (1:2.11+dfsg-1ubuntu4) bionic; urgency=medium * d/p/ubuntu/define-ubuntu-machine-types.patch: Disable HTM feature for diff -Nru qemu-2.11+dfsg/debian/patches/series qemu-2.11+dfsg/debian/patches/series --- qemu-2.11+dfsg/debian/patches/series 2018-03-06 20:39:41.000000000 +0000 +++ qemu-2.11+dfsg/debian/patches/series 2018-03-22 09:30:51.000000000 +0000 @@ -9,6 +9,4 @@ ubuntu/guest-agent-freeze-hook-skip-dpkg-artifacts.patch ubuntu/partial-SLOF-for-s390x-netboot-compilation.patch ubuntu/pre-bionic-256k-ipxe-efi-roms.patch -ubuntu/0001-slirp-Add-domainname-option-to-slirp-s-DHCP-server.patch -ubuntu/0002-slirp-Add-classless-static-routes-support-to-DHCP-se.patch ubuntu/lp1753826-memfd-fix-configure-test.patch diff -Nru qemu-2.11+dfsg/debian/patches/ubuntu/0001-slirp-Add-domainname-option-to-slirp-s-DHCP-server.patch qemu-2.11+dfsg/debian/patches/ubuntu/0001-slirp-Add-domainname-option-to-slirp-s-DHCP-server.patch --- qemu-2.11+dfsg/debian/patches/ubuntu/0001-slirp-Add-domainname-option-to-slirp-s-DHCP-server.patch 2018-03-06 20:34:49.000000000 +0000 +++ qemu-2.11+dfsg/debian/patches/ubuntu/0001-slirp-Add-domainname-option-to-slirp-s-DHCP-server.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,169 +0,0 @@ -From 5c919f729ee6294b86b13f85a483e48b893ce523 Mon Sep 17 00:00:00 2001 -From: Benjamin Drung -Date: Mon, 26 Feb 2018 16:38:46 +0100 -Subject: [PATCH 1/2 v4] slirp: Add domainname option to slirp's DHCP server - -This patch will allow the user to include the domainname option in -replies from the built-in DHCP server. - -Signed-off-by: Benjamin Drung ---- - net/slirp.c | 12 +++++++++--- - qapi/net.json | 4 ++++ - qemu-options.hx | 7 +++++-- - slirp/bootp.c | 8 ++++++++ - slirp/libslirp.h | 2 +- - slirp/slirp.c | 4 +++- - slirp/slirp.h | 1 + - 7 files changed, 31 insertions(+), 7 deletions(-) - ---- a/net/slirp.c -+++ b/net/slirp.c -@@ -155,7 +155,8 @@ - const char *bootfile, const char *vdhcp_start, - const char *vnameserver, const char *vnameserver6, - const char *smb_export, const char *vsmbserver, -- const char **dnssearch, Error **errp) -+ const char **dnssearch, const char *vdomainname, -+ Error **errp) - { - /* default settings according to historic slirp */ - struct in_addr net = { .s_addr = htonl(0x0a000200) }; /* 10.0.2.0 */ -@@ -357,6 +358,11 @@ - ip6_dns.s6_addr[15] |= 3; - } - -+ if (vdomainname && !*vdomainname) { -+ error_setg(errp, "'domainname' parameter cannot be empty"); -+ return -1; -+ } -+ - - nc = qemu_new_net_client(&net_slirp_info, peer, model, name); - -@@ -369,7 +375,7 @@ - s->slirp = slirp_init(restricted, ipv4, net, mask, host, - ipv6, ip6_prefix, vprefix6_len, ip6_host, - vhostname, tftp_export, bootfile, dhcp, -- dns, ip6_dns, dnssearch, s); -+ dns, ip6_dns, dnssearch, vdomainname, s); - QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry); - - for (config = slirp_configs; config; config = config->next) { -@@ -943,7 +949,7 @@ - user->ipv6_host, user->hostname, user->tftp, - user->bootfile, user->dhcpstart, - user->dns, user->ipv6_dns, user->smb, -- user->smbserver, dnssearch, errp); -+ user->smbserver, dnssearch, user->domainname, errp); - - while (slirp_configs) { - config = slirp_configs; ---- a/qapi/net.json -+++ b/qapi/net.json -@@ -160,6 +160,9 @@ - # @dnssearch: list of DNS suffixes to search, passed as DHCP option - # to the guest - # -+# @domainname: guest-visible domain name of the virtual nameserver -+# (since 2.12) -+# - # @ipv6-prefix: IPv6 network prefix (default is fec0::) (since - # 2.6). The network prefix is given in the usual - # hexadecimal IPv6 address notation. -@@ -197,6 +200,7 @@ - '*dhcpstart': 'str', - '*dns': 'str', - '*dnssearch': ['String'], -+ '*domainname': 'str', - '*ipv6-prefix': 'str', - '*ipv6-prefixlen': 'int', - '*ipv6-host': 'str', ---- a/qemu-options.hx -+++ b/qemu-options.hx -@@ -1919,8 +1919,8 @@ - "-netdev user,id=str[,ipv4[=on|off]][,net=addr[/mask]][,host=addr]\n" - " [,ipv6[=on|off]][,ipv6-net=addr[/int]][,ipv6-host=addr]\n" - " [,restrict=on|off][,hostname=host][,dhcpstart=addr]\n" -- " [,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,tftp=dir]\n" -- " [,bootfile=f][,hostfwd=rule][,guestfwd=rule]" -+ " [,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,domainname=domain]\n" -+ " [,tftp=dir][,bootfile=f][,hostfwd=rule][,guestfwd=rule]" - #ifndef _WIN32 - "[,smb=dir[,smbserver=addr]]\n" - #endif -@@ -2127,6 +2127,9 @@ - qemu -net user,dnssearch=mgmt.example.org,dnssearch=example.org [...] - @end example - -+@item domainname=@var{domain} -+Specifies the client domain name reported by the built-in DHCP server. -+ - @item tftp=@var{dir} - When using the user mode network stack, activate a built-in TFTP - server. The files in @var{dir} will be exposed as the root of a TFTP server. ---- a/slirp/bootp.c -+++ b/slirp/bootp.c -@@ -298,6 +298,14 @@ - q += val; - } - -+ if (slirp->vdomainname) { -+ val = strlen(slirp->vdomainname); -+ *q++ = RFC1533_DOMAINNAME; -+ *q++ = val; -+ memcpy(q, slirp->vdomainname, val); -+ q += val; -+ } -+ - if (slirp->vdnssearch) { - size_t spaceleft = sizeof(rbp->bp_vend) - (q - rbp->bp_vend); - val = slirp->vdnssearch_len; ---- a/slirp/libslirp.h -+++ b/slirp/libslirp.h -@@ -17,7 +17,7 @@ - const char *tftp_path, const char *bootfile, - struct in_addr vdhcp_start, struct in_addr vnameserver, - struct in6_addr vnameserver6, const char **vdnssearch, -- void *opaque); -+ const char *vdomainname, void *opaque); - void slirp_cleanup(Slirp *slirp); - - void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout); ---- a/slirp/slirp.c -+++ b/slirp/slirp.c -@@ -286,7 +286,7 @@ - const char *tftp_path, const char *bootfile, - struct in_addr vdhcp_start, struct in_addr vnameserver, - struct in6_addr vnameserver6, const char **vdnssearch, -- void *opaque) -+ const char *vdomainname, void *opaque) - { - Slirp *slirp = g_malloc0(sizeof(Slirp)); - -@@ -317,6 +317,7 @@ - } - slirp->tftp_prefix = g_strdup(tftp_path); - slirp->bootp_filename = g_strdup(bootfile); -+ slirp->vdomainname = g_strdup(vdomainname); - slirp->vdhcp_startaddr = vdhcp_start; - slirp->vnameserver_addr = vnameserver; - slirp->vnameserver_addr6 = vnameserver6; -@@ -349,6 +350,7 @@ - g_free(slirp->vdnssearch); - g_free(slirp->tftp_prefix); - g_free(slirp->bootp_filename); -+ g_free(slirp->vdomainname); - g_free(slirp); - } - ---- a/slirp/slirp.h -+++ b/slirp/slirp.h -@@ -194,6 +194,7 @@ - char *bootp_filename; - size_t vdnssearch_len; - uint8_t *vdnssearch; -+ char *vdomainname; - - /* tcp states */ - struct socket tcb; diff -Nru qemu-2.11+dfsg/debian/patches/ubuntu/0002-slirp-Add-classless-static-routes-support-to-DHCP-se.patch qemu-2.11+dfsg/debian/patches/ubuntu/0002-slirp-Add-classless-static-routes-support-to-DHCP-se.patch --- qemu-2.11+dfsg/debian/patches/ubuntu/0002-slirp-Add-classless-static-routes-support-to-DHCP-se.patch 2018-03-06 20:34:49.000000000 +0000 +++ qemu-2.11+dfsg/debian/patches/ubuntu/0002-slirp-Add-classless-static-routes-support-to-DHCP-se.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,289 +0,0 @@ -From ee0065d6ba6f5e33fd127cd2a53b7b8d40e4e6de Mon Sep 17 00:00:00 2001 -From: Benjamin Drung -Date: Tue, 27 Feb 2018 16:09:43 +0100 -Subject: [PATCH 2/2] slirp: Add classless static routes support to DHCP server - -This patch will allow the user to specify classless static routes for -the replies from the built-in DHCP server. - -Signed-off-by: Benjamin Drung ---- - net/slirp.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- - qapi/net.json | 4 ++++ - qemu-options.hx | 13 +++++++++++- - slirp/bootp.c | 23 ++++++++++++++++++++ - slirp/bootp.h | 2 ++ - slirp/libslirp.h | 9 +++++++- - slirp/slirp.c | 7 +++++- - slirp/slirp.h | 2 ++ - 8 files changed, 119 insertions(+), 6 deletions(-) - ---- a/net/slirp.c -+++ b/net/slirp.c -@@ -156,7 +156,7 @@ - const char *vnameserver, const char *vnameserver6, - const char *smb_export, const char *vsmbserver, - const char **dnssearch, const char *vdomainname, -- Error **errp) -+ const StringList *vroutes, Error **errp) - { - /* default settings according to historic slirp */ - struct in_addr net = { .s_addr = htonl(0x0a000200) }; /* 10.0.2.0 */ -@@ -175,8 +175,12 @@ - char buf[20]; - uint32_t addr; - int shift; -+ int i = 0; - char *end; -+ unsigned int route_count = 0; - struct slirp_config_str *config; -+ struct StaticRoute *routes = NULL; -+ const StringList *iter; - - if (!ipv4 && (vnetwork || vhost || vnameserver)) { - error_setg(errp, "IPv4 disabled but netmask/host/dns provided"); -@@ -363,6 +367,58 @@ - return -1; - } - -+ iter = vroutes; -+ while (iter) { -+ route_count++; -+ iter = iter->next; -+ } -+ routes = g_malloc(route_count * sizeof(StaticRoute)); -+ -+ iter = vroutes; -+ while(iter != NULL) { -+ char buf2[20]; -+ const char *gateway = iter->value->str; -+ const char *mask; -+ char *end; -+ long mask_width; -+ -+ // Split "subnet/mask:gateway" into its components -+ if (get_str_sep(buf2, sizeof(buf2), &gateway, ':') < 0) { -+ error_setg(errp, "Failed to parse route: No colon found in '%s'", -+ iter->value->str); -+ return -1; -+ } -+ mask = buf2; -+ if (get_str_sep(buf, sizeof(buf), &mask, '/') < 0) { -+ error_setg(errp, "Failed to parse route: No slash found in '%s'", -+ mask); -+ return -1; -+ } -+ if (!inet_aton(buf, &routes[i].subnet)) { -+ error_setg(errp, "Failed to parse route subnet '%s'", buf); -+ return -1; -+ } -+ -+ mask_width = strtol(mask, &end, 10); -+ if (*end != '\0') { -+ error_setg(errp, -+ "Failed to parse netmask '%s' (trailing chars)", mask); -+ return -1; -+ } else if (mask_width < 0 || mask_width > 32) { -+ error_setg(errp, -+ "Invalid netmask provided (must be in range 0-32)"); -+ return -1; -+ } -+ routes[i].mask_width = (uint8_t)mask_width; -+ -+ if (!inet_aton(gateway, &routes[i].gateway)) { -+ error_setg(errp, "Failed to parse route gateway '%s'", gateway); -+ return -1; -+ } -+ -+ iter = iter->next; -+ i++; -+ } - - nc = qemu_new_net_client(&net_slirp_info, peer, model, name); - -@@ -375,7 +431,8 @@ - s->slirp = slirp_init(restricted, ipv4, net, mask, host, - ipv6, ip6_prefix, vprefix6_len, ip6_host, - vhostname, tftp_export, bootfile, dhcp, -- dns, ip6_dns, dnssearch, vdomainname, s); -+ dns, ip6_dns, dnssearch, vdomainname, -+ route_count, routes, s); - QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry); - - for (config = slirp_configs; config; config = config->next) { -@@ -407,6 +464,7 @@ - return 0; - - error: -+ g_free(routes); - qemu_del_net_client(nc); - return -1; - } -@@ -949,7 +1007,8 @@ - user->ipv6_host, user->hostname, user->tftp, - user->bootfile, user->dhcpstart, - user->dns, user->ipv6_dns, user->smb, -- user->smbserver, dnssearch, user->domainname, errp); -+ user->smbserver, dnssearch, user->domainname, -+ user->route, errp); - - while (slirp_configs) { - config = slirp_configs; ---- a/qapi/net.json -+++ b/qapi/net.json -@@ -163,6 +163,9 @@ - # @domainname: guest-visible domain name of the virtual nameserver - # (since 2.12) - # -+# @route: guest-visible static classless route of the virtual nameserver -+# (since 2.12) -+# - # @ipv6-prefix: IPv6 network prefix (default is fec0::) (since - # 2.6). The network prefix is given in the usual - # hexadecimal IPv6 address notation. -@@ -201,6 +204,7 @@ - '*dns': 'str', - '*dnssearch': ['String'], - '*domainname': 'str', -+ '*route': ['String'], - '*ipv6-prefix': 'str', - '*ipv6-prefixlen': 'int', - '*ipv6-host': 'str', ---- a/qemu-options.hx -+++ b/qemu-options.hx -@@ -1920,7 +1920,7 @@ - " [,ipv6[=on|off]][,ipv6-net=addr[/int]][,ipv6-host=addr]\n" - " [,restrict=on|off][,hostname=host][,dhcpstart=addr]\n" - " [,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,domainname=domain]\n" -- " [,tftp=dir][,bootfile=f][,hostfwd=rule][,guestfwd=rule]" -+ " [,route=addr/mask:gateway][,tftp=dir][,bootfile=f][,hostfwd=rule][,guestfwd=rule]" - #ifndef _WIN32 - "[,smb=dir[,smbserver=addr]]\n" - #endif -@@ -2130,6 +2130,17 @@ - @item domainname=@var{domain} - Specifies the client domain name reported by the built-in DHCP server. - -+@item route=@var{addr}/@var{mask}:@var{gateway} -+Provides an entry for the classless static routes list sent by the built-in -+DHCP server. More than one route can be transmitted by specifying -+this option multiple times. If supported, this will cause the guest to -+automatically set the given static routes instead of the given default gateway. -+ -+Example: -+@example -+qemu -net user,route=10.0.2.0/24:10.0.2.2,route=192.168.0.0/16:10.0.2.2 [...] -+@end example -+ - @item tftp=@var{dir} - When using the user mode network stack, activate a built-in TFTP - server. The files in @var{dir} will be exposed as the root of a TFTP server. ---- a/slirp/bootp.c -+++ b/slirp/bootp.c -@@ -306,6 +306,29 @@ - q += val; - } - -+ if (slirp->route_count > 0) { -+ uint8_t option_length = 0; -+ uint8_t significant_octets; -+ -+ for (int i = 0; i < slirp->route_count; i++) { -+ significant_octets = slirp->routes[i].mask_width / 8 -+ + (slirp->routes[i].mask_width % 8 > 0); -+ option_length += significant_octets + 5; -+ } -+ -+ *q++ = RFC3442_CLASSLESS_STATIC_ROUTE; -+ *q++ = option_length; -+ for (int i = 0; i < slirp->route_count; i++) { -+ significant_octets = slirp->routes[i].mask_width / 8 -+ + (slirp->routes[i].mask_width % 8 > 0); -+ *q++ = slirp->routes[i].mask_width; -+ memcpy(q, &slirp->routes[i].subnet.s_addr, significant_octets); -+ q += significant_octets; -+ memcpy(q, &slirp->routes[i].gateway.s_addr, 4); -+ q += 4; -+ } -+ } -+ - if (slirp->vdnssearch) { - size_t spaceleft = sizeof(rbp->bp_vend) - (q - rbp->bp_vend); - val = slirp->vdnssearch_len; ---- a/slirp/bootp.h -+++ b/slirp/bootp.h -@@ -71,6 +71,8 @@ - #define RFC2132_RENEWAL_TIME 58 - #define RFC2132_REBIND_TIME 59 - -+#define RFC3442_CLASSLESS_STATIC_ROUTE 121 -+ - #define DHCPDISCOVER 1 - #define DHCPOFFER 2 - #define DHCPREQUEST 3 ---- a/slirp/libslirp.h -+++ b/slirp/libslirp.h -@@ -6,6 +6,12 @@ - struct Slirp; - typedef struct Slirp Slirp; - -+typedef struct StaticRoute { -+ struct in_addr subnet; -+ uint8_t mask_width; -+ struct in_addr gateway; -+} StaticRoute; -+ - int get_dns_addr(struct in_addr *pdns_addr); - int get_dns6_addr(struct in6_addr *pdns6_addr, uint32_t *scope_id); - -@@ -17,7 +23,8 @@ - const char *tftp_path, const char *bootfile, - struct in_addr vdhcp_start, struct in_addr vnameserver, - struct in6_addr vnameserver6, const char **vdnssearch, -- const char *vdomainname, void *opaque); -+ const char *vdomainname, unsigned int routes_count, -+ const StaticRoute *vroutes, void *opaque); - void slirp_cleanup(Slirp *slirp); - - void slirp_pollfds_fill(GArray *pollfds, uint32_t *timeout); ---- a/slirp/slirp.c -+++ b/slirp/slirp.c -@@ -286,7 +286,8 @@ - const char *tftp_path, const char *bootfile, - struct in_addr vdhcp_start, struct in_addr vnameserver, - struct in6_addr vnameserver6, const char **vdnssearch, -- const char *vdomainname, void *opaque) -+ const char *vdomainname, unsigned int route_count, -+ const StaticRoute *vroutes, void *opaque) - { - Slirp *slirp = g_malloc0(sizeof(Slirp)); - -@@ -321,6 +322,9 @@ - slirp->vdhcp_startaddr = vdhcp_start; - slirp->vnameserver_addr = vnameserver; - slirp->vnameserver_addr6 = vnameserver6; -+ slirp->route_count = route_count; -+ slirp->routes = g_malloc(route_count * sizeof(StaticRoute)); -+ memcpy(slirp->routes, vroutes, route_count * sizeof(StaticRoute)); - - if (vdnssearch) { - translate_dnssearch(slirp, vdnssearch); -@@ -351,6 +355,7 @@ - g_free(slirp->tftp_prefix); - g_free(slirp->bootp_filename); - g_free(slirp->vdomainname); -+ g_free(slirp->routes); - g_free(slirp); - } - ---- a/slirp/slirp.h -+++ b/slirp/slirp.h -@@ -195,6 +195,8 @@ - size_t vdnssearch_len; - uint8_t *vdnssearch; - char *vdomainname; -+ unsigned int route_count; -+ struct StaticRoute *routes; - - /* tcp states */ - struct socket tcb;