Skip to content

Commit b4983c5

Browse files
huthdagrh
authored andcommitted
net: Remove deprecated [hub_id name] tuple of 'hostfwd_add' / 'hostfwd_remove'
It's been deprecated since QEMU v3.1.0. Time to finally remove it now. Signed-off-by: Thomas Huth <[email protected]> Message-Id: <[email protected]> Signed-off-by: Dr. David Alan Gilbert <[email protected]> Reworked Thomas's deprecated.texi to the rst
1 parent 89802d5 commit b4983c5

File tree

5 files changed

+25
-67
lines changed

5 files changed

+25
-67
lines changed

docs/system/deprecated.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,6 @@ the 'wait' field, which is only applicable to sockets in server mode
248248
Human Monitor Protocol (HMP) commands
249249
-------------------------------------
250250

251-
The ``hub_id`` parameter of ``hostfwd_add`` / ``hostfwd_remove`` (since 3.1)
252-
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
253-
254-
The ``[hub_id name]`` parameter tuple of the 'hostfwd_add' and
255-
'hostfwd_remove' HMP commands has been replaced by ``netdev_id``.
256-
257251
``cpu-add`` (since 4.0)
258252
'''''''''''''''''''''''
259253

@@ -430,6 +424,15 @@ QEMU Machine Protocol (QMP) commands
430424
The "autoload" parameter has been ignored since 2.12.0. All bitmaps
431425
are automatically loaded from qcow2 images.
432426

427+
Human Monitor Protocol (HMP) commands
428+
-------------------------------------
429+
430+
The ``hub_id`` parameter of ``hostfwd_add`` / ``hostfwd_remove`` (removed in 5.0)
431+
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
432+
433+
The ``[hub_id name]`` parameter tuple of the 'hostfwd_add' and
434+
'hostfwd_remove' HMP commands has been replaced by ``netdev_id``.
435+
433436
Related binaries
434437
----------------
435438

hmp-commands.hx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,8 +1369,8 @@ ERST
13691369
#ifdef CONFIG_SLIRP
13701370
{
13711371
.name = "hostfwd_add",
1372-
.args_type = "arg1:s,arg2:s?,arg3:s?",
1373-
.params = "[hub_id name]|[netdev_id] [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport",
1372+
.args_type = "arg1:s,arg2:s?",
1373+
.params = "[netdev_id] [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport",
13741374
.help = "redirect TCP or UDP connections from host to guest (requires -net user)",
13751375
.cmd = hmp_hostfwd_add,
13761376
},
@@ -1383,8 +1383,8 @@ ERST
13831383
#ifdef CONFIG_SLIRP
13841384
{
13851385
.name = "hostfwd_remove",
1386-
.args_type = "arg1:s,arg2:s?,arg3:s?",
1387-
.params = "[hub_id name]|[netdev_id] [tcp|udp]:[hostaddr]:hostport",
1386+
.args_type = "arg1:s,arg2:s?",
1387+
.params = "[netdev_id] [tcp|udp]:[hostaddr]:hostport",
13881388
.help = "remove host-to-guest TCP or UDP redirection",
13891389
.cmd = hmp_hostfwd_remove,
13901390
},

net/hub.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -193,29 +193,6 @@ NetClientState *net_hub_add_port(int hub_id, const char *name,
193193
return &port->nc;
194194
}
195195

196-
/**
197-
* Find a specific client on a hub
198-
*/
199-
NetClientState *net_hub_find_client_by_name(int hub_id, const char *name)
200-
{
201-
NetHub *hub;
202-
NetHubPort *port;
203-
NetClientState *peer;
204-
205-
QLIST_FOREACH(hub, &hubs, next) {
206-
if (hub->id == hub_id) {
207-
QLIST_FOREACH(port, &hub->ports, next) {
208-
peer = port->nc.peer;
209-
210-
if (peer && strcmp(peer->name, name) == 0) {
211-
return peer;
212-
}
213-
}
214-
}
215-
}
216-
return NULL;
217-
}
218-
219196
/**
220197
* Find a available port on a hub; otherwise create one new port
221198
*/

net/hub.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
#ifndef NET_HUB_H
1616
#define NET_HUB_H
1717

18-
1918
NetClientState *net_hub_add_port(int hub_id, const char *name,
2019
NetClientState *hubpeer);
21-
NetClientState *net_hub_find_client_by_name(int hub_id, const char *name);
2220
void net_hub_info(Monitor *mon);
2321
void net_hub_check_clients(void);
2422
bool net_hub_flush(NetClientState *nc);

net/slirp.c

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -610,25 +610,13 @@ static int net_slirp_init(NetClientState *peer, const char *model,
610610
return -1;
611611
}
612612

613-
static SlirpState *slirp_lookup(Monitor *mon, const char *hub_id,
614-
const char *name)
613+
static SlirpState *slirp_lookup(Monitor *mon, const char *id)
615614
{
616-
if (name) {
617-
NetClientState *nc;
618-
if (hub_id) {
619-
nc = net_hub_find_client_by_name(strtol(hub_id, NULL, 0), name);
620-
if (!nc) {
621-
monitor_printf(mon, "unrecognized (hub-id, stackname) pair\n");
622-
return NULL;
623-
}
624-
warn_report("Using 'hub-id' is deprecated, specify the netdev id "
625-
"directly instead");
626-
} else {
627-
nc = qemu_find_netdev(name);
628-
if (!nc) {
629-
monitor_printf(mon, "unrecognized netdev id '%s'\n", name);
630-
return NULL;
631-
}
615+
if (id) {
616+
NetClientState *nc = qemu_find_netdev(id);
617+
if (!nc) {
618+
monitor_printf(mon, "unrecognized netdev id '%s'\n", id);
619+
return NULL;
632620
}
633621
if (strcmp(nc->model, "user")) {
634622
monitor_printf(mon, "invalid device specified\n");
@@ -655,16 +643,12 @@ void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict)
655643
int err;
656644
const char *arg1 = qdict_get_str(qdict, "arg1");
657645
const char *arg2 = qdict_get_try_str(qdict, "arg2");
658-
const char *arg3 = qdict_get_try_str(qdict, "arg3");
659646

660-
if (arg3) {
661-
s = slirp_lookup(mon, arg1, arg2);
662-
src_str = arg3;
663-
} else if (arg2) {
664-
s = slirp_lookup(mon, NULL, arg1);
647+
if (arg2) {
648+
s = slirp_lookup(mon, arg1);
665649
src_str = arg2;
666650
} else {
667-
s = slirp_lookup(mon, NULL, NULL);
651+
s = slirp_lookup(mon, NULL);
668652
src_str = arg1;
669653
}
670654
if (!s) {
@@ -784,16 +768,12 @@ void hmp_hostfwd_add(Monitor *mon, const QDict *qdict)
784768
SlirpState *s;
785769
const char *arg1 = qdict_get_str(qdict, "arg1");
786770
const char *arg2 = qdict_get_try_str(qdict, "arg2");
787-
const char *arg3 = qdict_get_try_str(qdict, "arg3");
788771

789-
if (arg3) {
790-
s = slirp_lookup(mon, arg1, arg2);
791-
redir_str = arg3;
792-
} else if (arg2) {
793-
s = slirp_lookup(mon, NULL, arg1);
772+
if (arg2) {
773+
s = slirp_lookup(mon, arg1);
794774
redir_str = arg2;
795775
} else {
796-
s = slirp_lookup(mon, NULL, NULL);
776+
s = slirp_lookup(mon, NULL);
797777
redir_str = arg1;
798778
}
799779
if (s) {

0 commit comments

Comments
 (0)