From d32ad10a14d46dfe9304e3ed5858a11dcd5c71a0 Mon Sep 17 00:00:00 2001 From: Alexey Kirillov Date: Wed, 3 Mar 2021 12:59:06 +0300 Subject: qapi: net: Add query-netdev command The query-netdev command is used to get the configuration of the current network device backends (netdevs). This is the QMP analog of the HMP command "info network" but only for netdevs (i.e. excluding NIC and hubports). The query-netdev command returns an array of objects of the NetdevInfo type, which are an extension of Netdev type. It means that response can be used for netdev-add after small modification. This can be useful for recreate the same netdev configuration. Information about the network device is filled in when it is created or modified and is available through the NetClientState->stored_config. Signed-off-by: Alexey Kirillov Acked-by: Markus Armbruster Signed-off-by: Jason Wang --- net/l2tpv3.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'net/l2tpv3.c') diff --git a/net/l2tpv3.c b/net/l2tpv3.c index e4d4218..8aa0a3e 100644 --- a/net/l2tpv3.c +++ b/net/l2tpv3.c @@ -723,6 +723,13 @@ int net_init_l2tpv3(const Netdev *netdev, l2tpv3_read_poll(s, true); + /* Store startup parameters */ + nc->stored_config = g_new0(NetdevInfo, 1); + nc->stored_config->type = NET_BACKEND_L2TPV3; + + QAPI_CLONE_MEMBERS(NetdevL2TPv3Options, + &nc->stored_config->u.l2tpv3, l2tpv3); + snprintf(s->nc.info_str, sizeof(s->nc.info_str), "l2tpv3: connected"); return 0; -- cgit v1.1