Re: [PATCH v2] virNetDevIPCheckIPv6ForwardingCallback fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Has that one been forgotten?

On Tue, 2017-03-28 at 16:00 +0200, Cédric Bosdonnat wrote:
> Add check for more than one RTA_OIF, even though this is rather
> unlikely.
> 
> Get rid of the buggy switch / break as this code won't need to
> handle more attributes.
> 
> Use VIR_WARNINGS_NO_CAST_ALIGN to fix impossible to fix
> util/virnetdevip.c:560:17: error: cast increases required alignment of target type [-Werror=cast-align]
> ---
>  Diff to v1:
>    * Add error message
>    * Use VIR_WARNINGS_NO_CAST_ALIGN
>  src/util/virnetdevip.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c
> index c9ac6baf7..726fa6c3e 100644
> --- a/src/util/virnetdevip.c
> +++ b/src/util/virnetdevip.c
> @@ -556,15 +556,24 @@ virNetDevIPCheckIPv6ForwardingCallback(const struct nlmsghdr *resp,
>      if (resp->nlmsg_type != RTM_NEWROUTE)
>          return ret;
>  
> -    /* Extract a few attributes */
> +    /* Extract a device ID attribute */
> +    VIR_WARNINGS_NO_CAST_ALIGN
>      for (rta = RTM_RTA(rtmsg); RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
> -        switch (rta->rta_type) {
> -        case RTA_OIF:
> +        VIR_WARNINGS_RESET
> +        if (rta->rta_type == RTA_OIF) {
>              oif = *(int *)RTA_DATA(rta);
>  
> +            /* Should never happen: netlink message would be broken */
> +            if (ifname) {
> +                char *ifname2 = virNetDevGetName(oif);
> +                VIR_WARN("Single route has unexpected 2nd interface "
> +                         "- '%s' and '%s'", ifname, ifname2);
> +                VIR_FREE(ifname2);
> +                break;
> +            }
> +
>              if (!(ifname = virNetDevGetName(oif)))
>                  goto error;
> -            break;
>          }
>      }
>  

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux