• L
    qemu: qemuMonitorQueryRxFilter - retrieve guest netdev rx-filter · ab989962
    Laine Stump 提交于
    This function can be called at any time to get the current status of a
    guest's network device rx-filter. In particular it is useful to call
    after libvirt recieves a NIC_RX_FILTER_CHANGED event - this event only
    tells you that something has changed in the rx-filter, the details are
    retrieved with the query-rx-filter monitor command (only available in
    the json monitor). The command sent to the qemu monitor looks like this:
    
      {"execute":"query-rx-filter", "arguments": {"name":"net2"} }'
    
    and the results will look something like this:
    
    {
        "return": [
            {
                "promiscuous": false,
                "name": "net2",
                "main-mac": "52:54:00:98:2d:e3",
                "unicast": "normal",
                "vlan": "normal",
                "vlan-table": [
                    42,
                    0
                ],
                "unicast-table": [
    
                ],
                "multicast": "normal",
                "multicast-overflow": false,
                "unicast-overflow": false,
                "multicast-table": [
                    "33:33:ff:98:2d:e3",
                    "01:80:c2:00:00:21",
                    "01:00:5e:00:00:fb",
                    "33:33:ff:98:2d:e2",
                    "01:00:5e:00:00:01",
                    "33:33:00:00:00:01"
                ],
                "broadcast-allowed": false
            }
        ],
        "id": "libvirt-14"
    }
    
    This is all parsed from JSON into a virNetDevRxFilter object for
    easier consumption. (unicast-table is usually empty, but is also an
    array of mac addresses similar to multicast-table).
    
    (NB: LIBNL_CFLAGS was added to tests/Makefile.am because virnetdev.h
    now includes util/virnetlink.h, which includes netlink/msg.h when
    appropriate. Without LIBNL_CFLAGS, gcc can't find that file (if
    libnl/netlink isn't available, LIBNL_CFLAGS will be empty and
    virnetlink.h won't try to include netlink/msg.h anyway).)
    ab989962
qemu_monitor_json.c 191.3 KB