qga: implement 'guest-network-get-route' for FreeBSD
PATCH v3 1/1 qga: implement 'guest-network-get-route' for FreeBSD
Implement 'guest-network-get-route' for FreeBSD. This implementation uses the sysctl(3) interface to get the routing table.
Limitations:
- This implementation does not populate irtt, refcnt, use, window, source, and srcprefixlen fields.
- The implementation uses the default FIB (routing table) 0. Selecting QGA's active FIB is left for the follow-up patch.
While here, spell Windows correctly in @GuestNetworkRoute documentation in qapi-schema.json.
---
Changes since v1:
- qga/qapi-schema.json spelling: windows -> Windows, freebsd -> FreeBSD in the "@GuestNetworkRoute" documentation.
- meson.build: check that the 'struct rt_metrics' has 'rmx_metric' member which is available only on FreeBSD 16.
Changes since v2:
- If interface name cannot be obtained, default it to "if<index>" instead of "?", similarly to the Windows implementation.
- Use getnameinfo() for both AF_INET and AF_INET6 formatting.
meson.build | 6 ++ qga/commands-bsd.c | 173 +++++++++++++++++++++++++++++++++++++++++++ qga/qapi-schema.json | 31 ++++---- 3 files changed, 195 insertions(+), 15 deletions(-)
meson.build +6 -0
@@ -2759,6 +2759,12 @@ config_host_data.set('HAVE_STRUCT_STAT_ST_ATIM', config_host_data.set('HAVE_BLK_ZONE_REP_CAPACITY', cc.has_member('struct blk_zone', 'capacity', prefix: '#include <linux/blkzoned.h>')) +config_host_data.set('HAVE_STRUCT_RT_METRICS_RMX_METRIC', + cc.has_member('struct rt_metrics', 'rmx_metric', + prefix: ''' + #include <sys/types.h> + #include <sys/socket.h> + #include <net/route.h>''')) # has_type config_host_data.set('CONFIG_IOVEC',
qga/commands-bsd.c +173 -0
183 lines not on this page · raw message
qga/qapi-schema.json +16 -15
@@ -1823,8 +1823,8 @@ ## # @GuestNetworkRoute: -# Route information. Supported on Linux (since 9.1) and Windows -# (since 11.0). +# Route information. Supported on Linux (since 9.1), Windows +# (since 11.0), and FreeBSD (since 11.2). # # @iface: The destination network or host's egress network interface # in the routing table
@@ -1838,30 +1838,31 @@ # # @mask: Subnet Mask (IPv4 only) # -# @irtt: Initial round-trip delay (not for windows, IPv4 only) +# @irtt: Initial round-trip delay (not for Windows and FreeBSD, +# IPv4 only) # -# @flags: Route flags (not for windows) +# @flags: Route flags (not for Windows) # -# @refcnt: The route's reference count (not for windows) +# @refcnt: The route's reference count (not for Windows and FreeBSD) # -# @use: Route usage count (not for windows) +# @use: Route usage count (not for Windows and FreeBSD) # -# @window: TCP window size, used for flow control (not for windows, -# IPv4 only) +# @window: TCP window size, used for flow control (not for Windows +# and FreeBSD, IPv4 only) # -# @mtu: Data link layer maximum packet size (not for windows) +# @mtu: Data link layer maximum packet size (not for Windows) # # @desprefixlen: Destination prefix length (for IPv6) # -# @source: Source IP address (for IPv6) +# @source: Source IP address (not for FreeBSD, IPv6 only) # -# @srcprefixlen: Source prefix length (for IPv6) +# @srcprefixlen: Source prefix length (not for FreeBSD, IPv6 only) # # @nexthop: Next hop IP address (for IPv6) # # @version: IP version (4 or 6) # -# Since: 9.1 (Linux only); 11.0 (Windows) +# Since: 9.1 (Linux only); 11.0 (Windows); 11.2 (FreeBSD) ## { 'struct': 'GuestNetworkRoute', 'data': {'iface': 'str',
@@ -1881,7 +1882,7 @@ '*nexthop': 'str', 'version': 'int' }, - 'if': { 'any': ['CONFIG_LINUX', 'CONFIG_WIN32'] } } + 'if': { 'any': ['CONFIG_LINUX', 'CONFIG_WIN32', 'CONFIG_FREEBSD'] } } ## # @guest-network-get-route:
@@ -1889,9 +1890,9 @@ # # Returns: List of route info of guest. # -# Since: 9.1 (Linux only); 11.0 (Windows) +# Since: 9.1 (Linux only); 11.0 (Windows); 11.2 (FreeBSD) ## { 'command': 'guest-network-get-route', 'returns': ['GuestNetworkRoute'], - 'if': { 'any': ['CONFIG_LINUX', 'CONFIG_WIN32'] } + 'if': { 'any': ['CONFIG_LINUX', 'CONFIG_WIN32', 'CONFIG_FREEBSD'] } }
Signature · 1 line
2.55.0
Quoted 26 lines · Roman Bogorodskiy
Implement 'guest-network-get-route' for FreeBSD. This implementation uses the sysctl(3) interface to get the routing table.
Limitations:
- This implementation does not populate irtt, refcnt, use, window, source, and srcprefixlen fields.
- The implementation uses the default FIB (routing table) 0. Selecting QGA's active FIB is left for the follow-up patch.While here, spell Windows correctly in @GuestNetworkRoute documentation in qapi-schema.json.
Signed-off-by Roman Bogorodskiy <[email protected]>---
Changes since v1:-
qga/qapi-schema.jsonspelling: windows -> Windows, freebsd -> FreeBSD in the "@GuestNetworkRoute" documentation.
- meson.build: check that the 'structrt_metrics' has 'rmx_metric' member which is available only on FreeBSD 16.Changes since v2:
Quoted 8 lines
- If interface name cannot be obtained, default it to "if<index>" instead of "?", similarly to the Windows implementation.
- Usegetnameinfo()for bothAF_INETandAF_INET6formatting.meson.build | 6 ++ qga/commands-bsd.c | 173 +++++++++++++++++++++++++++++++++++++++++++ qga/qapi-schema.json | 31 ++++---- 3 files changed, 195 insertions(+), 15 deletions(-)
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Kostiantyn Kostiuk
Reviewed-byQuoted 46 lines · Daniel P. Berrangé
Quoted 26 lines · Roman Bogorodskiy
Implement 'guest-network-get-route' for FreeBSD. This implementation uses the sysctl(3) interface to get the routing table.
Limitations:
- This implementation does not populate irtt, refcnt, use, window, source, and srcprefixlen fields.
- The implementation uses the default FIB (routing table) 0. Selecting QGA's active FIB is left for the follow-up patch.While here, spell Windows correctly in @GuestNetworkRoute documentation in qapi-schema.json.
Signed-off-by Roman Bogorodskiy <[email protected]>---
Changes since v1:-
qga/qapi-schema.jsonspelling: windows -> Windows, freebsd -> FreeBSD in the "@GuestNetworkRoute" documentation.
- meson.build: check that the 'structrt_metrics' has 'rmx_metric' member which is available only on FreeBSD 16.Changes since v2:
Quoted 8 lines
- If interface name cannot be obtained, default it to "if<index>" instead of "?", similarly to the Windows implementation.
- Usegetnameinfo()for bothAF_INETandAF_INET6formatting.meson.build | 6 ++ qga/commands-bsd.c | 173 +++++++++++++++++++++++++++++++++++++++++++ qga/qapi-schema.json | 31 ++++---- 3 files changed, 195 insertions(+), 15 deletions(-)Reviewed-by Daniel P. Berrangé <[email protected]>With regards,
Daniel
--|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|