All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Brad Smith <brad@comstyle.com>
Cc: Michael Roth <michael.roth@amd.com>,
	 Kostiantyn Kostiuk <kkostiuk@redhat.com>,
	 Roman Bogorodskiy <bogorodskiy@gmail.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH] qga: implement 'guest-network-get-route' for NetBSD and OpenBSD
Date: Mon, 02 Nov 2026 08:48:03 +0100	[thread overview]
Message-ID: <87qzh3u11o.fsf@pond.sub.org> (raw)
In-Reply-To: <auVz7XxhHqAn3QEW@humpty.home.comstyle.com> (Brad Smith's message of "Sat, 31 Oct 2026 00:51:57 -0400")

You forgot to cc: me.  scripts/get_maintainer.pl is your friend.

Brad Smith <brad@comstyle.com> writes:

> qga: implement 'guest-network-get-route' for NetBSD and OpenBSD
>
> Extend the FreeBSD routing table implementation to NetBSD and
> OpenBSD. All three dump the table with the NET_RT_DUMP sysctl and
> walk rt_msghdr messages, but differ in a few details:
>
> - Locating the sockaddrs: OpenBSD places them after rtm_hdrlen
>   bytes and pads each to sizeof(long). NetBSD uses RT_ROUNDUP() and
>   FreeBSD SA_SIZE(). Add RT_FIRST_SA() and RT_SA_SIZE() macros to
>   cover these.
>
> - The sysctl MIB: NetBSD rejects the trailing routing table ID with
>   EINVAL, so use the 6 element form there. FreeBSD and OpenBSD keep
>   the 7 element form and dump table 0.
>
> - ARP/NDP entries: OpenBSD and NetBSD return neighbour entries in
>   the routing table dump. Skip them via RTF_LLINFO (OpenBSD) or
>   RTF_LLDATA (NetBSD, which renamed the flag).
>
> - IPv6 scope: NetBSD and OpenBSD return link-local and scoped
>   multicast addresses with the KAME embedded scope ID in bytes 2-3
>   of the address. Move it into sin6_scope_id before calling
>   getnameinfo(), so these print as fe80::...%iface as on FreeBSD.
>   This is a no-op on FreeBSD, where the kernel already does this.
>
> Also use ARRAY_SIZE() instead of nitems(), which NetBSD lacks.
>
> Tested on FreeBSD, NetBSD and OpenBSD, comparing the output
> against netstat -rn.
>
> Signed-off-by: Brad Smith <brad@comstyle.com>

[...]

> diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
> index 7b937713e6..1b8959d658 100644
> --- a/qga/qapi-schema.json
> +++ b/qga/qapi-schema.json
> @@ -1824,7 +1824,7 @@
>  ##
>  # @GuestNetworkRoute:
>  #     Route information.  Supported on Linux (since 9.1), Windows
> -#     (since 11.0), and FreeBSD (since 11.2).
> +#     (since 11.0), and BSD (since 11.2).

"Supported on ..." is redundant with the formal "Since: " below.  Please
use the opportunity to delete it.

>  #
>  # @iface: The destination network or host's egress network interface
>  #     in the routing table
> @@ -1838,31 +1838,31 @@
>  #
>  # @mask: Subnet Mask (IPv4 only)
>  #
> -# @irtt: Initial round-trip delay (not for Windows and FreeBSD,
> +# @irtt: Initial round-trip delay (not for Windows and BSD,
>  #     IPv4 only)
>  #
>  # @flags: Route flags (not for Windows)
>  #
> -# @refcnt: The route's reference count (not for Windows and FreeBSD)
> +# @refcnt: The route's reference count (not for Windows and BSD)
>  #
> -# @use: Route usage count (not for Windows and FreeBSD)
> +# @use: Route usage count (not for Windows and BSD)
>  #
>  # @window: TCP window size, used for flow control (not for Windows
> -#     and FreeBSD, IPv4 only)
> +#     and BSD, IPv4 only)
>  #
>  # @mtu: Data link layer maximum packet size (not for Windows)
>  #
>  # @desprefixlen: Destination prefix length (for IPv6)
>  #
> -# @source: Source IP address (not for FreeBSD, IPv6 only)
> +# @source: Source IP address (not for BSD, IPv6 only)
>  #
> -# @srcprefixlen: Source prefix length (not for FreeBSD, IPv6 only)
> +# @srcprefixlen: Source prefix length (not for BSD, IPv6 only)
>  #
>  # @nexthop: Next hop IP address (for IPv6)
>  #
>  # @version: IP version (4 or 6)
>  #
> -# Since: 9.1 (Linux only); 11.0 (Windows); 11.2 (FreeBSD)
> +# Since: 9.1 (Linux only); 11.0 (Windows); 11.2 (BSD)
>  ##
>  { 'struct': 'GuestNetworkRoute',
>    'data': {'iface': 'str',
> @@ -1882,7 +1882,7 @@
>             '*nexthop': 'str',
>             'version': 'int'
>             },
> -  'if': { 'any': ['CONFIG_LINUX', 'CONFIG_WIN32', 'CONFIG_FREEBSD'] } }
> +  'if': { 'any': ['CONFIG_LINUX', 'CONFIG_WIN32', 'CONFIG_BSD'] } }
>  
>  ##
>  # @guest-network-get-route:
> @@ -1890,9 +1890,9 @@
>  #
>  # Returns: List of route info of guest.
>  #
> -# Since: 9.1 (Linux only); 11.0 (Windows); 11.2 (FreeBSD)
> +# Since: 9.1 (Linux only); 11.0 (Windows); 11.2 (BSD)
>  ##
>  { 'command': 'guest-network-get-route',
>    'returns': ['GuestNetworkRoute'],
> -  'if': { 'any': ['CONFIG_LINUX', 'CONFIG_WIN32', 'CONFIG_FREEBSD'] }
> +  'if': { 'any': ['CONFIG_LINUX', 'CONFIG_WIN32', 'CONFIG_BSD'] }
>  }

Acked-by: Markus Armbruster <armbru@redhat.com>



      parent reply	other threads:[~2026-11-02  7:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-31  4:51 [PATCH] qga: implement 'guest-network-get-route' for NetBSD and OpenBSD Brad Smith
2026-10-31 15:27 ` Roman Bogorodskiy
2026-11-02  7:48 ` Markus Armbruster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87qzh3u11o.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=bogorodskiy@gmail.com \
    --cc=brad@comstyle.com \
    --cc=kkostiuk@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.