[PATCH v2 6/6] linux-user: netlink: Add missing QEMU_IFLA entries

deller@kernel.org posted 6 patches 3 months, 1 week ago
There is a newer version of this series
[PATCH v2 6/6] linux-user: netlink: Add missing QEMU_IFLA entries
Posted by deller@kernel.org 3 months, 1 week ago
From: Helge Deller <deller@gmx.de>

This fixes the following qemu warnings when building debian gupnp package:
 Unknown host QEMU_IFLA type: 61
 Unknown host QEMU_IFLA type: 58
 Unknown host QEMU_IFLA type: 59
 Unknown host QEMU_IFLA type: 60
 Unknown host QEMU_IFLA type: 32820

QEMU_IFLA type 32820 is actually NLA_NESTED | QEMU_IFLA_PROP_LIST (a nested
entry), which is why rta_type needs to be masked with NLA_TYPE_MASK.

Signed-off-by: Helge Deller <deller@gmx.de>
---
 linux-user/fd-trans.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c
index a5e6c6b6f2..6a8775bb55 100644
--- a/linux-user/fd-trans.c
+++ b/linux-user/fd-trans.c
@@ -145,6 +145,14 @@ enum {
     QEMU_IFLA_PROTO_DOWN_REASON,
     QEMU_IFLA_PARENT_DEV_NAME,
     QEMU_IFLA_PARENT_DEV_BUS_NAME,
+    QEMU_IFLA_GRO_MAX_SIZE,
+    QEMU_IFLA_TSO_MAX_SIZE,
+    QEMU_IFLA_TSO_MAX_SEGS,
+    QEMU_IFLA_ALLMULTI,
+    QEMU_IFLA_DEVLINK_PORT,
+    QEMU_IFLA_GSO_IPV4_MAX_SIZE,
+    QEMU_IFLA_GRO_IPV4_MAX_SIZE,
+    QEMU_IFLA_DPLL_PIN,
     QEMU___IFLA_MAX
 };
 
@@ -986,6 +994,22 @@ static abi_long host_to_target_data_vfinfo_nlattr(struct nlattr *nlattr,
     return 0;
 }
 
