char-socket.c (9fd704da6809f3e01d0283f0d6d619022d481fb9) char-socket.c (8de69efab1009d374c7f01d2536797ea009ee796)
1/*
2 * QEMU System Emulator
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 1237 unchanged lines hidden (view full) ---

1246 switch (addr->type) {
1247 case SOCKET_ADDRESS_TYPE_FD:
1248 if (sock->has_reconnect) {
1249 error_setg(errp,
1250 "'reconnect' option is incompatible with "
1251 "'fd' address type");
1252 return false;
1253 }
1/*
2 * QEMU System Emulator
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 1237 unchanged lines hidden (view full) ---

1246 switch (addr->type) {
1247 case SOCKET_ADDRESS_TYPE_FD:
1248 if (sock->has_reconnect) {
1249 error_setg(errp,
1250 "'reconnect' option is incompatible with "
1251 "'fd' address type");
1252 return false;
1253 }
1254 if (sock->has_tls_creds &&
1254 if (sock->tls_creds &&
1255 !(sock->has_server && sock->server)) {
1256 error_setg(errp,
1257 "'tls_creds' option is incompatible with "
1258 "'fd' address type as client");
1259 return false;
1260 }
1261 break;
1262
1263 case SOCKET_ADDRESS_TYPE_UNIX:
1255 !(sock->has_server && sock->server)) {
1256 error_setg(errp,
1257 "'tls_creds' option is incompatible with "
1258 "'fd' address type as client");
1259 return false;
1260 }
1261 break;
1262
1263 case SOCKET_ADDRESS_TYPE_UNIX:
1264 if (sock->has_tls_creds) {
1264 if (sock->tls_creds) {
1265 error_setg(errp,
1266 "'tls_creds' option is incompatible with "
1267 "'unix' address type");
1268 return false;
1269 }
1270 break;
1271
1272 case SOCKET_ADDRESS_TYPE_INET:
1273 break;
1274
1275 case SOCKET_ADDRESS_TYPE_VSOCK:
1265 error_setg(errp,
1266 "'tls_creds' option is incompatible with "
1267 "'unix' address type");
1268 return false;
1269 }
1270 break;
1271
1272 case SOCKET_ADDRESS_TYPE_INET:
1273 break;
1274
1275 case SOCKET_ADDRESS_TYPE_VSOCK:
1276 if (sock->has_tls_creds) {
1276 if (sock->tls_creds) {
1277 error_setg(errp,
1278 "'tls_creds' option is incompatible with "
1279 "'vsock' address type");
1280 return false;
1281 }
1282
1283 default:
1284 break;
1285 }
1286
1277 error_setg(errp,
1278 "'tls_creds' option is incompatible with "
1279 "'vsock' address type");
1280 return false;
1281 }
1282
1283 default:
1284 break;
1285 }
1286
1287 if (sock->has_tls_authz && !sock->has_tls_creds) {
1287 if (sock->tls_authz && !sock->tls_creds) {
1288 error_setg(errp, "'tls_authz' option requires 'tls_creds' option");
1289 return false;
1290 }
1291
1292 /* Validate any options which have a dependancy on client vs server */
1293 if (!sock->has_server || sock->server) {
1294 if (sock->has_reconnect) {
1295 error_setg(errp,

--- 164 unchanged lines hidden (view full) ---

1460 /*
1461 * We have different default to QMP for 'wait' when 'server'
1462 * is set, hence we can't just check for existence of 'wait'
1463 */
1464 sock->has_wait = qemu_opt_find(opts, "wait") || sock->server;
1465 sock->wait = qemu_opt_get_bool(opts, "wait", true);
1466 sock->has_reconnect = qemu_opt_find(opts, "reconnect");
1467 sock->reconnect = qemu_opt_get_number(opts, "reconnect", 0);
1288 error_setg(errp, "'tls_authz' option requires 'tls_creds' option");
1289 return false;
1290 }
1291
1292 /* Validate any options which have a dependancy on client vs server */
1293 if (!sock->has_server || sock->server) {
1294 if (sock->has_reconnect) {
1295 error_setg(errp,

--- 164 unchanged lines hidden (view full) ---

1460 /*
1461 * We have different default to QMP for 'wait' when 'server'
1462 * is set, hence we can't just check for existence of 'wait'
1463 */
1464 sock->has_wait = qemu_opt_find(opts, "wait") || sock->server;
1465 sock->wait = qemu_opt_get_bool(opts, "wait", true);
1466 sock->has_reconnect = qemu_opt_find(opts, "reconnect");
1467 sock->reconnect = qemu_opt_get_number(opts, "reconnect", 0);
1468 sock->has_tls_creds = qemu_opt_get(opts, "tls-creds");
1469 sock->tls_creds = g_strdup(qemu_opt_get(opts, "tls-creds"));
1468 sock->tls_creds = g_strdup(qemu_opt_get(opts, "tls-creds"));
1470 sock->has_tls_authz = qemu_opt_get(opts, "tls-authz");
1471 sock->tls_authz = g_strdup(qemu_opt_get(opts, "tls-authz"));
1472
1473 addr = g_new0(SocketAddressLegacy, 1);
1474 if (path) {
1475 UnixSocketAddress *q_unix;
1476 addr->type = SOCKET_ADDRESS_TYPE_UNIX;
1477 q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1);
1478 q_unix->path = g_strdup(path);

--- 84 unchanged lines hidden ---
1469 sock->tls_authz = g_strdup(qemu_opt_get(opts, "tls-authz"));
1470
1471 addr = g_new0(SocketAddressLegacy, 1);
1472 if (path) {
1473 UnixSocketAddress *q_unix;
1474 addr->type = SOCKET_ADDRESS_TYPE_UNIX;
1475 q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1);
1476 q_unix->path = g_strdup(path);

--- 84 unchanged lines hidden ---