diff mbox series

[v2,2/4] linux-user: introduce QEMU_RTA_* to use with rtattr_type_t

Message ID 20180820171557.7734-3-laurent@vivier.eu
State New
Headers show
Series None | expand

Commit Message

Laurent Vivier Aug. 20, 2018, 5:15 p.m. UTC
Following commit will introduce RTA_PREF that appears only with
kernel v4.1. To avoid to manage a specific case for it, this patch
introduces the full list of rtattr_type_t prefixed with QEMU_ (as we
did for IFLA values)

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/syscall.c | 53 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 42 insertions(+), 11 deletions(-)

Comments

Peter Maydell Aug. 20, 2018, 5:31 p.m. UTC | #1
On 20 August 2018 at 18:15, Laurent Vivier <laurent@vivier.eu> wrote:
> Following commit will introduce RTA_PREF that appears only with
> kernel v4.1. To avoid to manage a specific case for it, this patch
> introduces the full list of rtattr_type_t prefixed with QEMU_ (as we
> did for IFLA values)
>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  linux-user/syscall.c | 53 +++++++++++++++++++++++++++++++++++---------
>  1 file changed, 42 insertions(+), 11 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index a62cd15dc7..a2395eb1b6 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -539,6 +539,37 @@ enum {
>      QEMU___IFLA_XDP_MAX,
>  };
>
> +enum {
> +    QEMU_RTA_UNSPEC,
> +    QEMU_RTA_DST,
> +    QEMU_RTA_SRC,
> +    QEMU_RTA_IIF,
> +    QEMU_RTA_OIF,
> +    QEMU_RTA_GATEWAY,
> +    QEMU_RTA_PRIORITY,
> +    QEMU_RTA_PREFSRC,
> +    QEMU_RTA_METRICS,
> +    QEMU_RTA_MULTIPATH,
> +    QEMU_RTA_PROTOINFO, /* no longer used */
> +    QEMU_RTA_FLOW,
> +    QEMU_RTA_CACHEINFO,
> +    QEMU_RTA_SESSION, /* no longer used */
> +    QEMU_RTA_MP_ALGO, /* no longer used */
> +    QEMU_RTA_TABLE,
> +    QEMU_RTA_MARK,
> +    QEMU_RTA_MFC_STATS,
> +    QEMU_RTA_VIA,
> +    QEMU_RTA_NEWDST,
> +    QEMU_RTA_PREF,
> +    QEMU_RTA_ENCAP_TYPE,
> +    QEMU_RTA_ENCAP,
> +    QEMU_RTA_EXPIRES,
> +    QEMU_RTA_PAD,
> +    QEMU_RTA_UID,
> +    QEMU_RTA_TTL_PROPAGATE,

Upstream 4.18 kernel has also
        RTA_IP_PROTO,
        RTA_SPORT,
        RTA_DPORT,

> +    QEMU___RTA_MAX
> +};

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

with or without those 3 extras, as you prefer.

thanks
-- PMM
diff mbox series

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index a62cd15dc7..a2395eb1b6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -539,6 +539,37 @@  enum {
     QEMU___IFLA_XDP_MAX,
 };
 
+enum {
+    QEMU_RTA_UNSPEC,
+    QEMU_RTA_DST,
+    QEMU_RTA_SRC,
+    QEMU_RTA_IIF,
+    QEMU_RTA_OIF,
+    QEMU_RTA_GATEWAY,
+    QEMU_RTA_PRIORITY,
+    QEMU_RTA_PREFSRC,
+    QEMU_RTA_METRICS,
+    QEMU_RTA_MULTIPATH,
+    QEMU_RTA_PROTOINFO, /* no longer used */
+    QEMU_RTA_FLOW,
+    QEMU_RTA_CACHEINFO,
+    QEMU_RTA_SESSION, /* no longer used */
+    QEMU_RTA_MP_ALGO, /* no longer used */
+    QEMU_RTA_TABLE,
+    QEMU_RTA_MARK,
+    QEMU_RTA_MFC_STATS,
+    QEMU_RTA_VIA,
+    QEMU_RTA_NEWDST,
+    QEMU_RTA_PREF,
+    QEMU_RTA_ENCAP_TYPE,
+    QEMU_RTA_ENCAP,
+    QEMU_RTA_EXPIRES,
+    QEMU_RTA_PAD,
+    QEMU_RTA_UID,
+    QEMU_RTA_TTL_PROPAGATE,
+    QEMU___RTA_MAX
+};
+
 typedef abi_long (*TargetFdDataFunc)(void *, size_t);
 typedef abi_long (*TargetFdAddrFunc)(void *, abi_ulong, socklen_t);
 typedef struct TargetFdTrans {
@@ -2661,14 +2692,14 @@  static abi_long host_to_target_data_route_rtattr(struct rtattr *rtattr)
     uint32_t *u32;
     switch (rtattr->rta_type) {
     /* binary: depends on family type */
-    case RTA_GATEWAY:
-    case RTA_DST:
-    case RTA_PREFSRC:
+    case QEMU_RTA_GATEWAY:
+    case QEMU_RTA_DST:
+    case QEMU_RTA_PREFSRC:
         break;
     /* u32 */
-    case RTA_PRIORITY:
-    case RTA_TABLE:
-    case RTA_OIF:
+    case QEMU_RTA_PRIORITY:
+    case QEMU_RTA_TABLE:
+    case QEMU_RTA_OIF:
         u32 = RTA_DATA(rtattr);
         *u32 = tswap32(*u32);
         break;
@@ -2808,13 +2839,13 @@  static abi_long target_to_host_data_route_rtattr(struct rtattr *rtattr)
     uint32_t *u32;
     switch (rtattr->rta_type) {
     /* binary: depends on family type */
-    case RTA_DST:
-    case RTA_SRC:
-    case RTA_GATEWAY:
+    case QEMU_RTA_DST:
+    case QEMU_RTA_SRC:
+    case QEMU_RTA_GATEWAY:
         break;
     /* u32 */
-    case RTA_PRIORITY:
-    case RTA_OIF:
+    case QEMU_RTA_PRIORITY:
+    case QEMU_RTA_OIF:
         u32 = RTA_DATA(rtattr);
         *u32 = tswap32(*u32);
         break;