mirror of
https://github.com/mii443/qemu.git
synced 2025-12-03 11:08:25 +00:00
sockets: Limit SocketAddressLegacy to external interfaces
SocketAddressLegacy is a simple union, and simple unions are awkward: they have their variant members wrapped in a "data" object on the wire, and require additional indirections in C. SocketAddress is the equivalent flat union. Convert all users of SocketAddressLegacy to SocketAddress, except for existing external interfaces. See also commit fce5d53..9445673 and 85a82e8..c5f1ae3. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1493192202-3184-7-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Minor editing accident fixed, commit message and a comment tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
@@ -498,7 +498,7 @@ vnc_socket_ip_addr_string(QIOChannelSocket *ioc,
|
||||
bool local,
|
||||
Error **errp)
|
||||
{
|
||||
SocketAddressLegacy *addr;
|
||||
SocketAddress *addr;
|
||||
char *ret;
|
||||
|
||||
if (local) {
|
||||
@@ -510,13 +510,12 @@ vnc_socket_ip_addr_string(QIOChannelSocket *ioc,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (addr->type != SOCKET_ADDRESS_LEGACY_KIND_INET) {
|
||||
if (addr->type != SOCKET_ADDRESS_TYPE_INET) {
|
||||
error_setg(errp, "Not an inet socket type");
|
||||
return NULL;
|
||||
}
|
||||
ret = g_strdup_printf("%s;%s", addr->u.inet.data->host,
|
||||
addr->u.inet.data->port);
|
||||
qapi_free_SocketAddressLegacy(addr);
|
||||
ret = g_strdup_printf("%s;%s", addr->u.inet.host, addr->u.inet.port);
|
||||
qapi_free_SocketAddress(addr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user