+static abi_long host_to_target_data_prop_nlattr(struct nlattr *nlattr,
+                                                void *context)
+{
+    switch (nlattr->nla_type) {
+    /* string */
+    case QEMU_IFLA_ALT_IFNAME:
+        break;
+    default:
+        qemu_log_mask(LOG_UNIMP, "Unknown host PROP type: %d\n",
+                      nlattr->nla_type);
+        break;
+    }
+    return 0;
+}
+
+
 static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
 {
     uint32_t *u32;
@@ -994,7 +1018,7 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
     struct rtnl_link_ifmap *map;
     struct linkinfo_context li_context;
 
-    switch (rtattr->rta_type) {
+    switch (rtattr->rta_type & NLA_TYPE_MASK) {
     /* binary stream */
     case QEMU_IFLA_ADDRESS:
     case QEMU_IFLA_BROADCAST:
@@ -1032,6 +1056,12 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
     case QEMU_IFLA_CARRIER_DOWN_COUNT:
     case QEMU_IFLA_MIN_MTU:
     case QEMU_IFLA_MAX_MTU:
+    case QEMU_IFLA_GRO_MAX_SIZE:
+    case QEMU_IFLA_TSO_MAX_SIZE:
+    case QEMU_IFLA_TSO_MAX_SEGS:
+    case QEMU_IFLA_ALLMULTI:
+    case QEMU_IFLA_GSO_IPV4_MAX_SIZE:
+    case QEMU_IFLA_GRO_IPV4_MAX_SIZE:
         u32 = RTA_DATA(rtattr);
         *u32 = tswap32(*u32);
         break;
@@ -1127,6 +1157,10 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
         return host_to_target_for_each_nlattr(RTA_DATA(rtattr), rtattr->rta_len,
                                               NULL,
                                              host_to_target_data_vfinfo_nlattr);
+    case QEMU_IFLA_PROP_LIST:
+        return host_to_target_for_each_nlattr(RTA_DATA(rtattr), rtattr->rta_len,
+                                              NULL,
+                                             host_to_target_data_prop_nlattr);
     default:
         qemu_log_mask(LOG_UNIMP, "Unknown host QEMU_IFLA type: %d\n",
                       rtattr->rta_type);
-- 
2.47.0
Re: [PATCH v2 6/6] linux-user: netlink: Add missing QEMU_IFLA entries
Posted by Laurent Vivier 2 months, 3 weeks ago
Le 27/12/2024 à 21:54, deller@kernel.org a écrit :
> From: Helge Deller <deller@gmx.de>
> 
> This fixes the following qemu warnings when building debian gupnp package:
>   Unknown host QEMU_IFLA type: 61
>   Unknown host QEMU_IFLA type: 58
>   Unknown host QEMU_IFLA type: 59
>   Unknown host QEMU_IFLA type: 60
>   Unknown host QEMU_IFLA type: 32820
> 
> QEMU_IFLA type 32820 is actually NLA_NESTED | QEMU_IFLA_PROP_LIST (a nested
> entry), which is why rta_type needs to be masked with NLA_TYPE_MASK.
> 
> Signed-off-by: Helge Deller <deller@gmx.de>
> ---
>   linux-user/fd-trans.c | 36 +++++++++++++++++++++++++++++++++++-
>   1 file changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c
> index a5e6c6b6f2..6a8775bb55 100644
> --- a/linux-user/fd-trans.c
> +++ b/linux-user/fd-trans.c
> @@ -145,6 +145,14 @@ enum {
>       QEMU_IFLA_PROTO_DOWN_REASON,
>       QEMU_IFLA_PARENT_DEV_NAME,
>       QEMU_IFLA_PARENT_DEV_BUS_NAME,
> +    QEMU_IFLA_GRO_MAX_SIZE,
> +    QEMU_IFLA_TSO_MAX_SIZE,
> +    QEMU_IFLA_TSO_MAX_SEGS,
> +    QEMU_IFLA_ALLMULTI,
> +    QEMU_IFLA_DEVLINK_PORT,
> +    QEMU_IFLA_GSO_IPV4_MAX_SIZE,
> +    QEMU_IFLA_GRO_IPV4_MAX_SIZE,
> +    QEMU_IFLA_DPLL_PIN,
>       QEMU___IFLA_MAX
>   };
>   
> @@ -986,6 +994,22 @@ static abi_long host_to_target_data_vfinfo_nlattr(struct nlattr *nlattr,
>       return 0;
>   }
>   
> +static abi_long host_to_target_data_prop_nlattr(struct nlattr *nlattr,
> +                                                void *context)
> +{
> +    switch (nlattr->nla_type) {
> +    /* string */
> +    case QEMU_IFLA_ALT_IFNAME:
> +        break;
> +    default:
> +        qemu_log_mask(LOG_UNIMP, "Unknown host PROP type: %d\n",
> +                      nlattr->nla_type);
> +        break;
> +    }
> +    return 0;
> +}
> +
> +
>   static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
>   {
>       uint32_t *u32;
> @@ -994,7 +1018,7 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
>       struct rtnl_link_ifmap *map;
>       struct linkinfo_context li_context;
>   
> -    switch (rtattr->rta_type) {
> +    switch (rtattr->rta_type & NLA_TYPE_MASK) {
>       /* binary stream */
>       case QEMU_IFLA_ADDRESS:
>       case QEMU_IFLA_BROADCAST:
> @@ -1032,6 +1056,12 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
>       case QEMU_IFLA_CARRIER_DOWN_COUNT:
>       case QEMU_IFLA_MIN_MTU:
>       case QEMU_IFLA_MAX_MTU:
> +    case QEMU_IFLA_GRO_MAX_SIZE:
> +    case QEMU_IFLA_TSO_MAX_SIZE:
> +    case QEMU_IFLA_TSO_MAX_SEGS:
> +    case QEMU_IFLA_ALLMULTI:
> +    case QEMU_IFLA_GSO_IPV4_MAX_SIZE:
> +    case QEMU_IFLA_GRO_IPV4_MAX_SIZE:
>           u32 = RTA_DATA(rtattr);
>           *u32 = tswap32(*u32);
>           break;
> @@ -1127,6 +1157,10 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr)
>           return host_to_target_for_each_nlattr(RTA_DATA(rtattr), rtattr->rta_len,
>                                                 NULL,
>                                                host_to_target_data_vfinfo_nlattr);
> +    case QEMU_IFLA_PROP_LIST:
> +        return host_to_target_for_each_nlattr(RTA_DATA(rtattr), rtattr->rta_len,
> +                                              NULL,
> +                                             host_to_target_data_prop_nlattr);
>       default:
>           qemu_log_mask(LOG_UNIMP, "Unknown host QEMU_IFLA type: %d\n",
>                         rtattr->rta_type);

Reviewed-by: Laurent Vivier <laurent@vivier.eu>