On Mon, Apr 13, 2026 at 10:23:45 -0500, Wesley Hershberger wrote:
> Introduce a read-only `tapfd` element for direct interfaces (macvtap),
> which contains the path to the backing tapfd for that interface
> (e.g. `/dev/tapXX`).
> 
> The element is only included when the domain is being formatted for
> internal consumption (VIR_DOMAIN_DEF_FORMAT_STATUS) and is not accepted
> in user-provided XML (!VIR_DOMAIN_DEF_PARSE_INACTIVE).
> 
> This will be used by the AppArmor security driver when re-generating
> profiles.
> 
> Reviewed-by: Peter Krempa <[email protected]>
> Signed-off-by: Wesley Hershberger <[email protected]>
> ---
>  src/conf/domain_conf.c                    |  8 ++++++++
>  src/conf/domain_conf.h                    |  1 +
>  src/hypervisor/domain_interface.c         |  2 +-
>  src/lxc/lxc_process.c                     |  1 +
>  src/qemu/qemu_interface.c                 |  1 +
>  src/util/virnetdevmacvlan.c               | 18 +++++++++++-------
>  src/util/virnetdevmacvlan.h               |  4 +++-
>  tests/qemustatusxml2xmldata/modern-in.xml |  7 +++++++
>  8 files changed, 33 insertions(+), 9 deletions(-)

[...]

> diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
> index cde9d70eef..07ccef52d9 100644
> --- a/src/util/virnetdevmacvlan.c
> +++ b/src/util/virnetdevmacvlan.c
> @@ -152,24 +152,24 @@ int virNetDevMacVLanDelete(const char *ifname)
>  int
>  virNetDevMacVLanTapOpen(const char *ifname,
>                          int *tapfd,
> -                        size_t tapfdSize)
> +                        size_t tapfdSize,
> +                        char **tapname)
>  {
>      int retries = 10;
>      int ret = -1;
>      int ifindex;
>      size_t i = 0;
> -    g_autofree char *tapname = NULL;
>  
>      if (virNetDevGetIndex(ifname, &ifindex) < 0)
>          return -1;
>  
> -    tapname = g_strdup_printf("/dev/tap%d", ifindex);
> +    *tapname = g_strdup_printf("/dev/tap%d", ifindex);
>  
>      for (i = 0; i < tapfdSize; i++) {
>          int fd = -1;
>  
>          while (fd < 0) {
> -            if ((fd = open(tapname, O_RDWR)) >= 0) {
> +            if ((fd = open(*tapname, O_RDWR)) >= 0) {
>                  tapfd[i] = fd;
>              } else if (retries-- > 0) {
>                  /* may need to wait for udev to be done */
> @@ -178,7 +178,7 @@ virNetDevMacVLanTapOpen(const char *ifname,
>                  /* However, if haven't succeeded, quit. */
>                  virReportSystemError(errno,
>                                       _("cannot open macvtap tap device 
> %1$s"),
> -                                     tapname);
> +                                     *tapname);
>                  goto cleanup;

The two hunks above had a conflict with recently merged\
e52ca27026c08d1bee48fcb63ec717ef96d7911ae although it was
straightforward to address


>              }
>          }

Reply via email to